diff --git a/README.md b/README.md index 51cac53..e86e1da 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/flushbar.dart b/lib/flushbar.dart index 578c8df..69c5c7e 100644 --- a/lib/flushbar.dart +++ b/lib/flushbar.dart @@ -41,6 +41,7 @@ class Flushbar extends StatefulWidget { Color progressIndicatorBackgroundColor, Animation progressIndicatorValueColor, FlushbarPosition flushbarPosition = FlushbarPosition.BOTTOM, + double positionOffset = 0.0, FlushbarStyle flushbarStyle = FlushbarStyle.FLOATING, Curve forwardAnimationCurve = Curves.easeOutCirc, Curve reverseAnimationCurve = Curves.easeOutCirc, @@ -76,6 +77,7 @@ class Flushbar extends StatefulWidget { this.progressIndicatorBackgroundColor = progressIndicatorBackgroundColor, this.progressIndicatorValueColor = progressIndicatorValueColor, this.flushbarPosition = flushbarPosition, + this.positionOffset = positionOffset, this.flushbarStyle = flushbarStyle, this.forwardAnimationCurve = forwardAnimationCurve, this.reverseAnimationCurve = reverseAnimationCurve, @@ -176,6 +178,9 @@ class Flushbar 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; @@ -369,8 +374,8 @@ class _FlushbarState extends State 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,