@@ -455,21 +455,13 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
455455/// An entry in the history of a [LocalHistoryRoute] .
456456class LocalHistoryEntry {
457457 /// Creates an entry in the history of a [LocalHistoryRoute] .
458- ///
459- /// The [impliesAppBarDismissal] defaults to true if not provided.
460- LocalHistoryEntry ({ this .onRemove, this .impliesAppBarDismissal = true });
458+ LocalHistoryEntry ({ this .onRemove });
461459
462460 /// Called when this entry is removed from the history of its associated [LocalHistoryRoute] .
463461 final VoidCallback ? onRemove;
464462
465463 LocalHistoryRoute <dynamic >? _owner;
466464
467- /// Whether an [AppBar] in the route this entry belongs to should
468- /// automatically add a back button or close button.
469- ///
470- /// Defaults to true.
471- final bool impliesAppBarDismissal;
472-
473465 /// Remove this entry from the history of its associated [LocalHistoryRoute] .
474466 void remove () {
475467 _owner? .removeLocalHistoryEntry (this );
@@ -490,7 +482,7 @@ class LocalHistoryEntry {
490482/// is removed from the list and its [LocalHistoryEntry.onRemove] is called.
491483mixin LocalHistoryRoute <T > on Route <T > {
492484 List <LocalHistoryEntry >? _localHistory;
493- int _entriesImpliesAppBarDismissal = 0 ;
485+
494486 /// Adds a local history entry to this route.
495487 ///
496488 /// When asked to pop, if this route has any local history entries, this route
@@ -628,12 +620,7 @@ mixin LocalHistoryRoute<T> on Route<T> {
628620 _localHistory ?? = < LocalHistoryEntry > [];
629621 final bool wasEmpty = _localHistory! .isEmpty;
630622 _localHistory! .add (entry);
631- bool internalStateChanged = false ;
632- if (entry.impliesAppBarDismissal) {
633- internalStateChanged = _entriesImpliesAppBarDismissal == 0 ;
634- _entriesImpliesAppBarDismissal += 1 ;
635- }
636- if (wasEmpty || internalStateChanged)
623+ if (wasEmpty)
637624 changedInternalState ();
638625 }
639626
@@ -645,15 +632,10 @@ mixin LocalHistoryRoute<T> on Route<T> {
645632 assert (entry != null );
646633 assert (entry._owner == this );
647634 assert (_localHistory! .contains (entry));
648- bool internalStateChanged = false ;
649- if (_localHistory! .remove (entry) && entry.impliesAppBarDismissal) {
650- _entriesImpliesAppBarDismissal -= 1 ;
651- internalStateChanged = _entriesImpliesAppBarDismissal == 0 ;
652- }
635+ _localHistory! .remove (entry);
653636 entry._owner = null ;
654637 entry._notifyRemoved ();
655- if (_localHistory! .isEmpty || internalStateChanged) {
656- assert (_entriesImpliesAppBarDismissal == 0 );
638+ if (_localHistory! .isEmpty) {
657639 if (SchedulerBinding .instance.schedulerPhase == SchedulerPhase .persistentCallbacks) {
658640 // The local history might be removed as a result of disposing inactive
659641 // elements during finalizeTree. The state is locked at this moment, and
@@ -681,12 +663,7 @@ mixin LocalHistoryRoute<T> on Route<T> {
681663 assert (entry._owner == this );
682664 entry._owner = null ;
683665 entry._notifyRemoved ();
684- bool internalStateChanged = false ;
685- if (entry.impliesAppBarDismissal) {
686- _entriesImpliesAppBarDismissal -= 1 ;
687- internalStateChanged = _entriesImpliesAppBarDismissal == 0 ;
688- }
689- if (_localHistory! .isEmpty || internalStateChanged)
666+ if (_localHistory! .isEmpty)
690667 changedInternalState ();
691668 return false ;
692669 }
@@ -720,7 +697,6 @@ class _ModalScopeStatus extends InheritedWidget {
720697 const _ModalScopeStatus ({
721698 required this .isCurrent,
722699 required this .canPop,
723- required this .impliesAppBarDismissal,
724700 required this .route,
725701 required super .child,
726702 }) : assert (isCurrent != null ),
@@ -730,14 +706,12 @@ class _ModalScopeStatus extends InheritedWidget {
730706
731707 final bool isCurrent;
732708 final bool canPop;
733- final bool impliesAppBarDismissal;
734709 final Route <dynamic > route;
735710
736711 @override
737712 bool updateShouldNotify (_ModalScopeStatus old) {
738713 return isCurrent != old.isCurrent ||
739714 canPop != old.canPop ||
740- impliesAppBarDismissal != old.impliesAppBarDismissal ||
741715 route != old.route;
742716 }
743717
@@ -746,7 +720,6 @@ class _ModalScopeStatus extends InheritedWidget {
746720 super .debugFillProperties (description);
747721 description.add (FlagProperty ('isCurrent' , value: isCurrent, ifTrue: 'active' , ifFalse: 'inactive' ));
748722 description.add (FlagProperty ('canPop' , value: canPop, ifTrue: 'can pop' ));
749- description.add (FlagProperty ('impliesAppBarDismissal' , value: impliesAppBarDismissal, ifTrue: 'implies app bar dismissal' ));
750723 }
751724}
752725
@@ -849,7 +822,6 @@ class _ModalScopeState<T> extends State<_ModalScope<T>> {
849822 route: widget.route,
850823 isCurrent: widget.route.isCurrent, // _routeSetState is called if this updates
851824 canPop: widget.route.canPop, // _routeSetState is called if this updates
852- impliesAppBarDismissal: widget.route.impliesAppBarDismissal,
853825 child: Offstage (
854826 offstage: widget.route.offstage, // _routeSetState is called if this updates
855827 child: PageStorage (
@@ -1589,14 +1561,6 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
15891561 /// notified.
15901562 bool get canPop => hasActiveRouteBelow || willHandlePopInternally;
15911563
1592- /// Whether an [AppBar] in the route should automatically add a back button or
1593- /// close button.
1594- ///
1595- /// This getter returns true if there is at least one active route below it,
1596- /// or there is at least one [LocalHistoryEntry] with `impliesAppBarDismissal`
1597- /// set to true
1598- bool get impliesAppBarDismissal => hasActiveRouteBelow || _entriesImpliesAppBarDismissal > 0 ;
1599-
16001564 // Internals
16011565
16021566 final GlobalKey <_ModalScopeState <T >> _scopeKey = GlobalKey <_ModalScopeState <T >>();
0 commit comments