Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Apr 2, 2024
1 parent ce11a74 commit 821ffb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions lib/flow_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ class _FlowBuilderState<T> extends State<FlowBuilder<T>> {
controller: _controller,
child: _ConditionalPopScope(
condition: _canPop,
onPopInvoked: (bool _) => _navigator?.maybePop(),
child: Navigator(
key: _navigatorKey,
pages: _pages,
Expand Down Expand Up @@ -330,23 +329,15 @@ class FakeFlowController<T> extends FlowController<T> {
class _ConditionalPopScope extends StatelessWidget {
const _ConditionalPopScope({
required this.condition,
required this.onPopInvoked,
required this.child,
});

final bool condition;
final Widget child;
final PopInvokedCallback onPopInvoked;

@override
Widget build(BuildContext context) {
return condition
? PopScope(
canPop: false,
onPopInvoked: onPopInvoked,
child: child,
)
: child;
return condition ? PopScope(canPop: false, child: child) : child;
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/flow_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ void main() {
expect(navigators.last.observers, equals(observers));
});

testWidgets('SystemNavigator.pop respects when PopScope(canPop: false)',
testWidgets('SystemNavigator.pop respects PopScope(canPop: false)',
(tester) async {
const targetKey = Key('__target__');
var onPopCallCount = 0;
Expand Down Expand Up @@ -1442,7 +1442,7 @@ void main() {
expect(find.byKey(targetKey), findsOneWidget);
});

testWidgets('SystemNavigator.pop respects when PopScope(canPop: true)',
testWidgets('SystemNavigator.pop respects PopScope(canPop: true)',
(tester) async {
const targetKey = Key('__target__');
var onPopCallCount = 0;
Expand Down

0 comments on commit 821ffb6

Please sign in to comment.