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

Add Option to add FloatingActionButton to BackdrawScaffold #21

Merged
merged 5 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
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 BackPanel
daadu marked this conversation as resolved.
Show resolved Hide resolved
///
/// 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