kYesNoSheet function
dynamic
kYesNoSheet({
- required dynamic context,
- required Function yes,
- required Function no,
- required String heading,
- dynamic centerTextColor,
- dynamic btnTextYes,
- dynamic btnTextYesColor,
- dynamic btnTextNo,
- dynamic btnTextNoColor,
- dynamic btnColorYes,
- dynamic btnColorNo,
- bool showNoBtn = false,
- Function? onBackPress,
- bool simpleBackPress = true,
constant popup
Implementation
kYesNoSheet(
{required context,
required Function yes,
required Function no,
required String heading,
centerTextColor,
btnTextYes,
btnTextYesColor,
btnTextNo,
btnTextNoColor,
btnColorYes,
btnColorNo,
bool showNoBtn = false,
Function? onBackPress,
bool simpleBackPress = true}) {
showModalBottomSheet(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(25.0))),
backgroundColor: whiteColor,
context: context,
isScrollControlled: true,
builder: (ctx) => WillPopScope(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(height: 8.0),
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(ctx).viewInsets.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 30.0),
CustomText(
text: heading,
fontSize: size18,
color: centerTextColor ?? greyColor1),
SizedBox(height: kBodyPadding / 2),
SizedBox(height: 15.0),
Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (showNoBtn)
CustomButton(
textDecoration: TextDecoration.none,
onTap: () {
kHideKeyboard(context);
goBack(context: ctx);
return no();
},
text: btnTextNo ?? Strings.no,
buttonColor: btnColorNo ?? greyColor1,
textColor:
btnTextNoColor ?? whiteColor,
width: 94.0,
height: 44.0),
if (showNoBtn) SizedBox(width: 10.0),
CustomButton(
textDecoration: TextDecoration.none,
onTap: () {
kHideKeyboard(context);
return yes();
},
text: btnTextYes ?? Strings.ok,
buttonColor: btnColorYes ?? yellowColor,
textColor:
btnTextYesColor ?? whiteColor,
width: 94.0,
height: 44.0),
]),
SizedBox(height: 10.0)
])),
SizedBox(height: 10)
])),
onWillPop: simpleBackPress
? () => Future.value(true)
: () {
kHideKeyboard(context);
onBackPress!();
return Future.value(true);
}));
}