Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added scaffoldKey #64

Merged
merged 3 commits into from
Oct 4, 2020
Merged
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
9 changes: 8 additions & 1 deletion lib/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class BackdropScaffold extends StatefulWidget {
final VoidCallback onBackLayerRevealed;

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

/// A key to use when building the [Scaffold].
final GlobalKey<ScaffoldState> scaffoldKey;

/// See [Scaffold.appBar].
final PreferredSizeWidget appBar;
Expand Down Expand Up @@ -267,6 +270,7 @@ class BackdropScaffold extends StatefulWidget {
this.inactiveOverlayOpacity = 0.7,
this.onBackLayerConcealed,
this.onBackLayerRevealed,
this.scaffoldKey,
this.appBar,
this.floatingActionButton,
this.floatingActionButtonLocation,
Expand Down Expand Up @@ -308,7 +312,7 @@ class BackdropScaffoldState extends State<BackdropScaffold>

/// Key for accessing the [ScaffoldState] of [BackdropScaffold]'s internally
/// used [Scaffold].
final scaffoldKey = GlobalKey<ScaffoldState>();
GlobalKey<ScaffoldState> scaffoldKey;
double _backPanelHeight = 0;
double _subHeaderHeight = 0;

Expand All @@ -324,6 +328,9 @@ class BackdropScaffoldState extends State<BackdropScaffold>
@override
void initState() {
super.initState();
// initialize scaffoldKey
scaffoldKey = widget.scaffoldKey ?? GlobalKey<ScaffoldState>();
// initialize _controller
_controller = widget.controller ??
AnimationController(
vsync: this, duration: Duration(milliseconds: 200), value: 1.0);
Expand Down