This reverts commit e2d12060a2bc574a3e1209e206d5cf031cdbc335.
This commit is contained in:
parent
ec8289c3f9
commit
e16dc4440d
@ -807,9 +807,9 @@ class _AppBarState extends State<AppBar> {
|
|||||||
|
|
||||||
final bool hasDrawer = scaffold?.hasDrawer ?? false;
|
final bool hasDrawer = scaffold?.hasDrawer ?? false;
|
||||||
final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false;
|
final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false;
|
||||||
|
final bool canPop = parentRoute?.canPop ?? false;
|
||||||
final bool useCloseButton = parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
|
final bool useCloseButton = parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
|
||||||
final bool requiresAppBarDismiss = scaffold?.requiresAppBarDismiss ?? false;
|
|
||||||
final bool hasActiveRouteBelow = parentRoute?.hasActiveRouteBelow ?? false;
|
|
||||||
final double toolbarHeight = widget.toolbarHeight ?? appBarTheme.toolbarHeight ?? kToolbarHeight;
|
final double toolbarHeight = widget.toolbarHeight ?? appBarTheme.toolbarHeight ?? kToolbarHeight;
|
||||||
final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? false;
|
final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? false;
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ class _AppBarState extends State<AppBar> {
|
|||||||
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (hasActiveRouteBelow || requiresAppBarDismiss)
|
if (!hasEndDrawer && canPop)
|
||||||
leading = useCloseButton ? const CloseButton() : const BackButton();
|
leading = useCloseButton ? const CloseButton() : const BackButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1917,20 +1917,13 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
|
|||||||
|
|
||||||
/// Whether this scaffold has a non-null [Scaffold.appBar].
|
/// Whether this scaffold has a non-null [Scaffold.appBar].
|
||||||
bool get hasAppBar => widget.appBar != null;
|
bool get hasAppBar => widget.appBar != null;
|
||||||
|
|
||||||
/// Whether this scaffold has a non-null [Scaffold.drawer].
|
/// Whether this scaffold has a non-null [Scaffold.drawer].
|
||||||
bool get hasDrawer => widget.drawer != null;
|
bool get hasDrawer => widget.drawer != null;
|
||||||
|
|
||||||
/// Whether this scaffold has a non-null [Scaffold.endDrawer].
|
/// Whether this scaffold has a non-null [Scaffold.endDrawer].
|
||||||
bool get hasEndDrawer => widget.endDrawer != null;
|
bool get hasEndDrawer => widget.endDrawer != null;
|
||||||
|
|
||||||
/// Whether this scaffold has a non-null [Scaffold.floatingActionButton].
|
/// Whether this scaffold has a non-null [Scaffold.floatingActionButton].
|
||||||
bool get hasFloatingActionButton => widget.floatingActionButton != null;
|
bool get hasFloatingActionButton => widget.floatingActionButton != null;
|
||||||
|
|
||||||
/// Whether this scaffold requires [Scaffold.appBar] to automatically add
|
|
||||||
/// dismiss button.
|
|
||||||
bool get requiresAppBarDismiss => _persistentSheetHistoryEntry != null;
|
|
||||||
|
|
||||||
double? _appBarMaxHeight;
|
double? _appBarMaxHeight;
|
||||||
/// The max height the [Scaffold.appBar] uses.
|
/// The max height the [Scaffold.appBar] uses.
|
||||||
///
|
///
|
||||||
@ -2058,28 +2051,28 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
|
|||||||
PersistentBottomSheetController<dynamic>? _currentBottomSheet;
|
PersistentBottomSheetController<dynamic>? _currentBottomSheet;
|
||||||
final GlobalKey _currentBottomSheetKey = GlobalKey();
|
final GlobalKey _currentBottomSheetKey = GlobalKey();
|
||||||
|
|
||||||
LocalHistoryEntry? _persistentSheetHistoryEntry;
|
|
||||||
void _maybeBuildPersistentBottomSheet() {
|
void _maybeBuildPersistentBottomSheet() {
|
||||||
if (widget.bottomSheet != null && _currentBottomSheet == null) {
|
if (widget.bottomSheet != null && _currentBottomSheet == null) {
|
||||||
// The new _currentBottomSheet is not a local history entry so a "back" button
|
// The new _currentBottomSheet is not a local history entry so a "back" button
|
||||||
// will not be added to the Scaffold's appbar and the bottom sheet will not
|
// will not be added to the Scaffold's appbar and the bottom sheet will not
|
||||||
// support drag or swipe to dismiss.
|
// support drag or swipe to dismiss.
|
||||||
final AnimationController animationController = BottomSheet.createAnimationController(this)..value = 1.0;
|
final AnimationController animationController = BottomSheet.createAnimationController(this)..value = 1.0;
|
||||||
|
LocalHistoryEntry? persistentSheetHistoryEntry;
|
||||||
bool _persistentBottomSheetExtentChanged(DraggableScrollableNotification notification) {
|
bool _persistentBottomSheetExtentChanged(DraggableScrollableNotification notification) {
|
||||||
if (notification.extent > notification.initialExtent) {
|
if (notification.extent > notification.initialExtent) {
|
||||||
if (_persistentSheetHistoryEntry == null) {
|
if (persistentSheetHistoryEntry == null) {
|
||||||
_persistentSheetHistoryEntry = LocalHistoryEntry(onRemove: () {
|
persistentSheetHistoryEntry = LocalHistoryEntry(onRemove: () {
|
||||||
if (notification.extent > notification.initialExtent) {
|
if (notification.extent > notification.initialExtent) {
|
||||||
DraggableScrollableActuator.reset(notification.context);
|
DraggableScrollableActuator.reset(notification.context);
|
||||||
}
|
}
|
||||||
showBodyScrim(false, 0.0);
|
showBodyScrim(false, 0.0);
|
||||||
_floatingActionButtonVisibilityValue = 1.0;
|
_floatingActionButtonVisibilityValue = 1.0;
|
||||||
_persistentSheetHistoryEntry = null;
|
persistentSheetHistoryEntry = null;
|
||||||
});
|
});
|
||||||
ModalRoute.of(context)!.addLocalHistoryEntry(_persistentSheetHistoryEntry!);
|
ModalRoute.of(context)!.addLocalHistoryEntry(persistentSheetHistoryEntry!);
|
||||||
}
|
}
|
||||||
} else if (_persistentSheetHistoryEntry != null) {
|
} else if (persistentSheetHistoryEntry != null) {
|
||||||
ModalRoute.of(context)!.removeLocalHistoryEntry(_persistentSheetHistoryEntry!);
|
ModalRoute.of(context)!.removeLocalHistoryEntry(persistentSheetHistoryEntry!);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -486,6 +486,7 @@ abstract class Route<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Whether there is at least one active route underneath this route.
|
/// Whether there is at least one active route underneath this route.
|
||||||
|
@protected
|
||||||
bool get hasActiveRouteBelow {
|
bool get hasActiveRouteBelow {
|
||||||
if (_navigator == null)
|
if (_navigator == null)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user