You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
6.7 KiB
Dart
141 lines
6.7 KiB
Dart
import 'package:flutter/cupertino.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/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/features/my_appointments/utils/appointment_type.dart';
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart';
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class AppointmentDetailsPage extends StatefulWidget {
|
|
AppointmentDetailsPage({super.key, required this.patientAppointmentHistoryResponseModel});
|
|
|
|
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
|
|
|
|
@override
|
|
State<AppointmentDetailsPage> createState() => _AppointmentDetailsPageState();
|
|
}
|
|
|
|
class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
late MyAppointmentsViewModel myAppointmentsViewModel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
AppState appState = getIt.get<AppState>();
|
|
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context);
|
|
return Scaffold(
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
appBar: AppBar(
|
|
title: "Appointment Details".needTranslation.toText18(),
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
"Appointment Details".needTranslation.toText24(isBold: true),
|
|
],
|
|
),
|
|
SizedBox(height: 24.h),
|
|
AppointmentDoctorCard(
|
|
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
|
|
onAskDoctorTap: () {},
|
|
onCancelTap: () {},
|
|
onRescheduleTap: () {},
|
|
),
|
|
SizedBox(height: 16.h),
|
|
if (!AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel))
|
|
Container(
|
|
height: 200.h,
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
color: AppColors.whiteColor,
|
|
borderRadius: 20.h,
|
|
hasShadow: true,
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.all(16.h),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
"Appointment Status".needTranslation.toText16(isBold: true),
|
|
],
|
|
),
|
|
SizedBox(height: 4.h),
|
|
(!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel)
|
|
? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500)
|
|
: "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)),
|
|
SizedBox(height: 16.h),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
).paddingSymmetrical(24.h, 24.h),
|
|
),
|
|
),
|
|
Container(
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
color: AppColors.whiteColor,
|
|
borderRadius: 24.h,
|
|
hasShadow: true,
|
|
),
|
|
child: SizedBox(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (widget.patientAppointmentHistoryResponseModel.nextAction == 15 || widget.patientAppointmentHistoryResponseModel.nextAction == 20)
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
"Total amount to pay".needTranslation.toText18(isBold: true),
|
|
Utils.getPaymentAmountWithSymbol(widget.patientAppointmentHistoryResponseModel.patientShare!.toString().toText16(isBold: true), AppColors.blackColor, 13,
|
|
isSaudiCurrency: true),
|
|
],
|
|
),
|
|
],
|
|
).paddingSymmetrical(24.h, 24.h),
|
|
CustomButton(
|
|
text: AppointmentType.getNextActionText(widget.patientAppointmentHistoryResponseModel.nextAction),
|
|
onPressed: () {},
|
|
backgroundColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction),
|
|
borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withOpacity(0.01),
|
|
textColor: AppColors.whiteColor,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
borderRadius: 12,
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
height: 50.h,
|
|
icon: AppointmentType.getNextActionIcon(widget.patientAppointmentHistoryResponseModel.nextAction),
|
|
iconColor: AppColors.whiteColor,
|
|
iconSize: 18.h,
|
|
).paddingSymmetrical(24.h, 24.h),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|