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.
267 lines
12 KiB
Dart
267 lines
12 KiB
Dart
|
1 month ago
|
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/presentation/home/navigation_screen.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/chip/app_custom_chip_widget.dart';
|
||
|
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
||
|
|
|
||
|
|
class AppointmentQueuePage extends StatelessWidget {
|
||
|
|
AppointmentQueuePage({super.key});
|
||
|
|
|
||
|
|
AppState? appState;
|
||
|
|
int currentQueueStatus = 0;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
currentQueueStatus = 1;
|
||
|
|
appState = getIt.get<AppState>();
|
||
|
|
return Scaffold(
|
||
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
||
|
|
body: Column(
|
||
|
|
children: [
|
||
|
|
Expanded(
|
||
|
|
child: CollapsingListView(
|
||
|
|
title: "Queueing".needTranslation,
|
||
|
|
child: SingleChildScrollView(
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.all(24.0),
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
Container(
|
||
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||
|
|
color: AppColors.whiteColor,
|
||
|
|
borderRadius: 20.h,
|
||
|
|
hasShadow: false,
|
||
|
|
side: BorderSide(color: getCardBorderColor(), width: 2.w),
|
||
|
|
),
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.all(16.h),
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
Row(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
|
children: [
|
||
|
|
AppCustomChipWidget(
|
||
|
|
labelText: currentQueueStatus == 0 ? "In Queue".needTranslation : "Your Turn".needTranslation,
|
||
|
|
backgroundColor: getCardBorderColor().withValues(alpha: 0.20),
|
||
|
|
textColor: getCardBorderColor(),
|
||
|
|
),
|
||
|
|
Utils.buildSvgWithAssets(icon: AppAssets.waiting_icon, width: 24.h, height: 24.h),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
SizedBox(height: 10.h),
|
||
|
|
"Hala ${appState!.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true),
|
||
|
|
SizedBox(height: 8.h),
|
||
|
|
"Thank you for your patience, here is your queue number.".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
SizedBox(height: 8.h),
|
||
|
|
"IMD W-A-2".needTranslation.toText32(isBold: true),
|
||
|
|
SizedBox(height: 8.h),
|
||
|
|
CustomButton(
|
||
|
|
text: getCardButtonText(),
|
||
|
|
onPressed: () {},
|
||
|
|
backgroundColor: getCardButtonColor(),
|
||
|
|
borderColor: getCardButtonColor().withValues(alpha: 0.01),
|
||
|
|
textColor: getCardButtonTextColor(),
|
||
|
|
fontSize: 12.f,
|
||
|
|
fontWeight: FontWeight.w600,
|
||
|
|
borderRadius: 12.r,
|
||
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
||
|
|
height: 40.h,
|
||
|
|
iconColor: AppColors.whiteColor,
|
||
|
|
iconSize: 18.h,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
SizedBox(height: 16.h),
|
||
|
|
Container(
|
||
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||
|
|
color: AppColors.whiteColor,
|
||
|
|
borderRadius: 20.h,
|
||
|
|
hasShadow: true,
|
||
|
|
),
|
||
|
|
child: Padding(
|
||
|
|
padding: EdgeInsets.all(16.h),
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
"Serving Now".needTranslation.toText16(isBold: true),
|
||
|
|
SizedBox(height: 18.h),
|
||
|
|
ListView.separated(
|
||
|
|
padding: EdgeInsets.zero,
|
||
|
|
shrinkWrap: true,
|
||
|
|
itemCount: 3,
|
||
|
|
physics: NeverScrollableScrollPhysics(),
|
||
|
|
itemBuilder: (BuildContext context, int index) {
|
||
|
|
return Row(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
"IMD W-A-2".needTranslation.toText17(isBold: true),
|
||
|
|
Row(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
"Room: S2".toText12(fontWeight: FontWeight.w500),
|
||
|
|
SizedBox(width: 8.w),
|
||
|
|
AppCustomChipWidget(
|
||
|
|
deleteIcon: AppAssets.call_for_vitals,
|
||
|
|
labelText: "Call for vital signs".needTranslation,
|
||
|
|
iconColor: AppColors.primaryRedColor,
|
||
|
|
textColor: AppColors.primaryRedColor,
|
||
|
|
iconSize: 14.w,
|
||
|
|
backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1),
|
||
|
|
labelPadding: EdgeInsetsDirectional.only(start: 8.h, end: -2.h),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
],
|
||
|
|
);
|
||
|
|
},
|
||
|
|
separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 8.h),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
SizedBox(height: 16.h),
|
||
|
|
Container(
|
||
|
|
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: [
|
||
|
|
Utils.buildSvgWithAssets(icon: AppAssets.bulb_icon, width: 24.w, height: 24.h),
|
||
|
|
SizedBox(width: 8.w),
|
||
|
|
"Things to ask your doctor today".needTranslation.toText16(isBold: true),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
SizedBox(height: 8.h),
|
||
|
|
|
||
|
|
// What can I do to improve my overall health?
|
||
|
|
// Are there any routine screenings I should get?
|
||
|
|
// What is this medication for?
|
||
|
|
// Are there any side effects I should know about?
|
||
|
|
// When should I come back for a follow-up?
|
||
|
|
|
||
|
|
"• ${"What can I do to improve my overall health?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
SizedBox(height: 4.h),
|
||
|
|
"• ${"Are there any routine screenings I should get?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
SizedBox(height: 4.h),
|
||
|
|
"• ${"What is this medication for?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
SizedBox(height: 4.h),
|
||
|
|
"• ${"Are there any side effects I should know about?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
SizedBox(height: 4.h),
|
||
|
|
"• ${"When should I come back for a follow-up?"}".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
|
||
|
|
|
||
|
|
SizedBox(height: 16.h),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Container(
|
||
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||
|
|
color: AppColors.whiteColor,
|
||
|
|
borderRadius: 24.r,
|
||
|
|
hasShadow: true,
|
||
|
|
),
|
||
|
|
child: CustomButton(
|
||
|
|
text: "Go to homepage".needTranslation,
|
||
|
|
onPressed: () {
|
||
|
|
Navigator.pushAndRemoveUntil(
|
||
|
|
context,
|
||
|
|
CustomPageRoute(
|
||
|
|
page: LandingNavigation(),
|
||
|
|
),
|
||
|
|
(r) => false);
|
||
|
|
},
|
||
|
|
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,
|
||
|
|
icon: AppAssets.homeBottom,
|
||
|
|
iconColor: AppColors.whiteColor,
|
||
|
|
iconSize: 18.h,
|
||
|
|
).paddingSymmetrical(16.h, 24.h),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Color getCardBorderColor() {
|
||
|
|
switch (currentQueueStatus) {
|
||
|
|
case 0:
|
||
|
|
return AppColors.ratingColorYellow;
|
||
|
|
case 1:
|
||
|
|
return AppColors.primaryRedColor;
|
||
|
|
case 2:
|
||
|
|
return AppColors.successColor;
|
||
|
|
}
|
||
|
|
return AppColors.textColor;
|
||
|
|
}
|
||
|
|
|
||
|
|
Color getCardButtonColor() {
|
||
|
|
switch (currentQueueStatus) {
|
||
|
|
case 0:
|
||
|
|
return AppColors.textColor.withValues(alpha: 0.08);
|
||
|
|
case 1:
|
||
|
|
return AppColors.primaryRedColor;
|
||
|
|
case 2:
|
||
|
|
return AppColors.successColor;
|
||
|
|
}
|
||
|
|
return AppColors.primaryRedColor;
|
||
|
|
}
|
||
|
|
|
||
|
|
Color getCardButtonTextColor() {
|
||
|
|
switch (currentQueueStatus) {
|
||
|
|
case 0:
|
||
|
|
return Color(0xFFA2A2A2);
|
||
|
|
case 1:
|
||
|
|
return AppColors.whiteColor;
|
||
|
|
case 2:
|
||
|
|
return AppColors.whiteColor;
|
||
|
|
}
|
||
|
|
return AppColors.primaryRedColor;
|
||
|
|
}
|
||
|
|
|
||
|
|
String getCardButtonText() {
|
||
|
|
switch (currentQueueStatus) {
|
||
|
|
case 0:
|
||
|
|
return "Please wait! you will be called for vital signs".needTranslation;
|
||
|
|
case 1:
|
||
|
|
return "Please visit Room S5 for vital signs".needTranslation;
|
||
|
|
case 2:
|
||
|
|
return "Please visit Room S5 to the Doctor".needTranslation;
|
||
|
|
}
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
}
|