commit
21f5067ea4
@ -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/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_patient_ic_projects.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
|
||||
abstract class ContactUsRepo {
|
||||
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations();
|
||||
|
||||
Future<Either<Failure, GenericApiModel<List<GetPatientICProjectsModel>>>> getLiveChatProjectsList();
|
||||
}
|
||||
|
||||
class ContactUsRepoImp implements ContactUsRepo {
|
||||
final ApiClient apiClient;
|
||||
final LoggerService loggerService;
|
||||
|
||||
ContactUsRepoImp({required this.apiClient, required this.loggerService});
|
||||
|
||||
@override
|
||||
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<GetHMGLocationsModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_FINDUS_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['ListHMGLocation'];
|
||||
final hmgLocations = list.map((item) => GetHMGLocationsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetHMGLocationsModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<GetHMGLocationsModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: hmgLocations,
|
||||
);
|
||||
} 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<GetPatientICProjectsModel>>>> getLiveChatProjectsList() async {
|
||||
Map<String, dynamic> mapDevice = {};
|
||||
|
||||
try {
|
||||
GenericApiModel<List<GetPatientICProjectsModel>>? apiResponse;
|
||||
Failure? failure;
|
||||
await apiClient.post(
|
||||
GET_LIVECHAT_REQUEST,
|
||||
body: mapDevice,
|
||||
onFailure: (error, statusCode, {messageStatus, failureType}) {
|
||||
failure = failureType;
|
||||
},
|
||||
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
|
||||
try {
|
||||
final list = response['List_PatientICProjects'];
|
||||
final hmgLocations = list.map((item) => GetPatientICProjectsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetPatientICProjectsModel>();
|
||||
|
||||
apiResponse = GenericApiModel<List<GetPatientICProjectsModel>>(
|
||||
messageStatus: messageStatus,
|
||||
statusCode: statusCode,
|
||||
errorMessage: null,
|
||||
data: hmgLocations,
|
||||
);
|
||||
} 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,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/contact_us_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class ContactUsViewModel extends ChangeNotifier {
|
||||
ContactUsRepo contactUsRepo;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
AppState appState;
|
||||
|
||||
bool isHMGLocationsListLoading = false;
|
||||
bool isHMGHospitalsListSelected = true;
|
||||
|
||||
List<GetHMGLocationsModel> hmgHospitalsLocationsList = [];
|
||||
List<GetHMGLocationsModel> hmgPharmacyLocationsList = [];
|
||||
|
||||
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
|
||||
|
||||
initContactUsViewModel() {
|
||||
isHMGLocationsListLoading = true;
|
||||
isHMGHospitalsListSelected = true;
|
||||
hmgHospitalsLocationsList.clear();
|
||||
hmgPharmacyLocationsList.clear();
|
||||
getHMGLocations();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setHMGHospitalsListSelected(bool isSelected) {
|
||||
isHMGHospitalsListSelected = isSelected;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> getHMGLocations({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
isHMGLocationsListLoading = true;
|
||||
hmgHospitalsLocationsList.clear();
|
||||
hmgPharmacyLocationsList.clear();
|
||||
notifyListeners();
|
||||
|
||||
final result = await contactUsRepo.getHMGLocations();
|
||||
|
||||
result.fold(
|
||||
(failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
// hmgLocationsList = apiResponse.data!;
|
||||
for (var location in apiResponse.data!) {
|
||||
if (location.locationType == 1) {
|
||||
hmgHospitalsLocationsList.add(location);
|
||||
} else if (location.locationType == 2) {
|
||||
hmgPharmacyLocationsList.add(location);
|
||||
}
|
||||
}
|
||||
isHMGLocationsListLoading = false;
|
||||
notifyListeners();
|
||||
if (onSuccess != null) {
|
||||
onSuccess(apiResponse);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
class GetHMGLocationsModel {
|
||||
dynamic cityID;
|
||||
String? cityName;
|
||||
dynamic cityNameN;
|
||||
dynamic distanceInKilometers;
|
||||
bool? isActive;
|
||||
String? latitude;
|
||||
int? locationID;
|
||||
String? locationName;
|
||||
dynamic locationNameN;
|
||||
dynamic locationType;
|
||||
String? longitude;
|
||||
int? pharmacyLocationID;
|
||||
String? phoneNumber;
|
||||
int? projectID;
|
||||
String? projectImageURL;
|
||||
int? setupID;
|
||||
dynamic sortOrder;
|
||||
|
||||
GetHMGLocationsModel(
|
||||
{this.cityID,
|
||||
this.cityName,
|
||||
this.cityNameN,
|
||||
this.distanceInKilometers,
|
||||
this.isActive,
|
||||
this.latitude,
|
||||
this.locationID,
|
||||
this.locationName,
|
||||
this.locationNameN,
|
||||
this.locationType,
|
||||
this.longitude,
|
||||
this.pharmacyLocationID,
|
||||
this.phoneNumber,
|
||||
this.projectID,
|
||||
this.projectImageURL,
|
||||
this.setupID,
|
||||
this.sortOrder});
|
||||
|
||||
GetHMGLocationsModel.fromJson(Map<String, dynamic> json) {
|
||||
cityID = json['CityID'];
|
||||
cityName = json['CityName'];
|
||||
cityNameN = json['CityNameN'];
|
||||
distanceInKilometers = json['DistanceInKilometers'];
|
||||
isActive = json['IsActive'];
|
||||
latitude = json['Latitude'];
|
||||
locationID = json['LocationID'];
|
||||
locationName = json['LocationName'];
|
||||
locationNameN = json['LocationNameN'];
|
||||
locationType = json['LocationType'];
|
||||
longitude = json['Longitude'];
|
||||
pharmacyLocationID = json['PharmacyLocationID'];
|
||||
phoneNumber = json['PhoneNumber'];
|
||||
projectID = json['ProjectID'];
|
||||
projectImageURL = json['ProjectImageURL'];
|
||||
setupID = json['SetupID'];
|
||||
sortOrder = json['SortOrder'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['CityID'] = this.cityID;
|
||||
data['CityName'] = this.cityName;
|
||||
data['CityNameN'] = this.cityNameN;
|
||||
data['DistanceInKilometers'] = this.distanceInKilometers;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['Latitude'] = this.latitude;
|
||||
data['LocationID'] = this.locationID;
|
||||
data['LocationName'] = this.locationName;
|
||||
data['LocationNameN'] = this.locationNameN;
|
||||
data['LocationType'] = this.locationType;
|
||||
data['Longitude'] = this.longitude;
|
||||
data['PharmacyLocationID'] = this.pharmacyLocationID;
|
||||
data['PhoneNumber'] = this.phoneNumber;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ProjectImageURL'] = this.projectImageURL;
|
||||
data['SetupID'] = this.setupID;
|
||||
data['SortOrder'] = this.sortOrder;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
|
||||
class GetPatientICProjectsModel {
|
||||
int? id;
|
||||
String? projectName;
|
||||
String? projectNameN;
|
||||
String? value;
|
||||
dynamic languageId;
|
||||
DateTime? createdOn;
|
||||
String? createdBy;
|
||||
dynamic editedOn;
|
||||
dynamic editedBy;
|
||||
bool? isActive;
|
||||
dynamic distanceInKilometers;
|
||||
|
||||
GetPatientICProjectsModel(
|
||||
{this.id, this.projectName, this.projectNameN, this.value, this.languageId, this.createdOn, this.createdBy, this.editedOn, this.editedBy, this.distanceInKilometers, this.isActive});
|
||||
|
||||
GetPatientICProjectsModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
projectName = json['ProjectName'];
|
||||
projectNameN = json['ProjectNameN'];
|
||||
value = json['Value'];
|
||||
languageId = json['LanguageId'];
|
||||
createdOn = DateUtil.convertStringToDate(json['CreatedOn']);
|
||||
createdBy = json['CreatedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
isActive = json['IsActive'];
|
||||
distanceInKilometers = json['DistanceInKilometers'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['ProjectNameN'] = this.projectNameN;
|
||||
data['Value'] = this.value;
|
||||
data['LanguageId'] = this.languageId;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['DistanceInKilometers'] = this.distanceInKilometers;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
class AskDocRequestType {
|
||||
String? setupID;
|
||||
int? parameterGroup;
|
||||
int? parameterType;
|
||||
int? parameterCode;
|
||||
String? description;
|
||||
String? descriptionN;
|
||||
String? alias;
|
||||
String? aliasN;
|
||||
String? prefix;
|
||||
String? suffix;
|
||||
String? isColorCodingRequired;
|
||||
String? backColor;
|
||||
String? foreColor;
|
||||
bool? isBuiltIn;
|
||||
bool? isActive;
|
||||
int? createdBy;
|
||||
String? createdOn;
|
||||
String? editedBy;
|
||||
String? editedOn;
|
||||
String? rowVer;
|
||||
|
||||
AskDocRequestType(
|
||||
{this.setupID,
|
||||
this.parameterGroup,
|
||||
this.parameterType,
|
||||
this.parameterCode,
|
||||
this.description,
|
||||
this.descriptionN,
|
||||
this.alias,
|
||||
this.aliasN,
|
||||
this.prefix,
|
||||
this.suffix,
|
||||
this.isColorCodingRequired,
|
||||
this.backColor,
|
||||
this.foreColor,
|
||||
this.isBuiltIn,
|
||||
this.isActive,
|
||||
this.createdBy,
|
||||
this.createdOn,
|
||||
this.editedBy,
|
||||
this.editedOn,
|
||||
this.rowVer});
|
||||
|
||||
AskDocRequestType.fromJson(Map<String, dynamic> json) {
|
||||
setupID = json['SetupID'];
|
||||
parameterGroup = json['ParameterGroup'];
|
||||
parameterType = json['ParameterType'];
|
||||
parameterCode = json['ParameterCode'];
|
||||
description = json['Description'];
|
||||
descriptionN = json['DescriptionN'];
|
||||
alias = json['Alias'];
|
||||
aliasN = json['AliasN'];
|
||||
prefix = json['Prefix'];
|
||||
suffix = json['Suffix'];
|
||||
isColorCodingRequired = json['IsColorCodingRequired'];
|
||||
backColor = json['BackColor'];
|
||||
foreColor = json['ForeColor'];
|
||||
isBuiltIn = json['IsBuiltIn'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedOn = json['EditedOn'];
|
||||
rowVer = json['RowVer'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['SetupID'] = this.setupID;
|
||||
data['ParameterGroup'] = this.parameterGroup;
|
||||
data['ParameterType'] = this.parameterType;
|
||||
data['ParameterCode'] = this.parameterCode;
|
||||
data['Description'] = this.description;
|
||||
data['DescriptionN'] = this.descriptionN;
|
||||
data['Alias'] = this.alias;
|
||||
data['AliasN'] = this.aliasN;
|
||||
data['Prefix'] = this.prefix;
|
||||
data['Suffix'] = this.suffix;
|
||||
data['IsColorCodingRequired'] = this.isColorCodingRequired;
|
||||
data['BackColor'] = this.backColor;
|
||||
data['ForeColor'] = this.foreColor;
|
||||
data['IsBuiltIn'] = this.isBuiltIn;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedOn'] = this.editedOn;
|
||||
data['RowVer'] = this.rowVer;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
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/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/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.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';
|
||||
|
||||
class AskDoctorRequestTypeSelect extends StatelessWidget {
|
||||
AskDoctorRequestTypeSelect({super.key, required this.askDoctorRequestTypeList, required this.myAppointmentsViewModel, required this.patientAppointmentHistoryResponseModel});
|
||||
|
||||
final MyAppointmentsViewModel myAppointmentsViewModel;
|
||||
final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
|
||||
List<AskDocRequestType> askDoctorRequestTypeList = [];
|
||||
int selectedParameterCodeValue = 2;
|
||||
int selectedParameterCode = 0;
|
||||
|
||||
final ValueNotifier<int> requestTypeSelectNotifier = ValueNotifier<int>(0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
|
||||
child: ListView.builder(
|
||||
itemCount: askDoctorRequestTypeList.length,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: requestTypeSelectNotifier,
|
||||
builder: (context, duration, child) {
|
||||
return Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
listTileTheme: ListTileThemeData(horizontalTitleGap: 4),
|
||||
),
|
||||
child: RadioListTile<int>(
|
||||
title: (askDoctorRequestTypeList[index].description ?? '').toText14(weight: FontWeight.w500),
|
||||
value: index,
|
||||
fillColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return AppColors.primaryRedColor;
|
||||
}
|
||||
return Color(0xffEEEEEE);
|
||||
}),
|
||||
contentPadding: EdgeInsets.only(left: 12.h, right: 12.h),
|
||||
groupValue: selectedParameterCode,
|
||||
onChanged: (int? newValue) {
|
||||
selectedParameterCode = newValue!;
|
||||
selectedParameterCodeValue = askDoctorRequestTypeList[index].parameterCode!;
|
||||
requestTypeSelectNotifier.value = selectedParameterCode;
|
||||
debugPrint(selectedParameterCodeValue.toString());
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomButton(
|
||||
text: LocaleKeys.cancel.tr(),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
icon: AppAssets.cancel,
|
||||
iconColor: AppColors.whiteColor,
|
||||
borderRadius: 12.r,
|
||||
iconSize: 14.h,
|
||||
fontSize: 14.f,
|
||||
height: 40.h,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
Expanded(
|
||||
child: CustomButton(
|
||||
text: LocaleKeys.confirm.tr(),
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
LoaderBottomSheet.showLoader(loadingText: "Sending Request...");
|
||||
await myAppointmentsViewModel.sendAskDocCallRequest(
|
||||
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel,
|
||||
requestType: selectedParameterCodeValue.toString(),
|
||||
remarks: "",
|
||||
userMobileNumber: myAppointmentsViewModel.appState.getAuthenticatedUser()!.mobileNumber!,
|
||||
onSuccess: (val) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
showCommonBottomSheetWithoutHeight(
|
||||
context,
|
||||
child: Utils.getSuccessWidget(loadingText: "Request has been sent successfully, you will be contacted soon.".needTranslation),
|
||||
callBackFunc: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
title: "",
|
||||
isCloseButtonVisible: true,
|
||||
isDismissible: false,
|
||||
isFullScreen: false,
|
||||
);
|
||||
},
|
||||
onError: (errMessage) {
|
||||
LoaderBottomSheet.hideLoader();
|
||||
});
|
||||
},
|
||||
backgroundColor: AppColors.bgGreenColor,
|
||||
borderColor: AppColors.bgGreenColor,
|
||||
textColor: Colors.white,
|
||||
icon: AppAssets.confirm,
|
||||
iconSize: 14.h,
|
||||
borderRadius: 12.r,
|
||||
fontSize: 14.f,
|
||||
height: 40.h,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
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/location_util.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/contact_us/contact_us_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/find_us_page.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/live_chat_page.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ContactUs extends StatelessWidget {
|
||||
ContactUs({super.key});
|
||||
|
||||
late AppState appState;
|
||||
late ContactUsViewModel contactUsViewModel;
|
||||
late LocationUtils locationUtils;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
locationUtils = getIt.get<LocationUtils>();
|
||||
locationUtils.isShowConfirmDialog = true;
|
||||
contactUsViewModel = Provider.of<ContactUsViewModel>(context);
|
||||
return Column(
|
||||
children: [
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.findUs.tr(),
|
||||
"View your nearest HMG locations".needTranslation,
|
||||
).onPress(() {
|
||||
locationUtils.getCurrentLocation(onSuccess: (value) {
|
||||
contactUsViewModel.initContactUsViewModel();
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(
|
||||
CustomPageRoute(
|
||||
page: FindUsPage(),
|
||||
),
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 16.h),
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.feedback.tr(),
|
||||
"Provide your feedback on our services".needTranslation,
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
checkInOptionCard(
|
||||
AppAssets.checkin_location_icon,
|
||||
LocaleKeys.liveChat.tr(),
|
||||
"Live chat option with HMG".needTranslation,
|
||||
).onPress(() {
|
||||
locationUtils.getCurrentLocation(onSuccess: (value) {
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(
|
||||
CustomPageRoute(
|
||||
page: LiveChatPage(),
|
||||
),
|
||||
);
|
||||
});
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget checkInOptionCard(String icon, String title, String subTitle) {
|
||||
return Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.r,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(icon: icon, width: 40.h, height: 40.h, fit: BoxFit.fill),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
title.toText16(isBold: true, color: AppColors.textColor),
|
||||
subTitle.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
Transform.flip(
|
||||
flipX: appState.isArabic(),
|
||||
child: Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.forward_arrow_icon_small,
|
||||
iconColor: AppColors.blackColor,
|
||||
width: 18.h,
|
||||
height: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingAll(16.h),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.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/contact_us/contact_us_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/medical_file/models/patient_sickleave_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/contact_us/widgets/find_us_item_card.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/patient_sick_leave_card.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/chip/app_custom_chip_widget.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class FindUsPage extends StatelessWidget {
|
||||
FindUsPage({super.key});
|
||||
|
||||
late AppState appState;
|
||||
late ContactUsViewModel contactUsViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
contactUsViewModel = Provider.of<ContactUsViewModel>(context);
|
||||
appState = getIt.get<AppState>();
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: CollapsingListView(
|
||||
title: LocaleKeys.location.tr(),
|
||||
child: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 16.h),
|
||||
contactUsVM.isHMGLocationsListLoading
|
||||
? SizedBox.shrink()
|
||||
: CustomTabBar(
|
||||
activeTextColor: AppColors.primaryRedColor,
|
||||
activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
|
||||
tabs: [
|
||||
CustomTabBarModel(null, LocaleKeys.hmgHospitals.tr()),
|
||||
CustomTabBarModel(null, LocaleKeys.pharmaciesList.tr()),
|
||||
],
|
||||
onTabChange: (index) {
|
||||
contactUsVM.setHMGHospitalsListSelected(index == 0);
|
||||
},
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
ListView.separated(
|
||||
padding: EdgeInsets.only(top: 16.h),
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: contactUsVM.isHMGLocationsListLoading
|
||||
? 5
|
||||
: contactUsVM.isHMGHospitalsListSelected
|
||||
? contactUsVM.hmgHospitalsLocationsList.length
|
||||
: contactUsVM.hmgPharmacyLocationsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return contactUsVM.isHMGLocationsListLoading
|
||||
? Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.h,
|
||||
hasShadow: true,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(14.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.network(
|
||||
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
|
||||
width: 63.h,
|
||||
height: 63.h,
|
||||
fit: BoxFit.cover,
|
||||
).circle(100).toShimmer2(isShow: true),
|
||||
SizedBox(width: 16.h),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
"Dr John Smith".toText16(isBold: true).toShimmer2(isShow: true),
|
||||
SizedBox(height: 8.h),
|
||||
Wrap(
|
||||
direction: Axis.horizontal,
|
||||
spacing: 3.h,
|
||||
runSpacing: 4.h,
|
||||
children: [
|
||||
AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h),
|
||||
AppCustomChipWidget(labelText: "").toShimmer2(isShow: true, width: 16.h),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h)
|
||||
: contactUsVM.isHMGHospitalsListSelected
|
||||
// ? contactUsVM.hmgHospitalsLocationsList.isNotEmpty
|
||||
? AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: FindUsItemCard(
|
||||
getHMGLocationsModel: contactUsVM.hmgHospitalsLocationsList[index],
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
),
|
||||
),
|
||||
)
|
||||
: AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: FindUsItemCard(
|
||||
getHMGLocationsModel: contactUsVM.hmgPharmacyLocationsList[index],
|
||||
),
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
),
|
||||
),
|
||||
);
|
||||
// : Utils.getNoDataWidget(
|
||||
// context,
|
||||
// noDataText: "No any locations yet.".needTranslation,
|
||||
// );
|
||||
},
|
||||
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
// FindUsItemCard(),
|
||||
// FindUsItemCard(),
|
||||
// FindUsItemCard(),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
|
||||
class LiveChatPage extends StatelessWidget {
|
||||
const LiveChatPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CollapsingListView(
|
||||
title: LocaleKeys.liveChat.tr(),
|
||||
child: SingleChildScrollView(),
|
||||
),
|
||||
),
|
||||
Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
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/contact_us/models/resp_models/get_hmg_locations.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
||||
import 'package:maps_launcher/maps_launcher.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FindUsItemCard extends StatelessWidget {
|
||||
FindUsItemCard({super.key, required this.getHMGLocationsModel});
|
||||
|
||||
late AppState appState;
|
||||
GetHMGLocationsModel getHMGLocationsModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
appState = getIt.get<AppState>();
|
||||
return DecoratedBox(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 20.r,
|
||||
hasShadow: false,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.h,
|
||||
children: [hospitalName, distanceInfo],
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetrical(16.h, 16.h),
|
||||
);
|
||||
}
|
||||
|
||||
Widget get hospitalName => Row(
|
||||
children: [
|
||||
Image.network(
|
||||
getHMGLocationsModel.projectImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
|
||||
width: 40.h,
|
||||
height: 40.h,
|
||||
fit: BoxFit.cover,
|
||||
).circle(100).toShimmer2(isShow: false).paddingOnly(right: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
getHMGLocationsModel.locationName!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: AppColors.blackColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
Widget get distanceInfo => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppCustomChipWidget(
|
||||
labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km".needTranslation,
|
||||
icon: AppAssets.location_red,
|
||||
iconColor: AppColors.primaryRedColor,
|
||||
backgroundColor: AppColors.secondaryLightRedColor,
|
||||
textColor: AppColors.errorColor,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
AppCustomChipWidget(
|
||||
labelText: "Get Directions".needTranslation,
|
||||
icon: AppAssets.directions_icon,
|
||||
iconColor: AppColors.whiteColor,
|
||||
backgroundColor: AppColors.textColor.withValues(alpha: 0.8),
|
||||
textColor: AppColors.whiteColor,
|
||||
onChipTap: () {
|
||||
MapsLauncher.launchCoordinates(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0"), getHMGLocationsModel.locationName!);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
AppCustomChipWidget(
|
||||
labelText: LocaleKeys.callNow.tr(),
|
||||
icon: AppAssets.call_fill,
|
||||
iconColor: AppColors.whiteColor,
|
||||
backgroundColor: AppColors.primaryRedColor.withValues(alpha: 1.0),
|
||||
textColor: AppColors.whiteColor,
|
||||
onChipTap: () {
|
||||
launchUrl(Uri.parse("tel://" + "${getHMGLocationsModel.phoneNumber}"));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,198 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
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/book_appointments/book_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/main.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.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/custom_tab_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class EyeMeasurementDetailsPage extends StatelessWidget {
|
||||
EyeMeasurementDetailsPage({super.key, required this.patientAppointmentHistoryResponseModel});
|
||||
|
||||
final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
|
||||
late BookAppointmentsViewModel bookAppointmentsViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: CollapsingListView(
|
||||
title: LocaleKeys.eyeMeasurements.tr(),
|
||||
child: SingleChildScrollView(
|
||||
child: Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: AppointmentCard(
|
||||
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel,
|
||||
myAppointmentsViewModel: myAppointmentsVM,
|
||||
bookAppointmentsViewModel: bookAppointmentsViewModel,
|
||||
isLoading: false,
|
||||
isFromHomePage: false,
|
||||
isFromMedicalReport: true,
|
||||
isForEyeMeasurements: true,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
CustomTabBar(
|
||||
activeTextColor: AppColors.primaryRedColor,
|
||||
activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
|
||||
tabs: [
|
||||
CustomTabBarModel(null, LocaleKeys.classes.tr()),
|
||||
CustomTabBarModel(null, LocaleKeys.contactLens.tr()),
|
||||
],
|
||||
onTabChange: (index) {
|
||||
myAppointmentsVM.onEyeMeasurementsTabChanged(index);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
getSelectedTabContent(myAppointmentsVM),
|
||||
],
|
||||
).paddingSymmetrical(24.w, 0);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSelectedTabContent(MyAppointmentsViewModel myAppointmentsVM) {
|
||||
switch (myAppointmentsVM.eyeMeasurementsTabSelectedIndex) {
|
||||
case 0:
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r, hasShadow: true),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.rightEye.tr().toText14(isBold: true),
|
||||
SizedBox(height: 16.h),
|
||||
getRow(LocaleKeys.sphere.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyeSpherical}', '-'),
|
||||
getRow(LocaleKeys.cylinder.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyeCylinder}', '-'),
|
||||
getRow(LocaleKeys.axis.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyeAxis}', '-'),
|
||||
getRow(LocaleKeys.prism.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyePrism}', '-'),
|
||||
getRow(LocaleKeys.va.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyeVA}', '-'),
|
||||
getRow(LocaleKeys.remarks.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].rightEyeRemarks}', '-', isLast: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r, hasShadow: true),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.leftEye.tr().needTranslation.toText14(isBold: true),
|
||||
SizedBox(height: 16.h),
|
||||
getRow(LocaleKeys.sphere.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeSpherical}', '-'),
|
||||
getRow(LocaleKeys.cylinder.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeCylinder}', '-'),
|
||||
getRow(LocaleKeys.axis.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeAxis}', '-'),
|
||||
getRow(LocaleKeys.prism.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyePrism}', '-'),
|
||||
getRow(LocaleKeys.va.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeVA}', '-'),
|
||||
getRow(LocaleKeys.remarks.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeRemarks}', '-', isLast: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
],
|
||||
);
|
||||
case 1:
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r, hasShadow: true),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.rightEye.tr().toText14(isBold: true),
|
||||
SizedBox(height: 16.h),
|
||||
getRow(LocaleKeys.brand.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].brand}', ''),
|
||||
getRow('B.C', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].baseCurve}', ''),
|
||||
getRow(LocaleKeys.power.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].power}', ''),
|
||||
getRow(LocaleKeys.diameter.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].diameter}', ''),
|
||||
getRow('OZ', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].oZ}', ''),
|
||||
getRow('CT', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].cT}', ''),
|
||||
getRow('Blend', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].blend}', ''),
|
||||
getRow(LocaleKeys.remarks.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![0].remarks}', '', isLast: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r, hasShadow: true),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.leftEye.tr().needTranslation.toText14(isBold: true),
|
||||
SizedBox(height: 16.h),
|
||||
getRow(LocaleKeys.brand.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].brand}', ''),
|
||||
getRow('B.C', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].baseCurve}', ''),
|
||||
getRow(LocaleKeys.power.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].power}', ''),
|
||||
getRow(LocaleKeys.diameter.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].diameter}', ''),
|
||||
getRow('OZ', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].oZ}', ''),
|
||||
getRow('CT', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].cT}', ''),
|
||||
getRow('Blend', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].blend}', ''),
|
||||
getRow(LocaleKeys.remarks.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].remarks}', '', isLast: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
],
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
Widget getRow(String title, String val1, String val2, {bool isLast = false}) => Padding(
|
||||
padding: EdgeInsets.only(left: 8.w, right: 8.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.h),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(flex: 2, child: title.toText11(weight: FontWeight.w500)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
SizedBox(width: 120.w, child: (val1 == 'null' ? '-' : val1).toText10(isBold: true, textOverflow: TextOverflow.clip)),
|
||||
(val2 == 'null' ? '-' : val2).toText10(isBold: true, textOverflow: TextOverflow.ellipsis),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
isLast
|
||||
? Container(
|
||||
height: 4,
|
||||
)
|
||||
: Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.1), height: 2.h)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.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/book_appointments/book_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class EyeMeasurementsAppointmentsPage extends StatelessWidget {
|
||||
EyeMeasurementsAppointmentsPage({super.key});
|
||||
|
||||
late BookAppointmentsViewModel bookAppointmentsViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: CollapsingListView(
|
||||
title: "Eye Measurements",
|
||||
child: SingleChildScrollView(
|
||||
child: Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 16.h),
|
||||
ListView.separated(
|
||||
scrollDirection: Axis.vertical,
|
||||
itemCount: myAppointmentsVM.isEyeMeasurementsAppointmentsLoading
|
||||
? 5
|
||||
: myAppointmentsVM.patientEyeMeasurementsAppointmentsHistoryList.isNotEmpty
|
||||
? myAppointmentsVM.patientEyeMeasurementsAppointmentsHistoryList.length
|
||||
: 1,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(left: 24.h, right: 24.h),
|
||||
itemBuilder: (context, index) {
|
||||
return myAppointmentsVM.isEyeMeasurementsAppointmentsLoading
|
||||
? Container(
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: AppointmentCard(
|
||||
patientAppointmentHistoryResponseModel: PatientAppointmentHistoryResponseModel(),
|
||||
myAppointmentsViewModel: myAppointmentsVM,
|
||||
bookAppointmentsViewModel: bookAppointmentsViewModel,
|
||||
isLoading: true,
|
||||
isFromHomePage: false,
|
||||
),
|
||||
)
|
||||
: myAppointmentsVM.patientEyeMeasurementsAppointmentsHistoryList.isNotEmpty
|
||||
? AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 100.0,
|
||||
child: FadeInAnimation(
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
|
||||
child: AppointmentCard(
|
||||
patientAppointmentHistoryResponseModel: myAppointmentsVM.patientEyeMeasurementsAppointmentsHistoryList[index],
|
||||
myAppointmentsViewModel: myAppointmentsVM,
|
||||
bookAppointmentsViewModel: bookAppointmentsViewModel,
|
||||
isLoading: false,
|
||||
isFromHomePage: false,
|
||||
isForEyeMeasurements: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Utils.getNoDataWidget(context, noDataText: "No Ophthalmology appointments found...".needTranslation);
|
||||
},
|
||||
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h),
|
||||
),
|
||||
SizedBox(height: 60.h),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue