dialog static method
dynamic
dialog(})
Implementation
static dialog(BuildContext context,
{String? title,
Widget? icon,
String? desc,
bool twoButton = false,
bool sButton1 = true,
bool sButton2 = true,
String? tButton1,
String? tButton2,
Function? onTap1,
Function? onTap2}) {
showFlash(
context: context,
persistent: true,
transitionDuration: const Duration(milliseconds: 250),
barrierBlur: 5,
barrierColor: Colors.transparent,
builder: (context, controller) {
return Container(
color: Colors.black.withOpacity(0.7),
child: FadeTransition(
opacity: controller.controller,
child: AlertDialog(
backgroundColor: Theme.of(context).cardColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
side: BorderSide(),
),
contentPadding: EdgeInsets.all(Spaces.defaultMtSpace_60)
.copyWith(
top: Spaces.defaultMtSpace_30,
bottom: Spaces.defaultMtSpace_30),
title: Center(
child: Column(
children: [
icon ?? Container(),
Padding(
padding:
EdgeInsets.only(bottom: Spaces.defaultMtSpace_30),
child: Text(
title!,
style: const TextStyle(fontWeight: FontWeight.bold),
).h4,
),
],
)),
content: Text(
desc!,
).h5,
actions: twoButton
? [
TextButton(
onPressed: () {
if (sButton1 == true) {
// await audioPlayer.play(Conf.defaultSoundDesktop, isLocal: true);
// var bytes = await (
// await audioCache.load(Conf.defaultSound)).readAsBytes();
// audioCache.playBytes(bytes);
}
if (onTap1 != null) {
onTap1();
}
controller.dismiss();
},
child: Text(
tButton1 ?? '',
).h6.pColor,
),
TextButton(
onPressed: () async {
if (sButton2 == true) {
// await audioPlayer.play(Conf.defaultSoundDesktop, isLocal: true);
// var bytes = await (await audioCache.load(Conf.defaultSound)).readAsBytes();
// audioCache.playBytes(bytes);
}
if (onTap2 != null) {
onTap2();
}
controller.dismiss();
},
child: Text(
tButton2 ?? '',
).h6.pColor,
),
]
: [
TextButton(
onPressed: () async {
controller.dismiss();
},
child: const Text(
'باشه',
).h6.pColor,
),
]),
),
);
},
);
}