FlashyFlushbar constructor

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

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

const FlashyFlushbar({
  super.key,
  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,
});