showSendReportAlert static method
Future<void>
showSendReportAlert(
- BuildContext context,
- String referenceId, {
- ReferenceType referenceType = ReferenceType.post,
Implementation
static Future<void> showSendReportAlert(BuildContext context, String referenceId,
{ReferenceType referenceType = ReferenceType.post}) async {
ReportService reportServiceImpl = Get.find<ReportService>();
Alert(
context: context,
style: AlertStyle(
backgroundColor: AppColor.main50,
titleStyle: const TextStyle(fontWeight: FontWeight.bold),
),
title: AppTranslationConstants.sendReport.tr,
content: Column(
children: <Widget>[
Obx(()=>
DropdownButton<ReportType>(
dropdownColor: AppColor.getMain(),
items: ReportType.values.map((ReportType reportType) {
return DropdownMenuItem<ReportType>(
value: reportType,
child: Text(reportType.name.tr),
);
}).toList(),
onChanged: (ReportType? reportType) {
if(reportType != null) {
reportServiceImpl.setReportType(reportType);
}
},
value: reportServiceImpl.reportType,
alignment: Alignment.center,
icon: const Icon(Icons.arrow_downward),
iconSize: 20,
elevation: 16,
style: const TextStyle(color: Colors.white),
underline: Container(height: 1, color: Colors.grey,),
),
),
TextField(
onChanged: (text) {
reportServiceImpl.setMessage(text);
},
decoration: InputDecoration(
labelText: AppTranslationConstants.message.tr
),
),
],
),
buttons: [
DialogButton(
color: AppColor.bondiBlue75,
onPressed: () async {
if(!reportServiceImpl.isButtonDisabled) {
reportServiceImpl.sendReport(referenceType, referenceId);
Navigator.pop(context);
Navigator.pop(context);
AppUtilities.showSnackBar(message: CommonTranslationConstants.hasSentReport);
}
},
child: Text(AppTranslationConstants.send.tr,
style: const TextStyle(fontSize: 15),
),
)
]
).show();
}