FlashyFlushbar constructor

FlashyFlushbar({
  1. Duration duration = const Duration(seconds: 1),
  2. String message = '',
  3. TextStyle messageStyle = const TextStyle(color: Colors.black, fontSize: 16),
  4. EdgeInsets margin = const EdgeInsets.only(left: 32, right: 32, top: 20),
  5. Color backgroundColor = Colors.white,
  6. List<BoxShadow>? boxShadows = const [BoxShadow(color: Color(0x1a000000), blurRadius: 10, offset: Offset(0, 4))],
  7. BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(16)),
  8. double height = 64,
  9. Duration animationDuration = const Duration(milliseconds: 500),
  10. Widget leadingWidget = const SizedBox(),
  11. Widget trailingWidget = const SizedBox(),
  12. double messageHorizontalSpacing = 8,
  13. EdgeInsets horizontalPadding = const EdgeInsets.symmetric(horizontal: 16),
  14. DismissDirection dismissDirection = DismissDirection.horizontal,
  15. VoidCallback? onTap,
  16. bool isDismissible = true,
  17. Widget? customWidget,
})

Constructs a FlashyFlushbar widget with customizable properties.

The key parameter is inherited from the StatefulWidget class.

The duration parameter sets the duration for which the flushbar will be displayed. The default duration is one second.

The message parameter is the text message to be displayed by the flushbar.

The messageStyle parameter is the style of the text message, including color and font size. The default style is black text with a font size of 16.

The margin parameter is the margin around the flushbar. The default margin is 32 pixels on the left, right, and 20 pixels on the top.

The backgroundColor parameter sets the background color of the flushbar. The default color is white.

The boxShadows parameter defines the box shadow for the flushbar. The default is a subtle box shadow.

The borderRadius parameter sets the border radius of the flushbar. The default is a circular border with a radius of 16 pixels.

The height parameter sets the height of the flushbar. The default height is 64 pixels.

The animationDuration parameter defines the duration of the animation when showing and hiding the flushbar. The default duration is 500 milliseconds.

The leadingWidget parameter is a widget to be displayed on the left side of the flushbar. The default is an empty SizedBox.

The trailingWidget parameter is a widget to be displayed on the right side of the flushbar. The default is an empty SizedBox.

The messageHorizontalSpacing parameter sets the spacing between the message and the leading/trailing widgets. The default is 8 pixels.

The horizontalPadding parameter defines the horizontal padding of the flushbar. The default is padding of 16 pixels on both sides.

The dismissDirection parameter defines the direction in which the flushbar can be dismissed. The default is horizontal dismissal.

The onTap parameter is a callback function to be executed when the flushbar is tapped. If provided, tapping the flushbar will execute this callback and hide the flushbar.

Implementation

FlashyFlushbar({
  this.duration = const Duration(seconds: 1),
  this.message = '',
  this.messageStyle = const TextStyle(
    color: Colors.black,
    fontSize: 16,
  ),
  this.margin = const EdgeInsets.only(left: 32, right: 32, top: 20),
  this.backgroundColor = Colors.white,
  this.boxShadows = const [
    BoxShadow(
      color: Color(0x1a000000),
      blurRadius: 10,
      offset: Offset(0, 4),
    ),
  ],
  this.borderRadius = const BorderRadius.all(Radius.circular(16)),
  this.height = 64,
  this.animationDuration = const Duration(milliseconds: 500),
  this.leadingWidget = const SizedBox(),
  this.trailingWidget = const SizedBox(),
  this.messageHorizontalSpacing = 8,
  this.horizontalPadding = const EdgeInsets.symmetric(horizontal: 16),
  this.dismissDirection = DismissDirection.horizontal,
  this.onTap,
  this.isDismissible = true,
  this.customWidget,
}) : super(key: UniqueKey());