Appointment Queue implemented, Blood Donation implementation contd.
parent
634a138c7f
commit
e72e67d9bf
@ -0,0 +1,3 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="mapbox_access_token" translatable="false" tools:ignore="UnusedResources">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
|
||||
</resources>
|
||||
@ -0,0 +1,4 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="40" height="40" rx="10" fill="#EFEFF0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.25 20C9.25 25.928 14.072 30.75 20 30.75C25.928 30.75 30.75 25.928 30.75 20C30.75 14.0721 25.9282 9.25021 20.0004 9.25C14.0724 9.25 9.25 14.072 9.25 20ZM28.9732 17.75C29.154 18.4705 29.25 19.2243 29.25 20C29.25 20.7757 29.154 21.5295 28.9732 22.25H24.5746C24.687 21.5359 24.751 20.7846 24.751 19.9997C24.751 19.2151 24.687 18.464 24.5747 17.75H28.9732ZM28.4553 16.25H24.2585C23.6395 13.9132 22.5564 12.0788 21.7158 10.9096C24.7331 11.4779 27.2382 13.5166 28.4553 16.25ZM23.049 17.75C23.1761 18.4613 23.25 19.213 23.25 19.9997C23.25 20.7866 23.1761 21.5386 23.049 22.25H16.9511C16.8239 21.5386 16.75 20.7866 16.75 19.9997C16.75 19.2131 16.8239 18.4613 16.9509 17.75H23.049ZM17.309 16.25H22.6909C21.966 13.828 20.7108 12.0282 20 11.1427C19.2892 12.0276 18.0339 13.8277 17.309 16.25ZM15.4263 17.75C15.314 18.464 15.25 19.2151 15.25 19.9997C15.25 20.7846 15.3141 21.5359 15.4264 22.25H11.0268C10.846 21.5295 10.75 20.7757 10.75 20C10.75 19.2243 10.846 18.4705 11.0268 17.75H15.4263ZM11.5447 16.25H15.7424C16.3613 13.9131 17.4442 12.0786 18.2848 10.9094C15.2672 11.4776 12.7619 13.5164 11.5447 16.25ZM21.7159 29.0904C24.7331 28.522 27.2382 26.4834 28.4553 23.75H24.2584C23.6395 26.0869 22.5565 27.9213 21.7159 29.0904ZM20 28.8568C20.7107 27.9719 21.9659 26.1721 22.6908 23.75H17.3093C18.0342 26.1717 19.2893 27.9713 20 28.8568ZM18.2858 29.0907C17.4451 27.9217 16.3618 26.0871 15.7427 23.75H11.5447C12.7621 26.4839 15.2678 28.5228 18.2858 29.0907Z" fill="#8F9AA3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,95 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:hmg_patient_app_new/core/api/api_client.dart';
|
||||
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
||||
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/cities_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class BloodDonationRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<CitiesModel>>>> getAllCities();
|
||||
|
||||
Future<Either<Failure, GenericApiModel<List_BloodGroupDetailsModel>>> getPatientBloodGroupDetails();
|
||||
}
|
||||
|
||||
class BloodDonationRepoImp implements BloodDonationRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
BloodDonationRepoImp({required this.loggerService, required this.apiClient});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<CitiesModel>>>> getAllCities() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<CitiesModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_CITIES_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['ListCities'];
|
||||
final citiesList = list.map((item) => CitiesModel.fromJson(item as Map<String, dynamic>)).toList().cast<CitiesModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<CitiesModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: citiesList,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List_BloodGroupDetailsModel>>> getPatientBloodGroupDetails() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List_BloodGroupDetailsModel>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_BLOOD_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['List_BloodGroupDetails'][0];
|
||||
final patientBloodGroup = List_BloodGroupDetailsModel.fromJson(list);
|
||||
|
||||
apiResponse = GenericApiModel<List_BloodGroupDetailsModel>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: patientBloodGroup,
|
||||
);
|
||||
} catch (e) {
|
||||
failure = DataParsingFailure(e.toString());
|
||||
}
|
||||
},
|
||||
);
|
||||
if (failure != null) return Left(failure!);
|
||||
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
|
||||
return Right(apiResponse!);
|
||||
} catch (e) {
|
||||
return Left(UnknownFailure(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_list_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/cities_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
|
||||
class BloodDonationViewModel extends ChangeNotifier {
|
||||
final DialogService dialogService;
|
||||
BloodDonationRepo bloodDonationRepo;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
final NavigationService navigationService;
|
||||
final AppState appState;
|
||||
|
||||
List<CitiesModel> citiesList = [];
|
||||
List<BloodGroupListModel> bloodGroupList = [
|
||||
BloodGroupListModel("O+", 0),
|
||||
BloodGroupListModel("O-", 1),
|
||||
BloodGroupListModel("AB+", 2),
|
||||
BloodGroupListModel("AB-", 3),
|
||||
BloodGroupListModel("A+", 4),
|
||||
BloodGroupListModel("A-", 5),
|
||||
BloodGroupListModel("B+", 6),
|
||||
BloodGroupListModel("B-", 7),
|
||||
];
|
||||
|
||||
late CitiesModel selectedCity;
|
||||
late BloodGroupListModel selectedBloodGroup;
|
||||
int _selectedHospitalIndex = 0;
|
||||
int _selectedBloodTypeIndex = 0;
|
||||
String _selectedBloodType = '';
|
||||
|
||||
List_BloodGroupDetailsModel patientBloodGroupDetailsModel = List_BloodGroupDetailsModel();
|
||||
|
||||
BloodDonationViewModel({required this.bloodDonationRepo, required this.errorHandlerService, required this.navigationService, required this.dialogService, required this.appState});
|
||||
|
||||
setSelectedCity(CitiesModel city) {
|
||||
selectedCity = city;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getRegionSelectedClinics({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
citiesList.clear();
|
||||
selectedCity = CitiesModel();
|
||||
notifyListeners();
|
||||
final result = await bloodDonationRepo.getAllCities();
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
onError!(failure.message);
|
||||
},
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
onError!(apiResponse.errorMessage ?? 'An unexpected error occurred');
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
citiesList = apiResponse.data!;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> getPatientBloodGroupDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
final result = await bloodDonationRepo.getPatientBloodGroupDetails();
|
||||
|
||||
result.fold(
|
||||
(failure) async {
|
||||
onError!(failure.message);
|
||||
},
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
onError!(apiResponse.errorMessage ?? 'An unexpected error occurred');
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
patientBloodGroupDetailsModel = apiResponse.data!;
|
||||
|
||||
CitiesModel citiesModel = CitiesModel();
|
||||
citiesModel.iD = getSelectedCityID();
|
||||
_selectedHospitalIndex = (citiesModel.iD! - 1);
|
||||
citiesModel.description = citiesList[_selectedHospitalIndex].description;
|
||||
citiesModel.descriptionN = citiesList[_selectedHospitalIndex].descriptionN;
|
||||
selectedCity = citiesModel;
|
||||
_selectedBloodType = patientBloodGroupDetailsModel.bloodGroup!;
|
||||
_selectedBloodTypeIndex = getBloodIndex(_selectedBloodType);
|
||||
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
int getSelectedCityID() {
|
||||
int cityID = 1;
|
||||
citiesList.forEach((element) {
|
||||
if (element.description == patientBloodGroupDetailsModel.city) {
|
||||
cityID = element.iD!;
|
||||
}
|
||||
});
|
||||
return cityID;
|
||||
}
|
||||
|
||||
int getBloodIndex(String type) {
|
||||
switch (type) {
|
||||
case "O+":
|
||||
return 0;
|
||||
case "O-":
|
||||
return 1;
|
||||
case "AB+":
|
||||
return 2;
|
||||
case "AB-":
|
||||
return 3;
|
||||
case "A+":
|
||||
return 4;
|
||||
case "A-":
|
||||
return 5;
|
||||
case "B+":
|
||||
return 6;
|
||||
case "B-":
|
||||
return 7;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
class BloodGroupListModel {
|
||||
String name;
|
||||
int value;
|
||||
|
||||
BloodGroupListModel(this.name, this.value);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
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;
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
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'];
|
||||
}
|
||||
|
||||
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;
|
||||
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,172 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/blood_donation/widgets/select_city_widget.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class BloodDonationPage extends StatelessWidget {
|
||||
BloodDonationPage({super.key});
|
||||
|
||||
late AppState appState;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: Consumer<BloodDonationViewModel>(builder: (context, bloodDonationVM, child) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CollapsingListView(
|
||||
title: LocaleKeys.bloodDonation.tr(),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24.r,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.select_city_icon, width: 40.h, height: 40.h),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.city.tr().toText16(color: AppColors.textColor, weight: FontWeight.w500),
|
||||
(appState.isArabic()
|
||||
? (bloodDonationVM.selectedCity.descriptionN ?? LocaleKeys.select.tr())
|
||||
: bloodDonationVM.selectedCity.description ?? LocaleKeys.select.tr(context: context))
|
||||
.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down, width: 25.h, height: 25.h),
|
||||
],
|
||||
).onPress(() async {
|
||||
LoaderBottomSheet.showLoader(loadingText: "Fetching Cities...");
|
||||
await bloodDonationVM.getRegionSelectedClinics(onSuccess: (val) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
showCommonBottomSheetWithoutHeight(context,
|
||||
title: LocaleKeys.selectCity.tr(context: context),
|
||||
isDismissible: true,
|
||||
child: SelectCityWidget(
|
||||
bloodDonationViewModel: bloodDonationVM,
|
||||
),
|
||||
callBackFunc: () {});
|
||||
}, onError: (err) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 16.h),
|
||||
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 1.h),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.my_account_icon, width: 40.h, height: 40.h),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.gender.tr().toText16(color: AppColors.textColor, weight: FontWeight.w500),
|
||||
"Male".toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down, width: 25.h, height: 25.h),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 1.h),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.my_account_icon, width: 40.h, height: 40.h),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.bloodType.tr().toText16(color: AppColors.textColor, weight: FontWeight.w500),
|
||||
"AB+".toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down, width: 25.h, height: 25.h),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24.r,
|
||||
hasShadow: true,
|
||||
),
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CustomButton(
|
||||
text: LocaleKeys.save.tr(),
|
||||
onPressed: () {
|
||||
// openDoctorScheduleCalendar();
|
||||
},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
fontSize: 16.f,
|
||||
fontWeight: FontWeight.w500,
|
||||
borderRadius: 12.r,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||||
height: 50.h,
|
||||
iconSize: 18.h,
|
||||
).paddingSymmetrical(16.h, 24.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/models/cities_model.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
|
||||
class CityListItem extends StatelessWidget {
|
||||
final CitiesModel cityModel;
|
||||
|
||||
late AppState appState;
|
||||
|
||||
CityListItem({super.key, required this.cityModel});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
return DecoratedBox(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.h,
|
||||
children: [hospitalName],
|
||||
),
|
||||
),
|
||||
Transform.flip(
|
||||
flipX: appState.isArabic(),
|
||||
child: Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 40.h,
|
||||
height: 40.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
);
|
||||
}
|
||||
|
||||
Widget get hospitalName => Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: (appState.isArabic() ? cityModel.descriptionN : cityModel.description)!.toText16(color: AppColors.textColor, isBold: true),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/blood_donation/blood_donation_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/blood_donation/widgets/city_list_item.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
|
||||
class SelectCityWidget extends StatelessWidget {
|
||||
SelectCityWidget({super.key, required this.bloodDonationViewModel});
|
||||
|
||||
BloodDonationViewModel bloodDonationViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 8.h),
|
||||
SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height * .4,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (_, index) {
|
||||
return CityListItem(
|
||||
cityModel: bloodDonationViewModel.citiesList[index],
|
||||
).onPress(() {
|
||||
bloodDonationViewModel.setSelectedCity(bloodDonationViewModel.citiesList[index]);
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
},
|
||||
separatorBuilder: (_, __) => SizedBox(
|
||||
height: 8.h,
|
||||
),
|
||||
itemCount: bloodDonationViewModel.citiesList.length),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue