Skip to content

Commit

Permalink
Update flutter_modular.dart to not take back button priority
Browse files Browse the repository at this point in the history
  • Loading branch information
ozzfelipe authored Sep 12, 2023
1 parent edc1919 commit b34b561
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion flutter_modular/lib/flutter_modular.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library flutter_modular;
library flutter_modular_forked;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -98,6 +98,9 @@ class RouterOutletState extends State<RouterOutlet> {
/// visible for test
@visibleForTesting
void listener() {
print(Modular.to.path);
final modal = ModalRoute.of(context)?.settings as ModularPage?;

setState(() {});
}

Expand All @@ -114,6 +117,12 @@ class RouterOutletState extends State<RouterOutlet> {
_navigatorKey,
currentObservers,
);
if (!(modal?.route.children.any((e) => Modular.to.path.contains(e.name)) ??
true)) {
print('is not a children');
_backButtonDispatcher = null;
return;
}
final router = Router.of(context);
_backButtonDispatcher = router.backButtonDispatcher //
?.createChildBackButtonDispatcher();
Expand Down

0 comments on commit b34b561

Please sign in to comment.