style1 static method
dynamic
style1({
- required BuildContext context,
- String? label,
- Color? primaryColor,
- required SnackBarType snackBarType,
- TextStyle? labelTextStyle,
- double? iconAvatarRadius,
- Color? iconColor,
- Duration? duration,
- DismissDirection? direction,
- bool? hasLabel,
Implementation
static style1({
required BuildContext context,
String? label,
Color? primaryColor,
required SnackBarType snackBarType,
TextStyle? labelTextStyle,
double? iconAvatarRadius,
Color? iconColor,
Duration? duration,
DismissDirection? direction,
bool? hasLabel,
}) {
switch (snackBarType) {
case SnackBarType.saveFirstAnimation:
return ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: SaveSnackBarFirstWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.green,
labelTextStyle: labelTextStyle,
),
));
case SnackBarType.saveSecondAnimation:
return ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: SaveSnackBarSecondWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.green,
titleTextStyle: labelTextStyle,
),
));
case SnackBarType.failFirstAnimation:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: FailSnackBarFirstWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.red,
titleTextStyle: labelTextStyle,
),
));
break;
case SnackBarType.failSecondAnimation:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: FailSnackBarSecondWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.red,
titleTextStyle: labelTextStyle,
),
));
break;
case SnackBarType.alertFirstAnimation:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: AlertSnackBarFirstWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.black,
titleTextStyle: labelTextStyle,
),
));
break;
case SnackBarType.alertSecondAnimation:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: duration ?? const Duration(seconds: 3),
dismissDirection: direction ?? DismissDirection.down,
behavior: SnackBarBehavior.fixed,
backgroundColor: Colors.transparent,
elevation: 0,
content: AlertSnackBarSecondWidget(
onPressed: () {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
label: label ?? "",
primaryColor: primaryColor ?? Colors.black,
titleTextStyle: labelTextStyle,
),
));
break;
}
}