showDialogBox method
dynamic
showDialogBox(
- BuildContext context,
- IconData icon,
- String caution,
- String mssg, {
- dynamic backOrOkey()?,
- String? textback,
Implementation
showDialogBox(
BuildContext context, IconData icon, String caution, String mssg,
{Function()? backOrOkey, String? textback}) {
showGeneralDialog(
barrierLabel: "Barrier",
barrierDismissible: backOrOkey != null ? false : true,
barrierColor: Colors.black.withOpacity(0.5),
transitionDuration: Duration(milliseconds: 200),
context: context,
pageBuilder: (_, __, ___) {
return Align(
alignment: Alignment.center,
child: Container(
height: backOrOkey != null ? 270 : 225,
width: 250,
child: SizedBox.expand(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
// Icon(
// icon,
// color: Colors.red,
// size: 60,
// ),
// Container(
// width: 60,
// height: 60,
// decoration: BoxDecoration(
// color: Colors.red,
// borderRadius: BorderRadius.circular(50)),
// child: Icon(
// Icons.close,
// color: Colors.white,
// size: 40,
// ),
// ),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
icon == Icons.check
? Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Config.colorPrimary,
borderRadius: BorderRadius.circular(50)),
child: Icon(
icon,
color: Colors.white,
size: 40,
),
)
: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(50)),
child: Icon(
Icons.close,
color: Colors.white,
size: 40,
),
),
DefaultText(
margin: EdgeInsets.only(top: 10),
textLabel: caution,
fontWeight: FontWeight.bold,
sizeText: 16,
),
DefaultText(
textAlign: TextAlign.center,
margin: EdgeInsets.only(top: 10, left: 20, right: 20),
textLabel: mssg,
),
],
),
),
backOrOkey != null
? GestureDetector(
onTap: backOrOkey,
child: DefaultText(
height: 40,
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(8),
colorsText: Colors.white,
margin: EdgeInsets.all(8),
alignment: Alignment.bottomCenter,
borderRadius: BorderRadius.circular(8),
textLabel: textback != null
? textback
: "Okey",
isGradient: true,
),
)
: Container()
],
)),
margin: EdgeInsets.only(bottom: 40, left: 40, right: 40),
padding: EdgeInsets.only(top: 25),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
),
);
},
transitionBuilder: (_, anim, __, child) {
return FadeTransition(
opacity: anim,
child: child,
);
},
).then((value) {
SellonRouter.pop(context);
});
}