Untitled
faisalsalameh
dart
3 years ago
7.0 kB
11
Indexable
void infoDialog(String message) {
RM.scaffold.showSnackBar(
SnackBar(
elevation: 4,
shape: RoundedRectangleBorder(
side: const BorderSide(color: AppColors.turquoise, width: 1),
borderRadius: BorderRadius.circular(20),
),
behavior: SnackBarBehavior.floating,
margin: const EdgeInsets.all(8),
duration: const Duration(seconds: 2),
backgroundColor: AppColors.turquoise.withOpacity(0.6),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.info_outline,
color: AppColors.turquoise,
),
Headline6(
textProps: TextProps(
title: 'info: $message',
style:
TextThemeStyle().headline6.copyWith(color: AppColors.white),
),
),
IconButton(
onPressed: () {
navigator.back();
},
icon: Icon(
Icons.info_outline,
color: AppColors.turquoise.withAlpha(0),
),
)
],
),
),
);
}
void successDialog(String message) {
RM.scaffold.showSnackBar(
SnackBar(
elevation: 4,
shape: RoundedRectangleBorder(
side: const BorderSide(color: AppColors.success, width: 1),
borderRadius: BorderRadius.circular(20),
),
behavior: SnackBarBehavior.floating,
margin: const EdgeInsets.all(8),
duration: const Duration(seconds: 2),
backgroundColor: AppColors.success.withOpacity(0.6),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.done,
color: AppColors.success,
),
Headline6(
textProps: TextProps(
title: 'Success: $message',
style:
TextThemeStyle().headline6.copyWith(color: AppColors.white),
),
),
IconButton(
onPressed: () {
navigator.back();
},
icon: Icon(
Icons.close,
color: AppColors.success.withAlpha(0),
),
)
],
),
),
);
}
void errorDialog(String message) {
RM.scaffold.showSnackBar(
SnackBar(
elevation: 4,
shape: RoundedRectangleBorder(
side: const BorderSide(color: AppColors.red, width: 1),
borderRadius: BorderRadius.circular(20),
),
behavior: SnackBarBehavior.floating,
margin: const EdgeInsets.all(8),
duration: const Duration(seconds: 2),
backgroundColor: AppColors.red.withOpacity(0.6),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.error_outline,
color: AppColors.red,
),
Headline6(
textProps: TextProps(
title: 'error: $message',
style:
TextThemeStyle().headline6.copyWith(color: AppColors.white),
),
),
IconButton(
onPressed: () {
navigator.back();
},
icon: Icon(
Icons.close,
color: AppColors.red.withAlpha(0),
),
)
],
),
),
);
}
void warningDialog(String message) {
RM.scaffold.showSnackBar(
SnackBar(
elevation: 4,
shape: RoundedRectangleBorder(
side: const BorderSide(color: AppColors.yellow, width: 1),
borderRadius: BorderRadius.circular(20),
),
behavior: SnackBarBehavior.floating,
margin: const EdgeInsets.all(8),
duration: const Duration(seconds: 2),
backgroundColor: AppColors.yellow.withOpacity(0.6),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.warning_amber,
color: AppColors.yellow,
),
Headline6(
textProps: TextProps(
title: 'Warning: $message',
style:
TextThemeStyle().headline6.copyWith(color: AppColors.white),
),
),
IconButton(
onPressed: () {
navigator.back();
},
icon: Icon(
Icons.close,
color: AppColors.red.withAlpha(0),
),
)
],
),
),
);
}
void showAlertDialogTwoFun(
BuildContext context, {
VoidCallback? yes,
VoidCallback? no,
String? title,
String? content,
}) {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
title: Center(
child: Headline5(
textProps: TextProps(title: title ?? 'Alert'),
),
),
content: Headline6(
textProps:
TextProps(title: title ?? 'Proceed with destructive action?'),
),
actions: <CupertinoDialogAction>[
CupertinoDialogAction(
isDestructiveAction: true,
onPressed: no ??
() {
navigator.back();
},
child: const Text('no'),
),
CupertinoDialogAction(
isDefaultAction: true,
onPressed: yes ??
() {
navigator.back();
},
child: const Text('Yes'),
),
],
),
);
}
void showAlertDialogOneFun(
BuildContext context, {
VoidCallback? onTap,
String? title,
String? content,
}) {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
title: Center(
child: Headline5(
textProps: TextProps(title: title ?? 'Alert'),
),
),
content: Headline6(
textProps:
TextProps(title: title ?? 'Proceed with destructive action?'),
),
actions: <CupertinoDialogAction>[
CupertinoDialogAction(
isDefaultAction: true,
onPressed: onTap ??
() {
navigator.back();
},
child: const Text('Yes'),
),
],
),
);
}Editor is loading...