Merge branch 'development_new_design_2.0' into haroon-new-design

merge-requests/442/head
haroon amjad 3 years ago
commit 6cd2f65ce8

@ -606,6 +606,8 @@ const Map localizedValues = {
"select-gender": {"en": "Select Gender", "ar": "اختر الجنس"},
"i-am-a": {"en": "I am a ...", "ar": "أنا ..."},
"select-age": {"en": "Select Your Age", "ar": "حدد العمر"},
"select": {"en": "Select", "ar": "يختار"},
"i-am": {"en": "I am", "ar": "أنا"},
"years-old": {"en": "years old", "ar": "سنة"},
"drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"},
@ -1299,6 +1301,8 @@ const Map localizedValues = {
"app-update": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"},
"covid-alert": {"en": "Alert", "ar": "تنبيه"},
"enterIdentificationNumber": {"en": "Enter Identification Number", "ar": "أدخل رقم التعريف"},
"identificationNumber": {"en": "Identification Number", "ar": "رقم الهوية"},
"complaintNumber": {"en": "Complaint Number", "ar": "رقم الشكوى"},
"accountActivationDesc": {
"en": " This service allows you to activate your LAKUM account after registering completed.",
"ar": " تتيح لك هذه الخدمة تفعيل حساب برنامج الولاء لكم بعد اكتمال التسجيل. "
@ -1500,6 +1504,10 @@ const Map localizedValues = {
"invoiceDetails": {"en": "Invoice Details", "ar": "تفاصيل الفاتورة"},
"appoDetails": {"en": "Appointment Details", "ar": "تفاصيل الموعد"},
"appoPaymentConfirm": {"en": "Are you sure you Want to make payment for this appointment?", "ar": "هل أنت متأكد من أنك تريد سداد هذا الموعد؟"},
"selectSearchCriteria": {"en": "Select the search criteria", "ar": "حدد معايير البحث"},
"enterComplainNumber": {"en": "Enter the Complain Number", "ar": "أدخل رقم الشكوى"},
"enterfileNumber": {"en": "Enter File Number", "ar": "أدخل رقم الملف"},
"please_select_from_below_options": {"en": "Please select from below options:", "ar": "الرجاء التحديد من الخيارات أدناه:"},
"selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" },
"recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" },
"modesBelow": { "en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه" },

@ -13,37 +13,28 @@ class FeedbackService extends BaseService {
RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem();
List<AppoitmentAllHistoryResultList> appointHistoryList = List();
Future sendCOCItem(
{String title,
String details,
String cOCTypeName,
String attachment,
AppoitmentAllHistoryResultList appointHistory}) async {
Future sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async {
hasError = false;
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
_requestInsertCOCItem.attachment = attachment;
_requestInsertCOCItem.title = title;
_requestInsertCOCItem.details = details;
_requestInsertCOCItem.cOCTypeName = cOCTypeName;
_requestInsertCOCItem.formTypeID = cOCTypeName;
_requestInsertCOCItem.mobileNo =
"966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber);
_requestInsertCOCItem.mobileNo = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber);
_requestInsertCOCItem.isUserLoggedIn = true;
_requestInsertCOCItem.projectID = user.projectID;
_requestInsertCOCItem.patientName = user.firstName + " " + user.lastName;
_requestInsertCOCItem.fileName = "";
_requestInsertCOCItem.appVersion = VERSION_ID;
_requestInsertCOCItem.uILanguage =
languageID; //TODO Change it to be dynamic
_requestInsertCOCItem.uILanguage = languageID; //TODO Change it to be dynamic
_requestInsertCOCItem.browserInfo = Platform.localHostname;
_requestInsertCOCItem.deviceInfo = Platform.localHostname;
_requestInsertCOCItem.resolution = "400x847";
_requestInsertCOCItem.projectID = 0;
_requestInsertCOCItem.tokenID = "C0c@@dm!n?T&A&A@Barcha202029582948";
_requestInsertCOCItem.identificationNo =
int.parse(user.patientIdentificationNo);
_requestInsertCOCItem.identificationNo = int.parse(user.patientIdentificationNo);
if (BASE_URL.contains('uat')) {
_requestInsertCOCItem.forDemo = true;
} else {
@ -61,9 +52,7 @@ class FeedbackService extends BaseService {
body['ProjectName'] = appointHistory.projectName;
}
await baseAppClient
.post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {},
onFailure: (String error, int statusCode) {
await baseAppClient.post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
@ -73,15 +62,34 @@ class FeedbackService extends BaseService {
hasError = false;
Map<String, dynamic> body = new Map<String, dynamic>();
body['IdentificationNo'] = user.patientIdentificationNo;
body['MobileNo'] =
"966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber);
body['MobileNo'] = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber);
body['Searching_type'] = '1';
if (BASE_URL.contains('uat')) {
body['ForDemo'] = true;
}
await baseAppClient.post(GET_STATUS_FOR_COCO,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) {
cOCItemList = [];
response['ListCOCItems'].forEach((cOC) {
cOCItemList.add(COCItem.fromJson(cOC));
});
cOCItemList = cOCItemList.reversed.toList(); // Sort list in desc order
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async {
hasError = false;
Map<String, dynamic> body = new Map<String, dynamic>();
body['IdentificationNo'] = idNumber;
body['MobileNo'] = countryCode + Utils.getPhoneNumberWithoutZero(phoneNumber);
body['Searching_type'] = "$type";
if (BASE_URL.contains('uat')) {
body['ForDemo'] = true;
}
await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) {
cOCItemList = [];
response['ListCOCItems'].forEach((cOC) {
cOCItemList.add(COCItem.fromJson(cOC));
@ -97,12 +105,10 @@ class FeedbackService extends BaseService {
hasError = false;
Map<String, dynamic> body = new Map<String, dynamic>();
body['IsComingFromCOC'] = true;
baseAppClient.post(GET_PATIENT_AppointmentHistory,
onSuccess: (dynamic response, int statusCode) {
baseAppClient.post(GET_PATIENT_AppointmentHistory, onSuccess: (dynamic response, int statusCode) {
appointHistoryList = [];
response['AppoimentAllHistoryResultList'].forEach((appoint) {
appointHistoryList
.add(AppoitmentAllHistoryResultList.fromJson(appoint));
appointHistoryList.add(AppoitmentAllHistoryResultList.fromJson(appoint));
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -6,37 +6,18 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu
import '../../../locator.dart';
enum MessageType {
ComplaintOnAnAppointment,
ComplaintWithoutAppointment,
Question,
Compliment,
Suggestion,
NON
}
enum MessageType { ComplaintOnAnAppointment, ComplaintWithoutAppointment, Question, Compliment, Suggestion, NON }
class FeedbackViewModel extends BaseViewModel {
FeedbackService _feedbackService = locator<FeedbackService>();
List<COCItem> get cOCItemList => _feedbackService.cOCItemList;
List<AppoitmentAllHistoryResultList> get appointHistoryList => _feedbackService.appointHistoryList;
List<AppoitmentAllHistoryResultList> get appointHistoryList =>
_feedbackService.appointHistoryList;
Future<bool> sendCOCItem(
{String title,
String details,
String cOCTypeName,
String attachment,
AppoitmentAllHistoryResultList appointHistory}) async {
Future<bool> sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async {
setState(ViewState.BusyLocal);
await _feedbackService.sendCOCItem(
title: title,
details: details,
cOCTypeName: cOCTypeName,
attachment: attachment,
appointHistory: appointHistory);
await _feedbackService.sendCOCItem(title: title, details: details, cOCTypeName: cOCTypeName, attachment: attachment, appointHistory: appointHistory);
if (_feedbackService.hasError) {
error = _feedbackService.error;
setState(ViewState.ErrorLocal);
@ -58,7 +39,18 @@ class FeedbackViewModel extends BaseViewModel {
}
}
Future getPatentAppointmentHistory() async {
searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async {
setState(ViewState.Busy);
await _feedbackService.searchFeedback(countryCode, phoneNumber, type, idNumber);
if (_feedbackService.hasError) {
error = _feedbackService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future getPatentAppointmentHistory() async {
setState(ViewState.Busy);
await _feedbackService.getPatentAppointmentHistory();
if (_feedbackService.hasError) {

@ -1,11 +1,17 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart';
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
@ -18,6 +24,12 @@ class StatusFeedbackPage extends StatefulWidget {
}
class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
String countryCode = '966';
String mobileNo = "";
TextEditingController complainNumberController = TextEditingController();
StatusType statusType = StatusType.ComplaintNumber;
int selectedStatusIndex = 3;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -29,111 +41,273 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
body: Column(
children: [
Expanded(
child: model.cOCItemList.isNotEmpty
? Container(
margin: EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0, bottom: 80),
child: ListView.builder(
itemCount: model.cOCItemList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
},
child: Card(
shape: cardRadius(12),
margin: EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(projectViewModel.isArabic ? model.cOCItemList[index].statusAr : model.cOCItemList[index].status,
style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(model.cOCItemList[index].formType.toString(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
color: Color(0xff2B353E),
letterSpacing: -0.48,
height: 18 / 12))),
myRichText(TranslationBase.of(context).number + ": ", model.cOCItemList[index].itemID.toString(), projectViewModel.isArabic),
Text(model.cOCItemList[index].cOCTitle,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
color: Color(0xff2B353E),
letterSpacing: -0.48,
height: 18 / 12)),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(model.cOCItemList[index].date.split(" ")[0],
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
color: Color(0xff2B353E),
letterSpacing: -0.48)),
Text(model.cOCItemList[index].date.split(" ")[1].substring(0, 4),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
color: Color(0xff2B353E),
letterSpacing: -0.48)),
],
),
],
),
),
child: projectViewModel.isLogin
? !model.cOCItemList.isNotEmpty
? listData(model.cOCItemList, projectViewModel.isArabic, true)
: Center(
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.4,
),
Image.asset(
'assets/images/comments.png',
width: 80,
height: 80,
),
SizedBox(
height: 15,
),
Text(
TranslationBase.of(context).noSearchResult,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
color: Color(0xff2B353E),
),
)),
)
: Center(
),
],
),
)
: SingleChildScrollView(
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.4,
),
Image.asset(
'assets/images/comments.png',
width: 80,
height: 80,
),
SizedBox(
height: 15,
),
Text(
TranslationBase.of(context).noSearchResult,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
color: Color(0xff2B353E),
TranslationBase.of(context).selectSearchCriteria,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
),
SizedBox(height: 21),
InkWell(
onTap: () {
List<RadioSelectionDialogModel> list = [
RadioSelectionDialogModel(TranslationBase.of(context).complaintNumber, 3),
RadioSelectionDialogModel(TranslationBase.of(context).fileNumber, 1),
RadioSelectionDialogModel(TranslationBase.of(context).identificationNumber, 2),
];
showDialog(
context: context,
child: RadioSelectionDialog(
listData: list,
selectedIndex: selectedStatusIndex,
onValueSelected: (index) {
selectedStatusIndex = index;
setState(() {
if (index == 3) {
statusType = StatusType.ComplaintNumber;
} else if (index == 1) {
statusType = StatusType.FileNumber;
} else {
statusType = StatusType.IdentificationNumber;
}
});
},
),
);
},
child: Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
getSelected(context),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
color: Color(0xff2B353E),
),
),
Icon(
Icons.keyboard_arrow_down,
size: 22,
color: Colors.grey,
)
],
),
),
),
SizedBox(height: 12),
Directionality(
textDirection: TextDirection.ltr,
child: inputWidget(
statusType == StatusType.ComplaintNumber
? TranslationBase.of(context).enterComplainNumber
: (statusType == StatusType.FileNumber ? TranslationBase.of(context).enterfileNumber : TranslationBase.of(context).enterIdentificationNumber),
"",
complainNumberController,
isInputTypeNum: true)),
SizedBox(height: 12),
PhoneNumberSelectorWidget(onNumberChange: (value) {
setState(() {
mobileNo = value;
});
}, onCountryChange: (value) {
setState(() {
countryCode = value;
});
}),
],
),
),
),
if (!projectViewModel.isLogin)
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).search,
projectViewModel.isLogin || (mobileNo.length < 9) || (complainNumberController.text.isEmpty)
? null
: () {
model.searchFeedback(countryCode, mobileNo, selectedStatusIndex, complainNumberController.text).then((value) {
if (model.state == ViewState.ErrorLocal) {
Future.delayed(Duration(seconds: 1), () {
AppToast.showErrorToast(message: model.error);
});
} else {
listData(model.cOCItemList, projectViewModel.isArabic, false);
}
});
},
disabledColor: Colors.grey,
),
),
],
),
bottomSheet: projectViewModel.isLogin ? Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).search,
projectViewModel.isLogin ? null : () => {},
disabledColor: Colors.grey,
),
);
}
Widget listData(List<COCItem> cOCItemList, bool isArabic, bool isLogin) {
return ListView.builder(
padding: isLogin ? EdgeInsets.all(21) : null,
itemCount: cOCItemList.length,
shrinkWrap: isLogin ? false : true,
physics: isLogin ? null : NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => InkWell(
onTap: () {},
child: Card(
shape: cardRadius(12),
margin: EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(cOCItemList[index].formType.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))),
myRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic),
Text(cOCItemList[index].cOCTitle,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(cOCItemList[index].date.split(" ")[0],
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
Text(cOCItemList[index].date.split(" ")[1].substring(0, 4),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
],
),
],
),
),
) : Container(),
),
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller,
{VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: InkWell(
onTap: hasSelection ? () {} : null,
child: Row(
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_labelText,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
TextField(
enabled: isEnable,
scrollPadding: EdgeInsets.zero,
keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text,
controller: _controller,
maxLines: lines,
onChanged: (value) => {setState(() {})},
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration(
isDense: true,
hintText: _hintText,
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
suffixIconConstraints: BoxConstraints(minWidth: 50),
suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],
),
),
);
}
@ -141,4 +315,25 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
gotodetails(item) {
Navigator.pushReplacement(context, FadePage(page: FeedbackDetails(items: item)));
}
String getSelected(BuildContext context) {
switch (statusType) {
case StatusType.ComplaintNumber:
return TranslationBase.of(context).complaintNumber;
break;
case StatusType.FileNumber:
return TranslationBase.of(context).fileNumber;
break;
case StatusType.IdentificationNumber:
return TranslationBase.of(context).identificationNumber;
break;
}
return TranslationBase.of(context).notClassified;
}
}
enum StatusType {
ComplaintNumber,
FileNumber,
IdentificationNumber,
}

