Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Drag until fully visible #97

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cc47f26
Warn if dragStart is not fully tappable, add test
danielmolnar Jan 7, 2025
b3f4cf1
Drag until fully visible by default
danielmolnar Jan 7, 2025
4bbe11e
Use int for visibility check
danielmolnar Jan 7, 2025
332c190
Reimplement dragUntilVisible to scroll the widget in the visible area
passsy Jan 10, 2025
493a6cd
Fix tests
danielmolnar Jan 10, 2025
54de7ee
Add horizontal scroll tests
danielmolnar Jan 10, 2025
ae45c86
Improve test description
danielmolnar Jan 10, 2025
55e35e4
Adjust scroll direction text
danielmolnar Jan 13, 2025
a7ac511
Adjust test widget
danielmolnar Jan 13, 2025
11de352
Adjust error messages according to act type
danielmolnar Jan 13, 2025
1fba12f
Switch from Viewport to Listener
passsy Jan 13, 2025
8afb3bc
Better describe scroll direction
passsy Jan 13, 2025
fb8578b
Make moveStep optional
passsy Jan 13, 2025
b9d6437
Implement "toStart"
danielmolnar Jan 13, 2025
068fb96
Add asserts
danielmolnar Jan 13, 2025
b1a3675
Add assert and toStart tests
danielmolnar Jan 13, 2025
4afbdf8
Rm unused test widget
danielmolnar Jan 13, 2025
941ea74
Rm timeline mode always
danielmolnar Jan 14, 2025
0300c02
Use tolerance-based offset checks to accommodate minor layout differe…
danielmolnar Jan 14, 2025
febe524
Use experimental approach
danielmolnar Jan 14, 2025
efc729d
Revert "Use experimental approach"
danielmolnar Jan 14, 2025
fd09b0e
Use "viewport" instead of "visible" for naming
danielmolnar Jan 15, 2025
a3dc413
Add nested scrollable test widget
danielmolnar Jan 17, 2025
7f6f623
Find relevant scrollable and add nested test (preliminary)
danielmolnar Jan 17, 2025
472a940
Improve test widget and add test "Finds, drags to and taps target in …
danielmolnar Jan 22, 2025
680f3cb
Implement fallback selector for final bounding-box check when the ori…
danielmolnar Jan 22, 2025
3c832d5
Rm unnecessary import
danielmolnar Jan 22, 2025
dbfbc8c
Pass ScrollDirection to SingleChildScrollView
danielmolnar Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,132 changes: 700 additions & 432 deletions lib/src/act/act.dart

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions lib/src/spot/element_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ extension ElementExtensions on Element {
yield* found;
}

/// Returns all children of [Element] of any depth
Iterable<Element> get allChildren sync* {
final List<Element> found = [];
void visit(Element element) {
found.add(element);
element.visitChildren(visit);
}

visit(this);
yield* found;
}

/// Returns only onstage children of [Element], only direct children
///
/// Children of [Offstage] or [Overlay] are eventually not returned,
Expand Down
30 changes: 1 addition & 29 deletions lib/src/spot/snapshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:spot/spot.dart';
import 'package:spot/src/screenshot/screenshot_annotator.dart';
import 'package:spot/src/spot/element_extensions.dart';
import 'package:spot/src/spot/filters/onstage_filter.dart';
import 'package:spot/src/spot/widget_selector.dart';

Expand Down Expand Up @@ -621,35 +622,6 @@ void _dumpWidgetTree(StringBuffer buffer) {
}
}

/// Extension on [Element] providing access to parent and child elements.
extension ElementParent on Element {
/// Gets the immediate parent of this element.
Element? get parent {
Element? parent;
visitAncestorElements((element) {
parent = element;
return false;
});
return parent;
}

/// Gets all parent elements of this element.
Iterable<Element> get parents sync* {
Element? element = this;
while (element != null) {
yield element;
element = element.parent;
}
}

/// Gets all immediate child elements of this element.
Iterable<Element> get children sync* {
final List<Element> found = [];
visitChildren(found.add);
yield* found;
}
}

/// Extension on [WidgetSelector] providing methods to generate less specific selectors.
@visibleForTesting
extension LessSpecificSelectors<W extends Widget> on WidgetSelector<W> {
Expand Down
Loading