FLNoticeBar.closable constructor
FLNoticeBar.closable({
- Key? key,
- Color? backgroundColor,
- TextStyle? textStyle,
- bool? loop,
- double? velocity,
- EdgeInsetsGeometry? padding,
- EdgeInsetsGeometry? textPadding,
- required String text,
- double? space,
- double? height,
- FLNoticeBarItemBuilder? prefixBuilder,
- Duration? delay,
- required VoidCallback onPressed,
Implementation
factory FLNoticeBar.closable(
{Key? key,
Color? backgroundColor,
TextStyle? textStyle,
bool? loop,
double? velocity,
EdgeInsetsGeometry? padding,
EdgeInsetsGeometry? textPadding,
required String text,
double? space,
double? height,
FLNoticeBarItemBuilder? prefixBuilder,
Duration? delay,
required VoidCallback onPressed}) {
velocity ??= 0.4;
loop ??= true;
height ??= FLMarqueeDefaultHeight;
padding ??= EdgeInsets.symmetric(horizontal: 10);
Widget suffixBuilder(BuildContext context) {
final bool isDarkMode = Theme.of(context).brightness == Brightness.dark;
final Color accent = Theme.of(context).colorScheme.secondary;
final Color textColor = isDarkMode ? accent : FLNoticeBarTintColor;
final TextStyle marqueeStyle = textStyle ?? TextStyle(color: textColor);
final double size = marqueeStyle.fontSize ?? height! / 2.0;
return GestureDetector(
onTap: onPressed,
child: Icon(
Icons.close,
size: size,
color: textColor,
),
);
};
return FLNoticeBar(
key: key,
backgroundColor: backgroundColor,
textStyle: textStyle,
loop: loop,
velocity: velocity,
padding: padding,
textPadding: textPadding,
text: text,
space: space,
height: height,
delay: delay,
prefixBuilder: prefixBuilder,
suffixBuilder: suffixBuilder,
);
}