2022-12-20 06:26:37 +00:00
|
|
|
import 'package:awesome_dialog/awesome_dialog.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:unit2/theme-data.dart/colors.dart';
|
2022-12-20 06:26:37 +00:00
|
|
|
import 'package:unit2/utils/global.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
|
|
|
|
confirmAlert(context, Function() yes) {
|
2022-12-20 06:26:37 +00:00
|
|
|
AwesomeDialog(
|
|
|
|
context: context,
|
|
|
|
dialogType: DialogType.question,
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
color: Colors.green,
|
|
|
|
width: 0,
|
|
|
|
),
|
|
|
|
width: blockSizeHorizontal * 90,
|
|
|
|
buttonsBorderRadius: const BorderRadius.all(
|
|
|
|
Radius.circular(2),
|
|
|
|
),
|
|
|
|
dismissOnTouchOutside: false,
|
|
|
|
dismissOnBackKeyPress: false,
|
|
|
|
// onDismissCallback: (type) {
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
// SnackBar(
|
|
|
|
// content: Text('Dismissed by $type'),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
headerAnimationLoop: false,
|
|
|
|
animType: AnimType.bottomSlide,
|
|
|
|
title: 'LOGOUT!',
|
|
|
|
desc: 'Are you sure you want to logout?',
|
|
|
|
btnOkText: "Yes",
|
|
|
|
btnCancelText: "No",
|
|
|
|
showCloseIcon: false,
|
|
|
|
btnCancelOnPress: () {},
|
|
|
|
btnOkOnPress: yes,
|
|
|
|
).show();
|
2022-12-13 06:56:09 +00:00
|
|
|
}
|
|
|
|
|
2022-12-20 06:26:37 +00:00
|
|
|
errorAlert(context, title, description) {
|
|
|
|
AwesomeDialog(
|
|
|
|
width: blockSizeHorizontal * 90,
|
2022-12-13 06:56:09 +00:00
|
|
|
context: context,
|
2022-12-20 06:26:37 +00:00
|
|
|
dialogType: DialogType.error,
|
|
|
|
animType: AnimType.scale,
|
|
|
|
headerAnimationLoop: false,
|
|
|
|
title: title,
|
|
|
|
desc: description,
|
|
|
|
btnOkOnPress: () {},
|
|
|
|
btnOkColor: Colors.red,
|
|
|
|
).show();
|
2022-12-13 06:56:09 +00:00
|
|
|
}
|