@ -805,6 +805,12 @@ class TranslationBase {
String get fileNumber => localizedValues['FileNumber'][locale.languageCode];
String get enterfileNumber => localizedValues['enterfileNumber'][locale.languageCode];
String get complaintNumber => localizedValues['complaintNumber'][locale.languageCode];
String get identificationNumber => localizedValues['identificationNumber'][locale.languageCode];
String get amount => localizedValues['Amount'][locale.languageCode];
String get depositorEmail => localizedValues['DepositorEmail'][locale.languageCode];
@ -1504,6 +1510,8 @@ class TranslationBase {
String get selectAll => localizedValues['select-all'][locale.languageCode];
String get select => localizedValues['select'][locale.languageCode];
String get selectMap => localizedValues['select-map'][locale.languageCode];
String get noAppointment => localizedValues['no-appointment'][locale.languageCode];
@ -2374,6 +2382,9 @@ class TranslationBase {
String get appoPaymentConfirm => localizedValues["appoPaymentConfirm"][locale.languageCode];
String get selectSearchCriteria => localizedValues["selectSearchCriteria"][locale.languageCode];
String get enterComplainNumber => localizedValues["enterComplainNumber"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -183,6 +183,8 @@ class Utils {
String newNumber = "";
if (number.startsWith('0')) {
newNumber = number.substring(1);
} else {
newNumber = number;
}
return newNumber;
}

@ -0,0 +1,121 @@
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:flutter/material.dart';
class RadioSelectionDialogModel {
String title;
int value;
RadioSelectionDialogModel(this.title, this.value);
}
class RadioSelectionDialog extends StatefulWidget {
final Function(int) onValueSelected;
final List<RadioSelectionDialogModel> listData;
final int selectedIndex;
const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex}) : super(key: key);
@override
State createState() => new RadioSelectionDialogState();
}
class RadioSelectionDialogState extends State<RadioSelectionDialog> {
int selectedIndex;
@override
void initState() {
selectedIndex = widget.selectedIndex ?? 0;
super.initState();
}
Widget build(BuildContext context) {
return Dialog(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(),
insetPadding: EdgeInsets.only(left: 21, right: 21),
child: Padding(
padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Text(
TranslationBase.of(context).select,
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96),
),
),
),
IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.close),
color: Color(0xff2B353E),
constraints: BoxConstraints(),
onPressed: () {
Navigator.pop(context);
},
)
],
),
SizedBox(height: 21),
Text(
TranslationBase.of(context).pleaseSelectFromBelowOptions,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
),
ListView.separated(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.only(bottom: 42, top: 10),
itemBuilder: (context, index) {
return Row(
children: [
SizedBox(
width: 22,
height: 22,
child: Radio(
value: widget.listData[index].value,
groupValue: selectedIndex,
onChanged: (value) {
setState(() {
selectedIndex = value;
});
},
),
),
SizedBox(width: 8),
Text(
widget.listData[index].title,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56),
),
],
);
},
separatorBuilder: (context, index) => SizedBox(height: 10),
itemCount: widget.listData.length),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: DefaultButton(
TranslationBase.of(context).save,
() {
Navigator.pop(context);
widget.onValueSelected(selectedIndex);
},
color: Color(0xff349745),
),
),
],
),
],
),
),
);
}
}
Loading…
Cancel
Save