Merge branch 'Blood_Donation' into 'master'
Blood donation See merge request Cloud_Solution/diplomatic-quarter!58merge-requests/226/merge
commit
ac871bb416
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
@ -0,0 +1,77 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
class List_BloodGroupDetailsModel {
|
||||||
|
int iD;
|
||||||
|
int patientID;
|
||||||
|
int patientType;
|
||||||
|
bool patientOutSA;
|
||||||
|
int zipCode;
|
||||||
|
String cellNumber;
|
||||||
|
String cityCode;
|
||||||
|
String city;
|
||||||
|
int gender;
|
||||||
|
String bloodGroup;
|
||||||
|
String nationalID;
|
||||||
|
bool isActive;
|
||||||
|
int createdBy;
|
||||||
|
DateTime createdOn;
|
||||||
|
int editedBy;
|
||||||
|
DateTime editedOn;
|
||||||
|
|
||||||
|
List_BloodGroupDetailsModel(
|
||||||
|
{this.iD,
|
||||||
|
this.patientID,
|
||||||
|
this.patientType,
|
||||||
|
this.patientOutSA,
|
||||||
|
this.zipCode,
|
||||||
|
this.cellNumber,
|
||||||
|
this.cityCode,
|
||||||
|
this.city,
|
||||||
|
this.gender,
|
||||||
|
this.bloodGroup,
|
||||||
|
this.nationalID,
|
||||||
|
this.isActive,
|
||||||
|
this.createdBy,
|
||||||
|
this.createdOn,
|
||||||
|
this.editedBy,
|
||||||
|
this.editedOn});
|
||||||
|
|
||||||
|
List_BloodGroupDetailsModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
iD = json['ID'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
patientType = json['PatientType'];
|
||||||
|
patientOutSA = json['PatientOutSA'];
|
||||||
|
zipCode = json['ZipCode'];
|
||||||
|
cellNumber = json['CellNumber'];
|
||||||
|
cityCode = json['CityCode'];
|
||||||
|
city = json['City'];
|
||||||
|
gender = json['Gender'];
|
||||||
|
bloodGroup = json['BloodGroup'];
|
||||||
|
nationalID = json['NationalID'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
createdBy = json['CreatedBy'];
|
||||||
|
createdOn = DateUtil.convertStringToDate(json['CreatedOn']);// json['CreatedOn'];
|
||||||
|
editedBy = json['EditedBy'];
|
||||||
|
editedOn = DateUtil.convertStringToDate(json['EditedOn']);//json['EditedOn'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ID'] = this.iD;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['PatientType'] = this.patientType;
|
||||||
|
data['PatientOutSA'] = this.patientOutSA;
|
||||||
|
data['ZipCode'] = this.zipCode;
|
||||||
|
data['CellNumber'] = this.cellNumber;
|
||||||
|
data['CityCode'] = this.cityCode;
|
||||||
|
data['City'] = this.city;
|
||||||
|
data['Gender'] = this.gender;
|
||||||
|
data['BloodGroup'] = this.bloodGroup;
|
||||||
|
data['NationalID'] = this.nationalID;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['CreatedBy'] = this.createdBy;
|
||||||
|
data['CreatedOn'] = this.createdOn;
|
||||||
|
data['EditedBy'] = this.editedBy;
|
||||||
|
data['EditedOn'] = this.editedOn;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
class CitiesModel {
|
||||||
|
int iD;
|
||||||
|
String description;
|
||||||
|
String descriptionN;
|
||||||
|
|
||||||
|
CitiesModel({this.iD, this.description, this.descriptionN});
|
||||||
|
|
||||||
|
CitiesModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
iD = json['ID'];
|
||||||
|
description = json['Description'];
|
||||||
|
descriptionN = json['DescriptionN'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ID'] = this.iD;
|
||||||
|
data['Description'] = this.description;
|
||||||
|
data['DescriptionN'] = this.descriptionN;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart';
|
||||||
|
|
||||||
|
import '../base_service.dart';
|
||||||
|
|
||||||
|
class BloodDetailsService extends BaseService{
|
||||||
|
|
||||||
|
// List<CitiesModel> CitiesModelList = List();
|
||||||
|
// Map<String, dynamic> body = Map();
|
||||||
|
|
||||||
|
List<List_BloodGroupDetailsModel> BloodModelList = List();
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
Future getAllBloodOrders() async {
|
||||||
|
hasError = false;
|
||||||
|
body['List_BloodGroupDetails'] = false;
|
||||||
|
await baseAppClient.post(GET_BLOOD_REQUEST,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
BloodModelList.clear();
|
||||||
|
|
||||||
|
response['List_BloodGroupDetails'].forEach((vital) {
|
||||||
|
BloodModelList.add(List_BloodGroupDetailsModel.fromJson(vital));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
|
||||||
|
|
||||||
|
import '../base_service.dart';
|
||||||
|
|
||||||
|
class BloodDonationService extends BaseService {
|
||||||
|
//List<GetPatientICProjectsModel> LivechatModelList = List();
|
||||||
|
|
||||||
|
// Map<String, dynamic> body = Map();
|
||||||
|
|
||||||
|
List<CitiesModel> CitiesModelList = List();
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
Future getAllCitiesOrders() async {
|
||||||
|
hasError = false;
|
||||||
|
body['ListCities'] = false;
|
||||||
|
await baseAppClient.post(GET_CITIES_REQUEST,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
CitiesModelList.clear();
|
||||||
|
|
||||||
|
response['ListCities'].forEach((vital) {
|
||||||
|
CitiesModelList.add(CitiesModel.fromJson(vital));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart';
|
||||||
|
import '../../../locator.dart';
|
||||||
|
import '../base_view_model.dart';
|
||||||
|
|
||||||
|
class BloodDeatailsViewModel extends BaseViewModel{
|
||||||
|
|
||||||
|
|
||||||
|
BloodDetailsService _bloodDetailsService =locator<BloodDetailsService>();
|
||||||
|
List<List_BloodGroupDetailsModel> get BloodDetailsModelList => _bloodDetailsService.BloodModelList;//_bloodDonationService.CitiesModelList;
|
||||||
|
|
||||||
|
|
||||||
|
Future getBlood() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _bloodDetailsService .getAllBloodOrders();;
|
||||||
|
|
||||||
|
if (_bloodDetailsService.hasError) {
|
||||||
|
error = _bloodDetailsService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart';
|
||||||
|
|
||||||
|
import '../../../locator.dart';
|
||||||
|
import '../base_view_model.dart';
|
||||||
|
|
||||||
|
class BloodDonationViewModel extends BaseViewModel{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BloodDonationService _bloodDonationService =locator<BloodDonationService>();
|
||||||
|
List<CitiesModel> get CitiesModelList => _bloodDonationService.CitiesModelList;
|
||||||
|
Future getCities() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _bloodDonationService.getAllCitiesOrders();
|
||||||
|
// getHospitals();
|
||||||
|
if (_bloodDonationService.hasError) {
|
||||||
|
error = _bloodDonationService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,397 @@
|
|||||||
|
// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
// import 'package:flutter/cupertino.dart';
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
//
|
||||||
|
// //import '../../../core/model/my_balance/AdvanceModel.dart';
|
||||||
|
// import 'confirm_payment_page.dart';
|
||||||
|
// import 'dialogs/SelectBeneficiaryDialog.dart';
|
||||||
|
// import 'dialogs/SelectPatientFamilyDialog.dart';
|
||||||
|
// import 'dialogs/SelectPatientInfoDialog.dart';
|
||||||
|
// import 'new_text_Field.dart';
|
||||||
|
//
|
||||||
|
// enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
||||||
|
//
|
||||||
|
// class AdvancePaymentPage extends StatefulWidget {
|
||||||
|
// @override
|
||||||
|
// _AdvancePaymentPageState createState() => _AdvancePaymentPageState();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
|
||||||
|
// TextEditingController _fileTextController = TextEditingController();
|
||||||
|
// TextEditingController _notesTextController = TextEditingController();
|
||||||
|
// BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
||||||
|
// HospitalsModel _selectedHospital;
|
||||||
|
// String amount = "";
|
||||||
|
// String email;
|
||||||
|
// PatientInfo _selectedPatientInfo;
|
||||||
|
// AuthenticatedUser authenticatedUser;
|
||||||
|
// GetAllSharedRecordsByStatusList selectedPatientFamily;
|
||||||
|
// AdvanceModel advanceModel = AdvanceModel();
|
||||||
|
//
|
||||||
|
// AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
// AuthenticatedUser authUser;
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// void initState() {
|
||||||
|
// super.initState();
|
||||||
|
// getAuthUser();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// return BaseView<MyBalanceViewModel>(
|
||||||
|
// onModelReady: (model) => model.getHospitals(),
|
||||||
|
// builder: (_, model, w) => AppScaffold(
|
||||||
|
// isShowAppBar: true,
|
||||||
|
// appBarTitle: TranslationBase.of(context).advancePayment,
|
||||||
|
// body: SingleChildScrollView(
|
||||||
|
// physics: ScrollPhysics(),
|
||||||
|
// child: Container(
|
||||||
|
// margin: EdgeInsets.all(12),
|
||||||
|
// child: Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// Texts(
|
||||||
|
// TranslationBase.of(context).advancePaymentLabel,
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () => confirmSelectBeneficiaryDialog(model),
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getBeneficiaryType()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// model.getFamilyFiles().then((value) {
|
||||||
|
// confirmSelectFamilyDialog(model
|
||||||
|
// .getAllSharedRecordsByStatusResponse
|
||||||
|
// .getAllSharedRecordsByStatusList);
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getFamilyMembersName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).fileNumber,
|
||||||
|
// controller: _fileTextController,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.OtherAccount)
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.OtherAccount)
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// if (_fileTextController.text.isNotEmpty)
|
||||||
|
// model
|
||||||
|
// .getPatientInfoByPatientID(
|
||||||
|
// id: _fileTextController.text)
|
||||||
|
// .then((value) {
|
||||||
|
// confirmSelectPatientDialog(model.patientInfoList);
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor:
|
||||||
|
// Colors.blue.withOpacity(0.6));
|
||||||
|
// else
|
||||||
|
// AppToast.showErrorToast(
|
||||||
|
// message: 'Please Enter The File Number');
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getPatientName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () => confirmSelectHospitalDialog(model.hospitals),
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getHospitalName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).amount,
|
||||||
|
// keyboardType: TextInputType.number,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// amount = value;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).depositorEmail,
|
||||||
|
// initialValue: model.user.emailAddress,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// email = value;
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).notes,
|
||||||
|
// controller: _notesTextController,
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: MediaQuery.of(context).size.height * 0.15,
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// bottomSheet: Container(
|
||||||
|
// height: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// width: double.infinity,
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// child: SecondaryButton(
|
||||||
|
// textColor: Colors.white,
|
||||||
|
// label: TranslationBase.of(context).submit,
|
||||||
|
// disabled: amount.isEmpty ||
|
||||||
|
// _fileTextController.text.isEmpty ||
|
||||||
|
// _selectedHospital == null,
|
||||||
|
// onTap: () {
|
||||||
|
// advanceModel.fileNumber = _fileTextController.text;
|
||||||
|
// advanceModel.hospitalsModel = _selectedHospital;
|
||||||
|
// advanceModel.note = _notesTextController.text;
|
||||||
|
// advanceModel.email = email ?? model.user.emailAddress;
|
||||||
|
// advanceModel.amount = amount;
|
||||||
|
//
|
||||||
|
// model.getPatientInfoByPatientIDAndMobileNumber().then((value) {
|
||||||
|
// if (model.state != ViewState.Error &&
|
||||||
|
// model.state != ViewState.ErrorLocal) {
|
||||||
|
// Utils.hideKeyboard(context);
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (context) => PaymentMethod())).then(
|
||||||
|
// (value) {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// FadePage(
|
||||||
|
// page: ConfirmPaymentPage(
|
||||||
|
// advanceModel: advanceModel,
|
||||||
|
// selectedPaymentMethod: value,
|
||||||
|
// patientInfoAndMobileNumber:
|
||||||
|
// model.patientInfoAndMobileNumber,
|
||||||
|
// authenticatedUser: authUser,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// )),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// child: SelectBeneficiaryDialog(
|
||||||
|
// beneficiaryType: beneficiaryType,
|
||||||
|
// onValueSelected: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// if (value == BeneficiaryType.MyAccount) {
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
// } else
|
||||||
|
// _fileTextController.text = "";
|
||||||
|
//
|
||||||
|
// beneficiaryType = value;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void confirmSelectHospitalDialog(List<HospitalsModel> hospitals) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// child: SelectHospitalDialog(
|
||||||
|
// hospitals: hospitals,
|
||||||
|
// selectedHospital: _selectedHospital,
|
||||||
|
// onValueSelected: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// _selectedHospital = value;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void confirmSelectPatientDialog(List<PatientInfo> patientInfoList) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// child: SelectPatientInfoDialog(
|
||||||
|
// patientInfoList: patientInfoList,
|
||||||
|
// selectedPatientInfo: _selectedPatientInfo,
|
||||||
|
// onValueSelected: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// advanceModel.depositorName = value.fullName;
|
||||||
|
// _selectedPatientInfo = value;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void confirmSelectFamilyDialog(
|
||||||
|
// List<GetAllSharedRecordsByStatusList> getAllSharedRecordsByStatusList) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// child: SelectPatientFamilyDialog(
|
||||||
|
// getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList,
|
||||||
|
// selectedPatientFamily: selectedPatientFamily,
|
||||||
|
// onValueSelected: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// selectedPatientFamily = value;
|
||||||
|
// _fileTextController.text =
|
||||||
|
// selectedPatientFamily.patientID.toString();
|
||||||
|
// advanceModel.depositorName = value.patientName;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String getBeneficiaryType() {
|
||||||
|
// switch (beneficiaryType) {
|
||||||
|
// case BeneficiaryType.MyAccount:
|
||||||
|
// return TranslationBase.of(context).myAccount;
|
||||||
|
// case BeneficiaryType.MyFamilyFiles:
|
||||||
|
// return TranslationBase.of(context).myFamilyFiles;
|
||||||
|
// break;
|
||||||
|
// case BeneficiaryType.OtherAccount:
|
||||||
|
// return TranslationBase.of(context).otherAccount;
|
||||||
|
// break;
|
||||||
|
// case BeneficiaryType.NON:
|
||||||
|
// return TranslationBase.of(context).selectBeneficiary;
|
||||||
|
// }
|
||||||
|
// return TranslationBase.of(context).selectBeneficiary;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String getHospitalName() {
|
||||||
|
// if (_selectedHospital != null)
|
||||||
|
// return _selectedHospital.name;
|
||||||
|
// else
|
||||||
|
// return TranslationBase.of(context).selectHospital;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String getPatientName() {
|
||||||
|
// if (_selectedPatientInfo != null)
|
||||||
|
// return _selectedPatientInfo.fullName;
|
||||||
|
// else
|
||||||
|
// return TranslationBase.of(context).selectPatientName;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// getAuthUser() async {
|
||||||
|
// if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
||||||
|
// var data = AuthenticatedUser.fromJson(
|
||||||
|
// await this.sharedPref.getObject(USER_PROFILE));
|
||||||
|
// setState(() {
|
||||||
|
// authUser = data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String getFamilyMembersName() {
|
||||||
|
// if (selectedPatientFamily != null)
|
||||||
|
// return selectedPatientFamily.patientName;
|
||||||
|
// else
|
||||||
|
// return TranslationBase.of(context).selectFamilyPatientName;
|
||||||
|
// }
|
||||||
|
// }
|
@ -0,0 +1,684 @@
|
|||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
|
||||||
|
//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:giffy_dialog/giffy_dialog.dart';
|
||||||
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
|
||||||
|
//import '../../../core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'confirm_payment_page.dart';
|
||||||
|
import 'dialogs/SelectBeneficiaryDialog.dart';
|
||||||
|
import 'dialogs/SelectBloodDialog.dart';
|
||||||
|
import 'dialogs/SelectGenderDialog.dart';
|
||||||
|
import 'dialogs/SelectPatientFamilyDialog.dart';
|
||||||
|
import 'dialogs/SelectPatientInfoDialog.dart';
|
||||||
|
import 'new_text_Field.dart';
|
||||||
|
|
||||||
|
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
||||||
|
enum Gender{Male,Female,NON}
|
||||||
|
enum Blood{Oplus,Ominus,Aplus,Aminus,Bplus,Bminus,ABplus,ABminus,NON}
|
||||||
|
|
||||||
|
class BloodDonationPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_BloodDonationPageState createState() => _BloodDonationPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BloodDonationPageState extends State<BloodDonationPage> {
|
||||||
|
TextEditingController _fileTextController = TextEditingController();
|
||||||
|
TextEditingController _notesTextController = TextEditingController();
|
||||||
|
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
||||||
|
Gender gender = Gender.Male;//Gender.NON;
|
||||||
|
Blood blood = Blood.Aminus;//Blood.NON;
|
||||||
|
//HospitalsModel _selectedHospital;
|
||||||
|
CitiesModel _selectedHospital;
|
||||||
|
|
||||||
|
String amount = "";
|
||||||
|
String email;
|
||||||
|
PatientInfo _selectedPatientInfo;
|
||||||
|
AuthenticatedUser authenticatedUser;
|
||||||
|
GetAllSharedRecordsByStatusList selectedPatientFamily;
|
||||||
|
AdvanceModel advanceModel = AdvanceModel();
|
||||||
|
List_BloodGroupDetailsModel bloodDetails=List_BloodGroupDetailsModel();
|
||||||
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
AuthenticatedUser authUser;
|
||||||
|
var checkedValue = false;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
getAuthUser();
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<MyBalanceViewModel>(
|
||||||
|
onModelReady: (model) => model.getCities(),//model.getHospitals(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: "Blood Donation",//TranslationBase.of(context).advancePayment,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: ScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Texts(
|
||||||
|
// TranslationBase.of(context).advancePaymentLabel,
|
||||||
|
"Enter the required information, In order to register for Blood Donation Service",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () => confirmSelectHospitalDialog(model.CitiesModelList),//model.hospitals
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(getHospitalName()),
|
||||||
|
Icon(Icons.arrow_drop_down)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
//======Gender========
|
||||||
|
onTap: () => confirmSelectGenderDialog(),//confirmSelectBeneficiaryDialog(model),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
//Texts(getBeneficiaryType()),
|
||||||
|
Texts(getGender()),
|
||||||
|
Icon(Icons.arrow_drop_down)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// model.getFamilyFiles().then((value) {
|
||||||
|
// confirmSelectFamilyDialog(model
|
||||||
|
// .getAllSharedRecordsByStatusResponse
|
||||||
|
// .getAllSharedRecordsByStatusList);
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getFamilyMembersName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
//======Gender========
|
||||||
|
onTap: () => confirmSelectBloodDialog(),//confirmSelectBeneficiaryDialog(model),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
//Texts(getBeneficiaryType()),
|
||||||
|
Texts(getBlood()),
|
||||||
|
Icon(Icons.arrow_drop_down)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// model.getFamilyFiles().then((value) {
|
||||||
|
// confirmSelectFamilyDialog(model
|
||||||
|
// .getAllSharedRecordsByStatusResponse
|
||||||
|
// .getAllSharedRecordsByStatusList);
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getFamilyMembersName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Text(" To view the terms and conditions "),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.height * 0.10,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
|
builder: (BuildContext context) => UserAgreementPage()));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
child: Texts(" Click here ",color: Colors.blue,),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
onChanged: (bool value) {
|
||||||
|
setState(() {
|
||||||
|
checkedValue = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// tristate: checkedValue==true,//i == 1,
|
||||||
|
value: checkedValue,
|
||||||
|
activeColor: Colors.red,//Color(0xFF6200EE),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10,),
|
||||||
|
Row(children: [
|
||||||
|
|
||||||
|
],),
|
||||||
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'I agree to the terms and conditions ',
|
||||||
|
style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).fileNumber,
|
||||||
|
// controller: _fileTextController,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.OtherAccount)
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// if (beneficiaryType == BeneficiaryType.OtherAccount)
|
||||||
|
// InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// if (_fileTextController.text.isNotEmpty)
|
||||||
|
// model
|
||||||
|
// .getPatientInfoByPatientID(
|
||||||
|
// id: _fileTextController.text)
|
||||||
|
// .then((value) {
|
||||||
|
// confirmSelectPatientDialog(model.patientInfoList);
|
||||||
|
// }).showProgressBar(
|
||||||
|
// text: "Loading",
|
||||||
|
// backgroundColor:
|
||||||
|
// Colors.blue.withOpacity(0.6));
|
||||||
|
// else
|
||||||
|
// AppToast.showErrorToast(
|
||||||
|
// message: 'Please Enter The File Number');
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(12),
|
||||||
|
// width: double.infinity,
|
||||||
|
// height: 65,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: Colors.white),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Texts(getPatientName()),
|
||||||
|
// Icon(Icons.arrow_drop_down)
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).amount,
|
||||||
|
// keyboardType: TextInputType.number,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// setState(() {
|
||||||
|
// amount = value;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).depositorEmail,
|
||||||
|
// initialValue: model.user.emailAddress,
|
||||||
|
// onChanged: (value) {
|
||||||
|
// email = value;
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 12,
|
||||||
|
// ),
|
||||||
|
// NewTextFields(
|
||||||
|
// hintText: TranslationBase.of(context).notes,
|
||||||
|
// controller: _notesTextController,
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
width: 350,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) =>
|
||||||
|
AssetGiffyDialog(
|
||||||
|
title: Text(
|
||||||
|
"",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.w600),
|
||||||
|
),
|
||||||
|
image: Image.asset(
|
||||||
|
'assets/images/BloodChrt_EN.png'),
|
||||||
|
buttonCancelText:
|
||||||
|
Text('cancel'),
|
||||||
|
buttonCancelColor:
|
||||||
|
Colors.grey,
|
||||||
|
onlyCancelButton: true,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
height: 200,
|
||||||
|
child:Image.asset(
|
||||||
|
'assets/images/BloodChrt_EN.png')),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.15,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.12,
|
||||||
|
width: double.infinity,
|
||||||
|
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: SecondaryButton(
|
||||||
|
textColor: Colors.white,
|
||||||
|
color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,),
|
||||||
|
label: "Save",
|
||||||
|
//
|
||||||
|
onTap: (){
|
||||||
|
|
||||||
|
bloodDetails.city=_selectedHospital.toString();
|
||||||
|
|
||||||
|
// bloodDetails.
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//==============
|
||||||
|
void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectBeneficiaryDialog(
|
||||||
|
beneficiaryType: beneficiaryType,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (value == BeneficiaryType.MyAccount) {
|
||||||
|
_fileTextController.text = model.user.patientID.toString();
|
||||||
|
advanceModel.depositorName =
|
||||||
|
model.user.firstName + " " + model.user.lastName;
|
||||||
|
} else
|
||||||
|
_fileTextController.text = "";
|
||||||
|
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
void confirmSelectBloodDialog(){
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectBloodDialog(bloodType: blood,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (value == Blood.Oplus) {
|
||||||
|
bloodDetails.bloodGroup="O+";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.Ominus) {
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
bloodDetails.bloodGroup="O-";
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.ABplus) {
|
||||||
|
bloodDetails.bloodGroup="AB+";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.ABminus) {
|
||||||
|
bloodDetails.bloodGroup="AB-";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.Aplus) {
|
||||||
|
bloodDetails.bloodGroup="A+";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.Aminus) {
|
||||||
|
bloodDetails.bloodGroup="A-";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.Bplus) {
|
||||||
|
bloodDetails.bloodGroup="B+";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}else
|
||||||
|
if (value == Blood.Bminus) {
|
||||||
|
bloodDetails.bloodGroup="B-";
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
_fileTextController.text = "";
|
||||||
|
|
||||||
|
// beneficiaryType = value;
|
||||||
|
blood=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
void confirmSelectGenderDialog(){
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectGenderDialog(beneficiaryType: gender,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (value == Gender.Male) {
|
||||||
|
// _fileTextController.text = model.user.patientID.toString();
|
||||||
|
bloodDetails.patientType=1;
|
||||||
|
// advanceModel.depositorName =
|
||||||
|
// model.user.firstName + " " + model.user.lastName;
|
||||||
|
} else
|
||||||
|
// _fileTextController.text = "";
|
||||||
|
{bloodDetails.gender=2;}
|
||||||
|
|
||||||
|
// beneficiaryType = value;
|
||||||
|
gender=value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//void confirmSelectHospitalDialog(List<HospitalsModel> hospitals) {
|
||||||
|
void confirmSelectHospitalDialog(List<CitiesModel> hospitals) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectCiteisDialog(
|
||||||
|
hospitals: hospitals,
|
||||||
|
selectedHospital: _selectedHospital,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
_selectedHospital = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectPatientDialog(List<PatientInfo> patientInfoList) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectPatientInfoDialog(
|
||||||
|
patientInfoList: patientInfoList,
|
||||||
|
selectedPatientInfo: _selectedPatientInfo,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
advanceModel.depositorName = value.fullName;
|
||||||
|
_selectedPatientInfo = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectFamilyDialog(
|
||||||
|
List<GetAllSharedRecordsByStatusList> getAllSharedRecordsByStatusList) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: SelectPatientFamilyDialog(
|
||||||
|
getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList,
|
||||||
|
selectedPatientFamily: selectedPatientFamily,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
selectedPatientFamily = value;
|
||||||
|
_fileTextController.text =
|
||||||
|
selectedPatientFamily.patientID.toString();
|
||||||
|
advanceModel.depositorName = value.patientName;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getBeneficiaryType() {
|
||||||
|
switch (beneficiaryType) {
|
||||||
|
case BeneficiaryType.MyAccount:
|
||||||
|
return TranslationBase.of(context).myAccount;
|
||||||
|
case BeneficiaryType.MyFamilyFiles:
|
||||||
|
return TranslationBase.of(context).myFamilyFiles;
|
||||||
|
break;
|
||||||
|
case BeneficiaryType.OtherAccount:
|
||||||
|
return TranslationBase.of(context).otherAccount;
|
||||||
|
break;
|
||||||
|
case BeneficiaryType.NON:
|
||||||
|
return "Select Gender";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
return "Select Gender";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
String getGender() {
|
||||||
|
switch (gender) {
|
||||||
|
case Gender.Male:
|
||||||
|
return "Male";
|
||||||
|
case Gender.Female:
|
||||||
|
return "Female";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Gender.NON:
|
||||||
|
return "Select Gender";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
return "Select Gender";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
String getBlood() {
|
||||||
|
switch (blood) {
|
||||||
|
case Blood.Oplus:
|
||||||
|
return "O+";
|
||||||
|
break;
|
||||||
|
case Blood.Ominus:
|
||||||
|
return "O-";
|
||||||
|
break;
|
||||||
|
case Blood.ABplus:
|
||||||
|
return "AB+";
|
||||||
|
break;
|
||||||
|
case Blood.ABminus:
|
||||||
|
return "AB-";
|
||||||
|
break;
|
||||||
|
case Blood.Aplus:
|
||||||
|
return "A+";
|
||||||
|
break;
|
||||||
|
case Blood.Aminus:
|
||||||
|
return "A-";
|
||||||
|
break;
|
||||||
|
case Blood.Bplus:
|
||||||
|
return "B-";
|
||||||
|
break;
|
||||||
|
case Blood.Bminus:
|
||||||
|
return "B-";
|
||||||
|
break;
|
||||||
|
case Blood.Bplus:
|
||||||
|
return "B+";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Blood.NON:
|
||||||
|
return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getHospitalName() {
|
||||||
|
if (_selectedHospital != null)
|
||||||
|
return _selectedHospital.description;
|
||||||
|
else
|
||||||
|
return
|
||||||
|
"Riyadh";
|
||||||
|
// return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getPatientName() {
|
||||||
|
if (_selectedPatientInfo != null)
|
||||||
|
return _selectedPatientInfo.fullName;
|
||||||
|
else
|
||||||
|
return TranslationBase.of(context).selectPatientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAuthUser() async {
|
||||||
|
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
|
||||||
|
var data = AuthenticatedUser.fromJson(
|
||||||
|
await this.sharedPref.getObject(USER_PROFILE));
|
||||||
|
setState(() {
|
||||||
|
authUser = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFamilyMembersName() {
|
||||||
|
if (selectedPatientFamily != null)
|
||||||
|
return selectedPatientFamily.patientName;
|
||||||
|
else
|
||||||
|
return TranslationBase.of(context).selectFamilyPatientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//================
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,306 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/routes.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
|
||||||
|
import 'dialogs/ConfirmSMSDialog.dart';
|
||||||
|
import 'new_text_Field.dart';
|
||||||
|
|
||||||
|
class ConfirmPaymentPage extends StatelessWidget {
|
||||||
|
final AdvanceModel advanceModel;
|
||||||
|
final PatientInfoAndMobileNumber patientInfoAndMobileNumber;
|
||||||
|
final String selectedPaymentMethod;
|
||||||
|
MyInAppBrowser browser;
|
||||||
|
AuthenticatedUser authenticatedUser;
|
||||||
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
|
||||||
|
ConfirmPaymentPage(
|
||||||
|
{this.advanceModel,
|
||||||
|
this.patientInfoAndMobileNumber,
|
||||||
|
this.selectedPaymentMethod,
|
||||||
|
this.authenticatedUser});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
void showSMSDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
child: ConfirmSMSDialog(
|
||||||
|
phoneNumber: patientInfoAndMobileNumber.mobileNumber,
|
||||||
|
),
|
||||||
|
).then((value) {
|
||||||
|
print("dialog dismissed");
|
||||||
|
print(value);
|
||||||
|
if (value != null && value) {
|
||||||
|
AppoitmentAllHistoryResultList appo =
|
||||||
|
new AppoitmentAllHistoryResultList();
|
||||||
|
appo.projectID = patientInfoAndMobileNumber.projectID;
|
||||||
|
openPayment(selectedPaymentMethod, authenticatedUser,
|
||||||
|
double.parse(advanceModel.amount), appo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return BaseView<MyBalanceViewModel>(
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).advancePayment,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: ScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Texts(
|
||||||
|
TranslationBase.of(context).confirmThePayment,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 24,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 100.0,
|
||||||
|
padding: EdgeInsets.all(7.0),
|
||||||
|
width: MediaQuery.of(context).size.width * 0.45,
|
||||||
|
child: Image.asset(getImagePath(selectedPaymentMethod)),
|
||||||
|
),
|
||||||
|
Texts(
|
||||||
|
'${advanceModel.amount} SAR',
|
||||||
|
fontSize: 26,
|
||||||
|
bold: true,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(3),
|
||||||
|
child: NewTextFields(
|
||||||
|
hintText: TranslationBase.of(context).fileNumber,
|
||||||
|
initialValue: advanceModel.fileNumber,
|
||||||
|
isEnabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(3),
|
||||||
|
child: NewTextFields(
|
||||||
|
hintText: TranslationBase.of(context).name,
|
||||||
|
initialValue: patientInfoAndMobileNumber.firstName,
|
||||||
|
isEnabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: TranslationBase.of(context).mobileNumber,
|
||||||
|
initialValue: patientInfoAndMobileNumber.mobileNumber,
|
||||||
|
isEnabled: false,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: TranslationBase.of(context).depositorName,
|
||||||
|
initialValue: advanceModel.depositorName,
|
||||||
|
isEnabled: false,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: TranslationBase.of(context).notes,
|
||||||
|
initialValue: advanceModel.note,
|
||||||
|
isEnabled: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
width: double.infinity,
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: SecondaryButton(
|
||||||
|
textColor: Colors.white,
|
||||||
|
label: TranslationBase.of(context).confirm.toUpperCase(),
|
||||||
|
disabled: model.state == ViewState.Busy,
|
||||||
|
onTap: () {
|
||||||
|
model
|
||||||
|
.sendActivationCodeForAdvancePayment(
|
||||||
|
patientID: int.parse(advanceModel.fileNumber),
|
||||||
|
projectID: advanceModel.hospitalsModel.iD)
|
||||||
|
.then((value) {
|
||||||
|
if (model.state != ViewState.ErrorLocal &&
|
||||||
|
model.state != ViewState.Error) showSMSDialog();
|
||||||
|
}).showProgressBar(
|
||||||
|
text: "Loading",
|
||||||
|
backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getImagePath(String paymentMethod) {
|
||||||
|
switch (paymentMethod) {
|
||||||
|
case "MADA":
|
||||||
|
return 'assets/images/new-design/mada.png';
|
||||||
|
break;
|
||||||
|
case "SADAD":
|
||||||
|
return 'assets/images/new-design/sadad.png';
|
||||||
|
break;
|
||||||
|
case "VISA":
|
||||||
|
return 'assets/images/new-design/visa.png';
|
||||||
|
break;
|
||||||
|
case "MASTERCARD":
|
||||||
|
return 'assets/images/new-design/mastercard.png';
|
||||||
|
break;
|
||||||
|
case "Installment":
|
||||||
|
return 'assets/images/new-design/installment.png';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'assets/images/new-design/mada.png';
|
||||||
|
}
|
||||||
|
|
||||||
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser,
|
||||||
|
double amount, AppoitmentAllHistoryResultList appo) {
|
||||||
|
browser = new MyInAppBrowser(
|
||||||
|
onExitCallback: onBrowserExit,
|
||||||
|
appo: appo,
|
||||||
|
onLoadStartCallback: onBrowserLoadStart);
|
||||||
|
|
||||||
|
browser.openPaymentBrowser(
|
||||||
|
amount,
|
||||||
|
"Advance Payment",
|
||||||
|
Utils.getAdvancePaymentTransID(
|
||||||
|
authenticatedUser.projectID, authenticatedUser.patientID),
|
||||||
|
appo.projectID.toString(),
|
||||||
|
authenticatedUser.emailAddress,
|
||||||
|
paymentMethod,
|
||||||
|
authenticatedUser,
|
||||||
|
browser);
|
||||||
|
}
|
||||||
|
|
||||||
|
onBrowserLoadStart(String url) {
|
||||||
|
print("onBrowserLoadStart");
|
||||||
|
print(url);
|
||||||
|
|
||||||
|
MyInAppBrowser.successURLS.forEach((element) {
|
||||||
|
if (url.contains(element)) {
|
||||||
|
if (browser.isOpened()) browser.close();
|
||||||
|
MyInAppBrowser.isPaymentDone = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
MyInAppBrowser.errorURLS.forEach((element) {
|
||||||
|
if (url.contains(element)) {
|
||||||
|
if (browser.isOpened()) browser.close();
|
||||||
|
MyInAppBrowser.isPaymentDone = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
||||||
|
print("onBrowserExit Called!!!!");
|
||||||
|
if (isPaymentMade) checkPaymentStatus(appo);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service
|
||||||
|
.checkPaymentStatus(
|
||||||
|
Utils.getAppointmentTransID(
|
||||||
|
appo.projectID, appo.clinicID, appo.appointmentNo),
|
||||||
|
AppGlobal.context)
|
||||||
|
.then((res) {
|
||||||
|
print("Printing Payment Status Reponse!!!!");
|
||||||
|
print(res);
|
||||||
|
String paymentInfo = res['Response_Message'];
|
||||||
|
if (paymentInfo == 'Success') {
|
||||||
|
createAdvancePayment(res, appo);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: res['Response_Message']);
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
print(err);
|
||||||
|
}).showProgressBar(
|
||||||
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
}
|
||||||
|
|
||||||
|
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
String paymentReference = res['Fort_id'].toString();
|
||||||
|
service
|
||||||
|
.createAdvancePayment(appo, res['Amount'], res['Fort_id'],
|
||||||
|
res['PaymentMethod'], AppGlobal.context)
|
||||||
|
.then((res) {
|
||||||
|
print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']);
|
||||||
|
addAdvancedNumberRequest(
|
||||||
|
res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
||||||
|
paymentReference,
|
||||||
|
appo.appointmentNo.toString(),
|
||||||
|
appo);
|
||||||
|
}).catchError((err) {
|
||||||
|
print(err);
|
||||||
|
}).showProgressBar(
|
||||||
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
}
|
||||||
|
|
||||||
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference,
|
||||||
|
String appointmentID, AppoitmentAllHistoryResultList appo) {
|
||||||
|
DoctorsListService service = new DoctorsListService();
|
||||||
|
service
|
||||||
|
.addAdvancedNumberRequest(
|
||||||
|
advanceNumber, paymentReference, appointmentID, AppGlobal.context)
|
||||||
|
.then((res) {
|
||||||
|
print(res);
|
||||||
|
navigateToHome(AppGlobal.context);
|
||||||
|
}).catchError((err) {
|
||||||
|
print(err);
|
||||||
|
}).showProgressBar(
|
||||||
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future navigateToHome(context) async {
|
||||||
|
Navigator.of(context).pushNamed(HOME);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,375 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||||
|
|
||||||
|
class ConfirmSMSDialog extends StatefulWidget {
|
||||||
|
final String phoneNumber;
|
||||||
|
final AdvanceModel advanceModel;
|
||||||
|
final PatientInfoAndMobileNumber patientInfoAndMobileNumber;
|
||||||
|
final String selectedPaymentMethod;
|
||||||
|
|
||||||
|
const ConfirmSMSDialog(
|
||||||
|
{Key key,
|
||||||
|
this.phoneNumber,
|
||||||
|
this.advanceModel,
|
||||||
|
this.selectedPaymentMethod,
|
||||||
|
this.patientInfoAndMobileNumber})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ConfirmSMSDialogState createState() => _ConfirmSMSDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ConfirmSMSDialogState extends State<ConfirmSMSDialog> {
|
||||||
|
final verifyAccountForm = GlobalKey<FormState>();
|
||||||
|
Map verifyAccountFormValue = {
|
||||||
|
'digit1': null,
|
||||||
|
'digit2': null,
|
||||||
|
'digit3': null,
|
||||||
|
'digit4': null,
|
||||||
|
};
|
||||||
|
|
||||||
|
TextEditingController digit1 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit2 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit3 = TextEditingController(text: "");
|
||||||
|
TextEditingController digit4 = TextEditingController(text: "");
|
||||||
|
|
||||||
|
String timerText = (TIMER_MIN - 1).toString() + ':59';
|
||||||
|
int min = TIMER_MIN - 1;
|
||||||
|
int sec = 59;
|
||||||
|
Timer _timer;
|
||||||
|
|
||||||
|
resendCode() {
|
||||||
|
min = TIMER_MIN - 1;
|
||||||
|
sec = 59;
|
||||||
|
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
||||||
|
if (min <= 0 && sec <= 0) {
|
||||||
|
timer.cancel();
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
sec = sec - 1;
|
||||||
|
if (sec == 0 && min == 0) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
min = 0;
|
||||||
|
sec = 0;
|
||||||
|
} else if (sec == 0) {
|
||||||
|
min = min - 1;
|
||||||
|
sec = 59;
|
||||||
|
}
|
||||||
|
timerText = min.toString() + ':' + sec.toString();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusNode focusD1;
|
||||||
|
FocusNode focusD2;
|
||||||
|
FocusNode focusD3;
|
||||||
|
FocusNode focusD4;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
resendCode();
|
||||||
|
focusD1 = FocusNode();
|
||||||
|
focusD2 = FocusNode();
|
||||||
|
focusD3 = FocusNode();
|
||||||
|
focusD4 = FocusNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<MyBalanceViewModel>(
|
||||||
|
builder: (_, model, w) => Dialog(
|
||||||
|
elevation: 0.6,
|
||||||
|
child: Container(
|
||||||
|
height: 520,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'SMS',
|
||||||
|
color: Colors.white,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
))),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => Navigator.pop(context),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle, color: Colors.white),
|
||||||
|
child: Icon(
|
||||||
|
Icons.clear,
|
||||||
|
color: Colors.grey[900],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/login/103.png',
|
||||||
|
height: MediaQuery.of(context).size.width * 0.25,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.25,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).pleaseEnterTheVerificationCode +
|
||||||
|
'[${widget.phoneNumber}]',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: verifyAccountForm,
|
||||||
|
child: Container(
|
||||||
|
width: SizeConfig.realScreenWidth * 0.90,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
focusNode: focusD1,
|
||||||
|
maxLength: 1,
|
||||||
|
controller: digit1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit1'] = val;
|
||||||
|
},
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD2);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD2,
|
||||||
|
controller: digit2,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit2'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD3);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD3);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD3,
|
||||||
|
controller: digit3,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit3'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD4);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(focusD4);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Container(
|
||||||
|
width: 65,
|
||||||
|
child: TextFormField(
|
||||||
|
focusNode: focusD4,
|
||||||
|
controller: digit4,
|
||||||
|
maxLength: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: buildInputDecoration(context),
|
||||||
|
validator: validateCodeDigit,
|
||||||
|
onSaved: (val) {
|
||||||
|
verifyAccountFormValue['digit4'] = val;
|
||||||
|
},
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(focusD4);
|
||||||
|
submit(model);
|
||||||
|
},
|
||||||
|
onChanged: (val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(focusD4);
|
||||||
|
submit(model);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
if (model.state == ViewState.ErrorLocal ||
|
||||||
|
model.state == ViewState.Error)
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 8, right: 8),
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: Texts(
|
||||||
|
model.error,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
// buildText(),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.theVerificationCodeExpiresIn +
|
||||||
|
' $timerText',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: SecondaryButton(
|
||||||
|
textColor: Colors.white,
|
||||||
|
label:
|
||||||
|
TranslationBase.of(context).submit.toUpperCase(),
|
||||||
|
onTap: () {
|
||||||
|
submit(model);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void submit(MyBalanceViewModel model) {
|
||||||
|
if (verifyAccountForm.currentState.validate()) {
|
||||||
|
final activationCode =
|
||||||
|
digit1.text + digit2.text + digit3.text + digit4.text;
|
||||||
|
model
|
||||||
|
.checkActivationCodeForAdvancePayment(activationCode: activationCode)
|
||||||
|
.then((value) {})
|
||||||
|
.showProgressBar(
|
||||||
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
|
||||||
|
.then((value) {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String validateCodeDigit(value) {
|
||||||
|
if (value.isEmpty) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDecoration buildInputDecoration(BuildContext context) {
|
||||||
|
return InputDecoration(
|
||||||
|
// ts/images/password_icon.png
|
||||||
|
contentPadding: EdgeInsets.only(top: 20, bottom: 20),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
borderSide: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).primaryColor),
|
||||||
|
),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
||||||
|
),
|
||||||
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5.0)),
|
||||||
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,177 @@
|
|||||||
|
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
//import '../advance_payment_page.dart';
|
||||||
|
|
||||||
|
class SelectBeneficiaryDialog extends StatefulWidget {
|
||||||
|
final BeneficiaryType beneficiaryType;
|
||||||
|
final Function(BeneficiaryType) onValueSelected;
|
||||||
|
|
||||||
|
SelectBeneficiaryDialog(
|
||||||
|
{Key key, this.beneficiaryType, this.onValueSelected});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectBeneficiaryDialogState createState() =>
|
||||||
|
_SelectBeneficiaryDialogState(this.beneficiaryType);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectBeneficiaryDialogState extends State<SelectBeneficiaryDialog> {
|
||||||
|
_SelectBeneficiaryDialogState(this.beneficiaryType);
|
||||||
|
|
||||||
|
BeneficiaryType beneficiaryType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = BeneficiaryType.MyAccount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(TranslationBase.of(context).myAccount),
|
||||||
|
leading: Radio(
|
||||||
|
value: BeneficiaryType.MyAccount,
|
||||||
|
groupValue: beneficiaryType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (BeneficiaryType value) {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = BeneficiaryType.MyFamilyFiles;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(TranslationBase.of(context).myFamilyFiles),
|
||||||
|
leading: Radio(
|
||||||
|
value: BeneficiaryType.MyFamilyFiles,
|
||||||
|
groupValue: beneficiaryType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (BeneficiaryType value) {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = BeneficiaryType.OtherAccount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(TranslationBase.of(context).otherAccount),
|
||||||
|
leading: Radio(
|
||||||
|
value: BeneficiaryType.OtherAccount,
|
||||||
|
groupValue: beneficiaryType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (BeneficiaryType value) {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(beneficiaryType);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,328 @@
|
|||||||
|
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class SelectBloodDialog extends StatefulWidget {
|
||||||
|
|
||||||
|
final Blood bloodType;
|
||||||
|
final Function(Blood) onValueSelected;
|
||||||
|
|
||||||
|
SelectBloodDialog({Key key, this.bloodType, this.onValueSelected});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectBloodDialogState createState() => _SelectBloodDialogState(this.bloodType);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectBloodDialogState extends State<SelectBloodDialog> {
|
||||||
|
_SelectBloodDialogState(this.bloodType);
|
||||||
|
Blood bloodType;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Oplus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("O+"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Oplus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Ominus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("O-"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Ominus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.ABminus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("AB-"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.ABminus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.ABplus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("AB+"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.ABplus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Aplus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("A+"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Aplus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Aminus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("A-"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Aminus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Bplus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("B+"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Bplus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bloodType = Blood.Bminus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("B-"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Blood.Bminus,
|
||||||
|
groupValue: bloodType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Blood value) {
|
||||||
|
setState(() {
|
||||||
|
bloodType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(bloodType);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,146 @@
|
|||||||
|
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SelectGenderDialog extends StatefulWidget {
|
||||||
|
final Gender beneficiaryType;
|
||||||
|
final Function(Gender) onValueSelected;
|
||||||
|
|
||||||
|
SelectGenderDialog({Key key, this.beneficiaryType, this.onValueSelected});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectGenderDialogState createState() =>
|
||||||
|
_SelectGenderDialogState(this.beneficiaryType);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectGenderDialogState extends State<SelectGenderDialog> {
|
||||||
|
_SelectGenderDialogState(this.beneficiaryType);
|
||||||
|
Gender beneficiaryType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = Gender.Male;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("Male"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Gender.Male,
|
||||||
|
groupValue: beneficiaryType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Gender value) {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = Gender.Female;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("Female"),
|
||||||
|
leading: Radio(
|
||||||
|
value: Gender.Female,
|
||||||
|
groupValue: beneficiaryType,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (Gender value) {
|
||||||
|
setState(() {
|
||||||
|
beneficiaryType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(beneficiaryType);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SelectHospitalDialog extends StatefulWidget {
|
||||||
|
final List<HospitalsModel> hospitals;
|
||||||
|
final Function(HospitalsModel) onValueSelected;
|
||||||
|
HospitalsModel selectedHospital;
|
||||||
|
|
||||||
|
SelectHospitalDialog(
|
||||||
|
{Key key, this.hospitals, this.onValueSelected, this.selectedHospital});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectHospitalDialogState createState() => _SelectHospitalDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectHospitalDialogState extends State<SelectHospitalDialog> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
...List.generate(
|
||||||
|
widget.hospitals.length,
|
||||||
|
(index) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedHospital = widget.hospitals[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(widget.hospitals[index].name +
|
||||||
|
' ${widget.hospitals[index].distanceInKilometers} KM'),
|
||||||
|
leading: Radio(
|
||||||
|
value: widget.hospitals[index],
|
||||||
|
groupValue: widget.selectedHospital,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedHospital = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(widget.selectedHospital);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SelectPatientFamilyDialog extends StatefulWidget {
|
||||||
|
final List<GetAllSharedRecordsByStatusList> getAllSharedRecordsByStatusList;
|
||||||
|
final Function(GetAllSharedRecordsByStatusList) onValueSelected;
|
||||||
|
GetAllSharedRecordsByStatusList selectedPatientFamily;
|
||||||
|
|
||||||
|
SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected,this.selectedPatientFamily});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectPatientFamilyDialogState extends State<SelectPatientFamilyDialog> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.selectedPatientFamily = widget.selectedPatientFamily?? widget.getAllSharedRecordsByStatusList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
...List.generate(
|
||||||
|
widget.getAllSharedRecordsByStatusList.length,
|
||||||
|
(index) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusList[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(widget.getAllSharedRecordsByStatusList[index].patientName),
|
||||||
|
leading: Radio(
|
||||||
|
value: widget.getAllSharedRecordsByStatusList[index],
|
||||||
|
groupValue: widget.selectedPatientFamily,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedPatientFamily = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(widget.selectedPatientFamily);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SelectPatientInfoDialog extends StatefulWidget {
|
||||||
|
final List<PatientInfo> patientInfoList ;
|
||||||
|
final Function(PatientInfo) onValueSelected;
|
||||||
|
PatientInfo selectedPatientInfo;
|
||||||
|
|
||||||
|
SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectPatientInfoDialogState extends State<SelectPatientInfoDialog> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.selectedPatientInfo = widget.selectedPatientInfo?? widget.patientInfoList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
...List.generate(
|
||||||
|
widget.patientInfoList.length,
|
||||||
|
(index) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedPatientInfo = widget.patientInfoList[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(widget.patientInfoList[index].fullName),
|
||||||
|
leading: Radio(
|
||||||
|
value: widget.patientInfoList[index],
|
||||||
|
groupValue: widget.selectedPatientInfo,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedPatientInfo = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(widget.selectedPatientInfo);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
import 'advance_payment_page.dart';
|
||||||
|
import 'blood_donation.dart';
|
||||||
|
|
||||||
|
class MyBalancePage extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<MyBalanceViewModel>(
|
||||||
|
onModelReady: (model) => model.getPatientAdvanceBalanceAmount(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
baseViewModel: model,
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: TranslationBase.of(context).myBalances,
|
||||||
|
body: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Texts(
|
||||||
|
TranslationBase.of(context).balanceAmount,
|
||||||
|
color: Colors.black,
|
||||||
|
bold: true,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#B61422'),
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(
|
||||||
|
TranslationBase.of(context).totalBalance,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
Texts(
|
||||||
|
'${model.totalAdvanceBalanceAmount ?? 0} SAR',
|
||||||
|
color: Colors.white,
|
||||||
|
bold: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 9,
|
||||||
|
),
|
||||||
|
...List.generate(
|
||||||
|
model.patientAdvanceBalanceAmountList.length,
|
||||||
|
(index) => Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
height: 65,
|
||||||
|
margin: EdgeInsets.only(top: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(model.patientAdvanceBalanceAmountList[index]
|
||||||
|
.projectDescription),
|
||||||
|
Texts(
|
||||||
|
'${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} SAR',
|
||||||
|
bold: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
width: double.infinity,
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
child: SecondaryButton(
|
||||||
|
// color: Colors.grey[900],
|
||||||
|
textColor: Colors.white,
|
||||||
|
label: TranslationBase.of(context).createAdvancedPayment,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context,
|
||||||
|
//FadePage(page: AdvancePaymentPage()));
|
||||||
|
FadePage(page: BloodDonationPage()));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,239 @@
|
|||||||
|
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
class NumberTextInputFormatter extends TextInputFormatter {
|
||||||
|
@override
|
||||||
|
TextEditingValue formatEditUpdate(
|
||||||
|
TextEditingValue oldValue, TextEditingValue newValue) {
|
||||||
|
final int newTextLength = newValue.text.length;
|
||||||
|
int selectionIndex = newValue.selection.end;
|
||||||
|
int usedSubstringIndex = 0;
|
||||||
|
final StringBuffer newText = StringBuffer();
|
||||||
|
if (newTextLength >= 1) {
|
||||||
|
newText.write('(');
|
||||||
|
if (newValue.selection.end >= 1) selectionIndex++;
|
||||||
|
}
|
||||||
|
if (newTextLength >= 4) {
|
||||||
|
newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') ');
|
||||||
|
if (newValue.selection.end >= 3) selectionIndex += 2;
|
||||||
|
}
|
||||||
|
if (newTextLength >= 7) {
|
||||||
|
newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-');
|
||||||
|
if (newValue.selection.end >= 6) selectionIndex++;
|
||||||
|
}
|
||||||
|
if (newTextLength >= 11) {
|
||||||
|
newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' ');
|
||||||
|
if (newValue.selection.end >= 10) selectionIndex++;
|
||||||
|
}
|
||||||
|
// Dump the rest.
|
||||||
|
if (newTextLength >= usedSubstringIndex)
|
||||||
|
newText.write(newValue.text.substring(usedSubstringIndex));
|
||||||
|
return TextEditingValue(
|
||||||
|
text: newText.toString(),
|
||||||
|
selection: TextSelection.collapsed(offset: selectionIndex),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final _mobileFormatter = NumberTextInputFormatter();
|
||||||
|
|
||||||
|
class NewTextFields extends StatefulWidget {
|
||||||
|
NewTextFields(
|
||||||
|
{Key key,
|
||||||
|
this.type,
|
||||||
|
this.hintText,
|
||||||
|
this.suffixIcon,
|
||||||
|
this.autoFocus,
|
||||||
|
this.onChanged,
|
||||||
|
this.initialValue,
|
||||||
|
this.minLines,
|
||||||
|
this.maxLines,
|
||||||
|
this.inputFormatters,
|
||||||
|
this.padding,
|
||||||
|
this.focus = false,
|
||||||
|
this.maxLengthEnforced = true,
|
||||||
|
this.suffixIconColor,
|
||||||
|
this.inputAction,
|
||||||
|
this.onSubmit,
|
||||||
|
this.keepPadding = true,
|
||||||
|
this.textCapitalization = TextCapitalization.none,
|
||||||
|
this.controller,
|
||||||
|
this.keyboardType,
|
||||||
|
this.validator,
|
||||||
|
this.borderOnlyError = false,
|
||||||
|
this.onSaved,
|
||||||
|
this.onSuffixTap,
|
||||||
|
this.readOnly: false,
|
||||||
|
this.maxLength,
|
||||||
|
this.prefixIcon,
|
||||||
|
this.bare = false,
|
||||||
|
this.onTap,
|
||||||
|
this.fontSize = 16.0,
|
||||||
|
this.fontWeight = FontWeight.w700,
|
||||||
|
this.autoValidate = false,
|
||||||
|
this.hintColor,this.isEnabled=true})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
final String hintText;
|
||||||
|
|
||||||
|
// final String initialValue;
|
||||||
|
final String type;
|
||||||
|
final bool autoFocus;
|
||||||
|
final IconData suffixIcon;
|
||||||
|
final Color suffixIconColor;
|
||||||
|
final Icon prefixIcon;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
final TextEditingController controller;
|
||||||
|
final TextInputType keyboardType;
|
||||||
|
final FormFieldValidator validator;
|
||||||
|
final Function onSaved;
|
||||||
|
final Function onSuffixTap;
|
||||||
|
final Function onChanged;
|
||||||
|
final Function onSubmit;
|
||||||
|
final bool readOnly;
|
||||||
|
final int maxLength;
|
||||||
|
final int minLines;
|
||||||
|
final int maxLines;
|
||||||
|
final bool maxLengthEnforced;
|
||||||
|
final bool bare;
|
||||||
|
final bool isEnabled;
|
||||||
|
final TextInputAction inputAction;
|
||||||
|
final double fontSize;
|
||||||
|
final FontWeight fontWeight;
|
||||||
|
final bool keepPadding;
|
||||||
|
final TextCapitalization textCapitalization;
|
||||||
|
final List<TextInputFormatter> inputFormatters;
|
||||||
|
final bool autoValidate;
|
||||||
|
final EdgeInsets padding;
|
||||||
|
final bool focus;
|
||||||
|
final bool borderOnlyError;
|
||||||
|
final Color hintColor;
|
||||||
|
final String initialValue;
|
||||||
|
@override
|
||||||
|
_NewTextFieldsState createState() => _NewTextFieldsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NewTextFieldsState extends State<NewTextFields> {
|
||||||
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
bool focus = false;
|
||||||
|
bool view = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_focusNode.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
focus = _focusNode.hasFocus;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didUpdateWidget(NewTextFields oldWidget) {
|
||||||
|
if (widget.focus) _focusNode.requestFocus();
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_focusNode.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool _determineReadOnly() {
|
||||||
|
if (widget.readOnly != null && widget.readOnly) {
|
||||||
|
_focusNode.unfocus();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
decoration:BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(top: 8),
|
||||||
|
|
||||||
|
child: TextFormField(
|
||||||
|
enabled: widget.isEnabled,
|
||||||
|
initialValue: widget.initialValue,
|
||||||
|
keyboardAppearance: Theme.of(context).brightness,
|
||||||
|
scrollPhysics: BouncingScrollPhysics(),
|
||||||
|
autovalidate: widget.autoValidate,
|
||||||
|
textCapitalization: widget.textCapitalization,
|
||||||
|
onFieldSubmitted: widget.inputAction == TextInputAction.next
|
||||||
|
? (widget.onSubmit != null
|
||||||
|
? widget.onSubmit
|
||||||
|
: (val) {
|
||||||
|
_focusNode.nextFocus();
|
||||||
|
})
|
||||||
|
: widget.onSubmit,
|
||||||
|
textInputAction: widget.inputAction,
|
||||||
|
minLines: widget.minLines ?? 1,
|
||||||
|
maxLines: widget.maxLines ?? 1,
|
||||||
|
maxLengthEnforced: widget.maxLengthEnforced,
|
||||||
|
onChanged: widget.onChanged,
|
||||||
|
focusNode: _focusNode,
|
||||||
|
maxLength: widget.maxLength ?? null,
|
||||||
|
controller: widget.controller,
|
||||||
|
keyboardType: widget.keyboardType,
|
||||||
|
readOnly: _determineReadOnly(),
|
||||||
|
obscureText: widget.type == "password" && !view ? true : false,
|
||||||
|
autofocus: widget.autoFocus ?? false,
|
||||||
|
validator: widget.validator,
|
||||||
|
onSaved: widget.onSaved,
|
||||||
|
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.body2
|
||||||
|
.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight),
|
||||||
|
inputFormatters: widget.keyboardType == TextInputType.phone
|
||||||
|
? <TextInputFormatter>[
|
||||||
|
WhitelistingTextInputFormatter.digitsOnly,
|
||||||
|
_mobileFormatter,
|
||||||
|
]
|
||||||
|
: widget.inputFormatters,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: widget.hintText,
|
||||||
|
labelStyle: TextStyle(color: Colors.black),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.errorColor
|
||||||
|
.withOpacity(0.5),
|
||||||
|
width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(12.0)),
|
||||||
|
focusedErrorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.errorColor
|
||||||
|
.withOpacity(0.5),
|
||||||
|
width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(8.0)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Colors.white, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Colors.white, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Colors.white, width: 1.0),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SelectCiteisDialog extends StatefulWidget {
|
||||||
|
final List<CitiesModel> hospitals;
|
||||||
|
final Function(CitiesModel) onValueSelected;
|
||||||
|
CitiesModel selectedHospital;
|
||||||
|
|
||||||
|
SelectCiteisDialog(
|
||||||
|
{Key key, this.hospitals, this.onValueSelected, this.selectedHospital});
|
||||||
|
@override
|
||||||
|
_SelectCiteisDialogState createState() => _SelectCiteisDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectCiteisDialogState extends State<SelectCiteisDialog> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
...List.generate(
|
||||||
|
widget.hospitals.length,
|
||||||
|
(index) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedHospital = widget.hospitals[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
// title: Text(widget.hospitals[index].description +
|
||||||
|
// ' ${widget.hospitals[index].distanceInKilometers} KM'),
|
||||||
|
title: Text(widget.hospitals[index].description),
|
||||||
|
leading: Radio(
|
||||||
|
value: widget.hospitals[index],
|
||||||
|
groupValue: widget.selectedHospital,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedHospital = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).cancel.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(widget.selectedHospital);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue