From 9024d241809f9d78a67cc5f72ff894d52fcce6c9 Mon Sep 17 00:00:00 2001 From: Felix Wortmann Date: Fri, 22 May 2020 15:15:17 +0200 Subject: [PATCH 1/3] - add FloatingActionButton to BackdrawScaffold - add more coloring options --- CHANGELOG.md | 4 ++++ lib/backdrop.dart | 24 +++++++++++++++++++++++- pubspec.yaml | 3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3d5dd..18bc929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.2.17] - 22 May 2020 +* add FloatingActionButton to BackdrawScaffold +* Add more coloring options + ## [0.2.15] - 15 May 2020 * bug fix: unfocusing keyboard before fling. diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 193b4f6..98dff49 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -127,6 +127,22 @@ class BackdropScaffold extends StatefulWidget { /// Defaults to `true`. final bool resizeToAvoidBottomInset; + /// Background [Color] for the BackPanel + /// + /// Defaults to `Theme.of(context).primaryColor`. + final Color backPanelBackgroundColor; + + /// Background [Color] for the [AppBar] of the [Scaffold] + /// + /// Defaults to `null`, which leads the [Scaffold] to use `Theme.of(context).primaryColor`. + final Color appBarBackgroundColor; + + /// [FloatingActionButton] for the [Scaffold] + /// + /// Defaults to `null` which leads the [Scaffold] without a [FloatingActionButton] + + final Widget floatingActionButton; + /// Creates a backdrop scaffold to be used as a material widget. BackdropScaffold({ this.controller, @@ -143,6 +159,9 @@ class BackdropScaffold extends StatefulWidget { this.stickyFrontLayer = false, this.animationCurve = Curves.linear, this.resizeToAvoidBottomInset = true, + this.backPanelBackgroundColor, + this.appBarBackgroundColor, + this.floatingActionButton, }); @override @@ -258,7 +277,8 @@ class _BackdropScaffoldState extends State return FocusScope( canRequestFocus: isBackPanelVisible, child: Material( - color: Theme.of(context).primaryColor, + color: this.widget.backPanelBackgroundColor ?? + Theme.of(context).primaryColor, child: Column( children: [ Flexible( @@ -297,6 +317,7 @@ class _BackdropScaffoldState extends State key: scaffoldKey, appBar: AppBar( title: widget.title, + backgroundColor: this.widget.appBarBackgroundColor, actions: widget.iconPosition == BackdropIconPosition.action ? [BackdropToggleButton()] + widget.actions : widget.actions, @@ -320,6 +341,7 @@ class _BackdropScaffoldState extends State ); }, ), + floatingActionButton: this.widget.floatingActionButton, resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset, ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 6727326..7f14bea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: backdrop description: Backdrop implementaion in dart. (https://material.io/design/components/backdrop.html) -version: 0.2.16 +version: 0.2.17 homepage: https://github.com/fluttercommunity/backdrop documentation: https://github.com/fluttercommunity/backdrop maintainer: Harsh Bhikadia (@daadu) @@ -8,6 +8,7 @@ authors: - Flutter Community - Harsh Bhikadia - Felix Wielander + - Felix Wortmann environment: sdk: ">=1.19.0 <3.0.0" From e7372805ec996315c3f0085ef7dd349bc89537ed Mon Sep 17 00:00:00 2001 From: Felix Wortmann Date: Wed, 27 May 2020 14:20:11 +0200 Subject: [PATCH 2/3] added FloatingActionButtonLocation added FloatingActionButtonAnimator removed appBarBackgroundColor renamed backPandelBackgroundColor to backLayerBackgroundColor --- lib/backdrop.dart | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index e0f9be7..e8e1997 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -141,19 +141,23 @@ class BackdropScaffold extends StatefulWidget { /// Background [Color] for the BackPanel /// /// Defaults to `Theme.of(context).primaryColor`. - final Color backPanelBackgroundColor; - - /// Background [Color] for the [AppBar] of the [Scaffold] - /// - /// Defaults to `null`, which leads the [Scaffold] to use `Theme.of(context).primaryColor`. - final Color appBarBackgroundColor; + final Color backLayerBackgroundColor; /// [FloatingActionButton] for the [Scaffold] /// /// Defaults to `null` which leads the [Scaffold] without a [FloatingActionButton] - final Widget floatingActionButton; + /// [FloatingActionButtonLocation] for the [FloatingActionButton] in the [Scaffold] + /// + /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonLocation] + final FloatingActionButtonLocation floatingActionButtonLocation; + + /// [FloatingActionButtonAnimator] for the [FloatingActionButton] in the [Scaffold] + /// + /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonAnimator] + final FloatingActionButtonAnimator floatingActionButtonAnimator; + /// Defines the color for the inactive front layer. /// Implicitly an opacity of 0.7 is applied to the passed color. /// @@ -184,10 +188,11 @@ class BackdropScaffold extends StatefulWidget { this.stickyFrontLayer = false, this.animationCurve = Curves.easeInOut, this.resizeToAvoidBottomInset = true, - this.backPanelBackgroundColor, - this.appBarBackgroundColor, + this.backLayerBackgroundColor, this.floatingActionButton, this.inactiveOverlayColor = const Color(0xFFEEEEEE), + this.floatingActionButtonLocation, + this.floatingActionButtonAnimator }); @override @@ -310,7 +315,7 @@ class _BackdropScaffoldState extends State return FocusScope( canRequestFocus: isBackPanelVisible, child: Material( - color: this.widget.backPanelBackgroundColor ?? + color: this.widget.backLayerBackgroundColor ?? Theme.of(context).primaryColor, child: Column( children: [ @@ -351,6 +356,8 @@ class _BackdropScaffoldState extends State onWillPop: () => _willPopCallback(context), child: Scaffold( key: scaffoldKey, + floatingActionButtonLocation: this.widget.floatingActionButtonLocation, + floatingActionButtonAnimator: this.widget.floatingActionButtonAnimator, appBar: widget.appBar ?? AppBar( title: widget.title, From 0a44ab4f07f1606a493ef742bee9b6aa3fdf9430 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Wed, 27 May 2020 17:59:25 +0530 Subject: [PATCH 3/3] minor --- lib/backdrop.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index e8e1997..9dc9a89 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -138,7 +138,7 @@ class BackdropScaffold extends StatefulWidget { /// Defaults to `true`. final bool resizeToAvoidBottomInset; - /// Background [Color] for the BackPanel + /// Background [Color] for the back layer. /// /// Defaults to `Theme.of(context).primaryColor`. final Color backLayerBackgroundColor;