confirmationRejectDialog method
dynamic
confirmationRejectDialog(})
Implementation
confirmationRejectDialog(
BuildContext context,
String title,
String cancel,
String proceed, {
bool isDismissible = true,
bool isReason = false,
required Function() onProceed,
required Function() onCancel,
}) {
showDialog(
barrierDismissible: isDismissible,
context: context,
builder: (_) {
return StatefulBuilder(builder: (context, setState) {
return PopScope(
canPop: isDismissible,
child: Dialog(
insetPadding: EdgeInsets.symmetric(
horizontal: SizeConstant.getHeightWithScreen(10),
vertical: SizeConstant.getHeightWithScreen(24)),
child: Container(
decoration: BoxDecoration(
color: ColorConstant.white,
borderRadius: BorderRadius.circular(
SizeConstant.getHeightWithScreen(16)),
),
padding: EdgeInsets.symmetric(
vertical: SizeConstant.getHeightWithScreen(30),
horizontal: SizeConstant.getHeightWithScreen(20)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SvgPicture.asset(
"assets/images/error_icon.svg",
package: Constants.packageName,
height: SizeConstant.getHeightWithScreen(50),
width: SizeConstant.getHeightWithScreen(50),
),
SizedBox(
height: SizeConstant.getHeightWithScreen(10),
),
Text(
localization.translate(title),
style: TextStyle(
color: ColorConstant.pgvDescTextColor,
fontSize: SizeConstant.mediumFont,
fontWeight: FontWeight.w600),
),
SizedBox(
height: SizeConstant.getHeightWithScreen(40),
),
GestureDetector(
onTap: () {
showModalBottomSheet(
enableDrag: false,
context: context,
isScrollControlled: true,
isDismissible: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
builder: (BuildContext context) {
return PopScope(
canPop: false,
child: RejectReasonDropdown(
selectedValue:
controller.selectedRejectReason.value,
hintText: localization.translate("reason"),
items: controller.dropDownReasonList,
onTap: (p0) {
controller.selectedRejectReason.value = p0;
setState(() {});
},
),
);
},
);
},
child: Container(
decoration: BoxDecoration(
color: ColorConstant.dividerColor,
borderRadius: BorderRadius.circular(
SizeConstant.getHeightWithScreen(10),
),
),
padding: EdgeInsets.all(
SizeConstant.getHeightWithScreen(16),
),
child: Obx(
() {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
controller.selectedRejectReason.value
.dropDownValue !=
null &&
controller.selectedRejectReason.value
.dropDownValue!.isNotEmpty
? controller.selectedRejectReason.value
.dropDownValue ??
""
: localization.translate("reason"),
style: TextStyle(
fontSize: SizeConstant.smallFont,
color: ColorConstant.black3,
fontWeight: FontWeight.w600,
),
),
Icon(
Icons.keyboard_arrow_down_rounded,
size: SizeConstant.getHeightWithScreen(16),
)
],
);
},
),
),
),
Obx(() {
return controller
.selectedRejectReason.value.dropDownValue ==
"OTHER"
? SizedBox(
height: SizeConstant.getHeightWithScreen(22),
)
: const SizedBox();
}),
Obx(() {
return controller
.selectedRejectReason.value.dropDownValue ==
"OTHER"
? Container(
decoration: BoxDecoration(
color: ColorConstant.dividerColor,
borderRadius: BorderRadius.circular(
SizeConstant.getHeightWithScreen(10),
),
),
padding: EdgeInsets.all(
SizeConstant.getHeightWithScreen(16),
),
child: TextFormField(
controller:
controller.otherRejectReason.value,
keyboardType: TextInputType.multiline,
minLines: 3,
maxLines: null,
onChanged: (value) {},
style: TextStyle(
color: ColorConstant.black,
fontSize: SizeConstant.smallFont,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
hintText: localization.translate("reasonDescription"),
contentPadding: const EdgeInsets.all(0.0),
border: InputBorder.none,
),
),
)
: const SizedBox();
}),
SizedBox(
height: SizeConstant.getHeightWithScreen(40),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: SizeConstant.getHeightWithScreen(10)),
child: Row(
children: [
InkWell(
onTap: () {
onCancel();
},
child: Container(
width:
(MediaQuery.of(context).size.width / 2) -
SizeConstant.getHeightWithScreen(45),
height: SizeConstant.getHeightWithScreen(40),
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: ColorConstant.primaryColor,
),
borderRadius: BorderRadius.circular(
SizeConstant.getHeightWithScreen(10)),
),
child: Center(
child: Text(
localization.translate(cancel),
style: TextStyle(
fontSize: SizeConstant.mediumFont,
fontWeight: FontWeight.w500,
color: ColorConstant.primaryColor,
),
),
)),
),
SizedBox(
width: SizeConstant.getHeightWithScreen(10),
),
VentasPrimaryButton(
onTap: () {
controller.selectedRejectReason.value
.dropDownId !=
null
? onProceed()
: null;
},
label: localization.translate(proceed),
textColor: ColorConstant.white,
borderRadius: 10,
textSize: SizeConstant.mediumFont,
weight: FontWeight.w500,
btnHeight: SizeConstant.getHeightWithScreen(40),
btnWidth:
(MediaQuery.of(context).size.width / 2) -
SizeConstant.getHeightWithScreen(45),
),
],
),
)
],
),
),
));
});
},
);
}