diff --git a/lib/scaffold.dart b/lib/scaffold.dart index 1b2f6df..557c2df 100644 --- a/lib/scaffold.dart +++ b/lib/scaffold.dart @@ -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 scaffoldKey; /// See [Scaffold.appBar]. final PreferredSizeWidget appBar; @@ -267,6 +270,7 @@ class BackdropScaffold extends StatefulWidget { this.inactiveOverlayOpacity = 0.7, this.onBackLayerConcealed, this.onBackLayerRevealed, + this.scaffoldKey, this.appBar, this.floatingActionButton, this.floatingActionButtonLocation, @@ -308,7 +312,7 @@ class BackdropScaffoldState extends State /// Key for accessing the [ScaffoldState] of [BackdropScaffold]'s internally /// used [Scaffold]. - final scaffoldKey = GlobalKey(); + GlobalKey scaffoldKey; double _backPanelHeight = 0; double _subHeaderHeight = 0; @@ -324,6 +328,9 @@ class BackdropScaffoldState extends State @override void initState() { super.initState(); + // initialize scaffoldKey + scaffoldKey = widget.scaffoldKey ?? GlobalKey(); + // initialize _controller _controller = widget.controller ?? AnimationController( vsync: this, duration: Duration(milliseconds: 200), value: 1.0);