passo_mobile_app/lib/utils/alerts.dart

65 lines
1.7 KiB
Dart

import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/material.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/global.dart';
confirmAlert(context, Function() yes,String title, String subtitle) {
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: title,
desc: subtitle,
btnOkText: "Yes",
btnCancelText: "No",
showCloseIcon: false,
btnCancelOnPress: () {},
btnOkOnPress: yes,
).show();
}
errorAlert(context, title, description,Function() func) {
AwesomeDialog(
width: blockSizeHorizontal * 90,
context: context,
dialogType: DialogType.error,
animType: AnimType.scale,
headerAnimationLoop: false,
title: title,
desc: description,
btnOkOnPress: func,
btnOkColor: Colors.red,
).show();
}
successAlert(context, title, description,Function() func) {
AwesomeDialog(
width: blockSizeHorizontal * 90,
context: context,
dialogType: DialogType.success,
animType: AnimType.scale,
headerAnimationLoop: false,
title: title,
desc: description,
btnOkOnPress: func,
btnOkColor: Colors.red,
).show();
}