Skip to content

Commit

Permalink
Merge pull request #21 from felixwortmann/master
Browse files Browse the repository at this point in the history
Add Option to add FloatingActionButton to BackdrawScaffold
  • Loading branch information
daadu authored May 27, 2020
2 parents a0b28ba + 0a44ab4 commit 40b778d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
30 changes: 29 additions & 1 deletion lib/backdrop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,26 @@ class BackdropScaffold extends StatefulWidget {
/// Defaults to `true`.
final bool resizeToAvoidBottomInset;

/// Background [Color] for the back layer.
///
/// Defaults to `Theme.of(context).primaryColor`.
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.
///
Expand Down Expand Up @@ -168,7 +188,11 @@ class BackdropScaffold extends StatefulWidget {
this.stickyFrontLayer = false,
this.animationCurve = Curves.easeInOut,
this.resizeToAvoidBottomInset = true,
this.backLayerBackgroundColor,
this.floatingActionButton,
this.inactiveOverlayColor = const Color(0xFFEEEEEE),
this.floatingActionButtonLocation,
this.floatingActionButtonAnimator
});

@override
Expand Down Expand Up @@ -291,7 +315,8 @@ class _BackdropScaffoldState extends State<BackdropScaffold>
return FocusScope(
canRequestFocus: isBackPanelVisible,
child: Material(
color: Theme.of(context).primaryColor,
color: this.widget.backLayerBackgroundColor ??
Theme.of(context).primaryColor,
child: Column(
children: <Widget>[
Flexible(
Expand Down Expand Up @@ -331,6 +356,8 @@ class _BackdropScaffoldState extends State<BackdropScaffold>
onWillPop: () => _willPopCallback(context),
child: Scaffold(
key: scaffoldKey,
floatingActionButtonLocation: this.widget.floatingActionButtonLocation,
floatingActionButtonAnimator: this.widget.floatingActionButtonAnimator,
appBar: widget.appBar ??
AppBar(
title: widget.title,
Expand All @@ -357,6 +384,7 @@ class _BackdropScaffoldState extends State<BackdropScaffold>
);
},
),
floatingActionButton: this.widget.floatingActionButton,
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
),
);
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ authors:
- Harsh Bhikadia <harsh.bhikadiya@gmail.com>
- Felix Wielander <felix.wielander@gmail.com>
- Daniel Borges <https://github.com/danielborges93>
- Felix Wortmann <https://github.com/felixwortmann>

environment:
sdk: ">=1.19.0 <3.0.0"
Expand Down

0 comments on commit 40b778d

Please sign in to comment.