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 titleTopSpacing customization field #121

Open
wants to merge 3 commits into
base: main
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 @@ -54,6 +54,7 @@ routeBlur | Default is 0.0. If different than 0.0, creates a blurred overlay tha
routeColor | Default is [Colors.transparent]. Only takes effect if [routeBlur] > 0.0. Make sure you use a color with transparency e.g. `Colors.grey[600].withOpacity(0.2)`. It does not take effect if [blockBackgroundInteraction] is false
userInputForm | A [TextFormField] in case you want a simple user input. Every other widget is ignored if this is not null.
onStatusChanged | a callback for you to listen to the different Flushbar status
titleTopSpacing | The spacing between [title] or [titleText] and [message] or [messageText] This spacing is applied if [title] or [titleText] provided

#### Quick tip

Expand Down
8 changes: 7 additions & 1 deletion lib/flushbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Flushbar<T> extends StatefulWidget {
this.routeColor,
this.userInputForm,
this.endOffset,
this.titleTopSpacing = 6.0,
this.flushbarRoute // Please dont init this
})
// ignore: prefer_initializing_formals
Expand Down Expand Up @@ -226,6 +227,10 @@ class Flushbar<T> extends StatefulWidget {
/// For custom safeArea you can use margin instead
final bool safeArea;

/// The spacing between [title] or [titleText] and [message] or [messageText]
/// This spacing is applied if [title] or [titleText] provided
final double titleTopSpacing;

route.FlushbarRoute<T?>? flushbarRoute;

/// Show the flushbar. Kicks in [FlushbarStatus.IS_APPEARING] state followed by [FlushbarStatus.SHOWING]
Expand Down Expand Up @@ -327,7 +332,8 @@ class _FlushbarState<K extends Object?> extends State<Flushbar<K>>
'A message is mandatory if you are not using userInputForm. Set either a message or messageText');

_isTitlePresent = (widget.title != null || widget.titleText != null);
_messageTopMargin = _isTitlePresent ? 6.0 : widget.padding.top;
_messageTopMargin =
_isTitlePresent ? widget.titleTopSpacing : widget.padding.top;

_configureLeftBarFuture();
_configureProgressIndicatorAnimation();
Expand Down