Skip to content
Open
Changes from all commits
Commits
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
21 changes: 9 additions & 12 deletions lib/src/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ class BackdropScaffold extends StatefulWidget {
/// Specifiy whether to conceal [backLayer] when back button pressed.
///
/// Default to `true`.
final bool concealBacklayerOnBackButton;

// ------------- PROPERTIES TAKEN OVER FROM SCAFFOLD ------------- //

Expand Down Expand Up @@ -336,7 +335,6 @@ class BackdropScaffold extends StatefulWidget {
this.onBackLayerConcealed,
this.onBackLayerRevealed,
this.maintainBackLayerState = true,
this.concealBacklayerOnBackButton = true,
this.scaffoldKey,
this.appBar,
this.floatingActionButton,
Expand Down Expand Up @@ -612,17 +610,16 @@ class BackdropScaffoldState extends State<BackdropScaffold>
);

Widget _wrapWillPopScope(BuildContext context, {required Widget child}) {
if (!widget.concealBacklayerOnBackButton) return child;
return WillPopScope(
onWillPop: () async {
if (isBackLayerRevealed) {
concealBackLayer();
if (!isBackLayerRevealed) {
return WillPopScope(
onWillPop: () async {
revealBackLayer();
return false;
}
return true;
},
child: child,
);
},
child: child,
);
}
return child;
}

Widget _buildBody(BuildContext context) => _wrapWillPopScope(
Expand Down