showCustomDialog static method
void
showCustomDialog(})
Implementation
static void showCustomDialog(BuildContext context,
{String? title,
String? content,
String? left,
String? right,
bool showLeft = true,
bool debounce = true,
bool barrierDismissible = true,
bool highLeft = true,
callback}) {
FocusScope.of(context).unfocus();
NavigatorUtils.showBaseDialog(
context: context,
dismiss: barrierDismissible,
name: 'showCustomDialog',
builder: (BuildContext showContext) {
return Center(
child: Container(
width: ScreenUtil().screenWidth - ScreenUtil().setWidth(80),
decoration: BoxDecoration(
color: RechargeConstantColors.bg_pop_color,
borderRadius: BorderRadius.circular(20),
),
child: Stack(
children: [
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(30),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(title ?? S.of(context).strAppTip,
style: RechargeConstantText.text20WhiteBold,
textAlign: TextAlign.center),
SizedBox(height: ScreenUtil().setWidth(20)),
Text(content ?? '',
style: RechargeConstantText.text16White,
textAlign: TextAlign.center),
SizedBox(height: ScreenUtil().setWidth(30)),
showLeft
? Row(
children: <Widget>[
Expanded(
child: ButtonWidget(
left ?? S.of(context).strAppLater,
highLeft
? RechargeConstantText
.text14WhiteBold
: RechargeConstantText
.text14White60Bold,
color: highLeft
? RechargeConstantColors.app_color
: RechargeConstantColors
.color_btn_un,
shape: StadiumBorder(),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(12),
bottom: ScreenUtil().setWidth(12)),
onPressed: debounce
? NavigatorUtils.debounce(() {
Navigator.pop(context, true);
callback?.call(0);
})
: () => callback?.call(0)),
),
SizedBox(width: ScreenUtil().setWidth(20)),
Expanded(
child: ButtonWidget(
right ?? S.of(context).strAppSure,
highLeft
? RechargeConstantText
.text14White60Bold
: RechargeConstantText
.text14WhiteBold,
color: highLeft
? RechargeConstantColors
.color_btn_un
: RechargeConstantColors.app_color,
shape: StadiumBorder(),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(12),
bottom: ScreenUtil().setWidth(12)),
onPressed: debounce
? NavigatorUtils.debounce(() {
Navigator.pop(context, true);
callback?.call(1);
})
: () => callback?.call(1)),
),
],
)
: ButtonWidget(
right ?? S.of(context).strAppSure,
RechargeConstantText.text14WhiteBold,
color: RechargeConstantColors.app_color,
shape: StadiumBorder(),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(12),
bottom: ScreenUtil().setWidth(12)),
mainAxisSize: MainAxisSize.max,
onPressed: debounce
? NavigatorUtils.debounce(() {
Navigator.pop(context, true);
callback?.call(1);
})
: () => callback?.call(1),
),
],
),
),
Positioned(
top: ScreenUtil().setWidth(12),
right: ScreenUtil().setWidth(3),
child: IconButton(
padding: EdgeInsets.all(0),
icon: CommonUtils.getLoadWidget(
RechargeConstantIcons.app_pop_close,
'',
RechargeConstantIcons.imagesUrl,
RechargeConstantIcons.card_card,
RechargeConstantColors.text_tip_color,
RechargeConstantColors.app_color,
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
package: 'mmoo_base_recharge'),
onPressed: NavigatorUtils.debounce(() {
Navigator.pop(context, true);
callback?.call(-1);
}),
),
),
],
),
),
);
}).then((value) {
if (value == null) {
callback?.call(2);
}
});
}