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 positionOffset which allows a vertical offset for the flushbar #100

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ duration | How long until Flushbar will hide itself (be dismissed). To make it i
isDismissible | Determines if the user can swipe or click the overlay (if [overlayBlur] > 0) to dismiss. It is recommended that you set [duration] != null if this is false. If the user swipes to dismiss or clicks the overlay, no value will be returned.
dismissDirection | FlushbarDismissDirection.VERTICAL by default. Can also be [FlushbarDismissDirection.HORIZONTAL] in which case both left and right dismiss are allowed.
flushbarPosition | Flushbar can be based on [FlushbarPosition.TOP] or on [FlushbarPosition.BOTTOM] of your screen. [FlushbarPosition.BOTTOM] is the default.
positionOffset | Adds a vertical offset for the position of the flusbar
flushbarStyle | Flushbar can be floating or be grounded to the edge of the screen. If grounded, I do not recommend using [margin] or [borderRadius]. [FlushbarStyle.FLOATING] is the default
forwardAnimationCurve | The [Curve] animation used when show() is called. [Curves.easeOut] is default.
reverseAnimationCurve | The [Curve] animation used when dismiss() is called. [Curves.fastOutSlowIn] is default.
Expand Down
9 changes: 7 additions & 2 deletions lib/flushbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Flushbar<T extends Object> extends StatefulWidget {
Color progressIndicatorBackgroundColor,
Animation<Color> progressIndicatorValueColor,
FlushbarPosition flushbarPosition = FlushbarPosition.BOTTOM,
double positionOffset = 0.0,
FlushbarStyle flushbarStyle = FlushbarStyle.FLOATING,
Curve forwardAnimationCurve = Curves.easeOutCirc,
Curve reverseAnimationCurve = Curves.easeOutCirc,
Expand Down Expand Up @@ -76,6 +77,7 @@ class Flushbar<T extends Object> extends StatefulWidget {
this.progressIndicatorBackgroundColor = progressIndicatorBackgroundColor,
this.progressIndicatorValueColor = progressIndicatorValueColor,
this.flushbarPosition = flushbarPosition,
this.positionOffset = positionOffset,
this.flushbarStyle = flushbarStyle,
this.forwardAnimationCurve = forwardAnimationCurve,
this.reverseAnimationCurve = reverseAnimationCurve,
Expand Down Expand Up @@ -176,6 +178,9 @@ class Flushbar<T extends Object> extends StatefulWidget {
/// [FlushbarPosition.BOTTOM] is the default.
final FlushbarPosition flushbarPosition;

/// Adds a vertical offset for the position of the flusbar
final double positionOffset;

/// [FlushbarDismissDirection.VERTICAL] by default.
/// Can also be [FlushbarDismissDirection.HORIZONTAL] in which case both left and right dismiss are allowed.
final FlushbarDismissDirection dismissDirection;
Expand Down Expand Up @@ -369,8 +374,8 @@ class _FlushbarState<K extends Object> extends State<Flushbar> with TickerProvid
color: widget.flushbarStyle == FlushbarStyle.FLOATING ? Colors.transparent : widget.backgroundColor,
child: SafeArea(
minimum: widget.flushbarPosition == FlushbarPosition.BOTTOM
? EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom)
: EdgeInsets.only(top: MediaQuery.of(context).viewInsets.top),
? EdgeInsets.only(bottom: (MediaQuery.of(context).padding.bottom + widget.positionOffset))
: EdgeInsets.only(top: (MediaQuery.of(context).padding.top) + widget.positionOffset),
bottom: widget.flushbarPosition == FlushbarPosition.BOTTOM,
top: widget.flushbarPosition == FlushbarPosition.TOP,
left: false,
Expand Down