pull/49/head
haroon amjad 1 month ago
parent c191fd0be1
commit 5e81ba1ed8

@ -53,7 +53,6 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
CustomTabBarModel(null, "Completed".needTranslation), CustomTabBarModel(null, "Completed".needTranslation),
], ],
onTabChange: (index) { onTabChange: (index) {
print(index);
myAppointmentsViewModel.onTabChange(index); myAppointmentsViewModel.onTabChange(index);
}, },
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),

@ -20,10 +20,11 @@ import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:smooth_corner/smooth_corner.dart'; import 'package:smooth_corner/smooth_corner.dart';
class AppointmentCard extends StatefulWidget { class AppointmentCard extends StatefulWidget {
AppointmentCard({super.key, required this.patientAppointmentHistoryResponseModel, required this.myAppointmentsViewModel}); AppointmentCard({super.key, required this.patientAppointmentHistoryResponseModel, required this.myAppointmentsViewModel, this.isLoading = false});
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel; PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
MyAppointmentsViewModel myAppointmentsViewModel; MyAppointmentsViewModel myAppointmentsViewModel;
bool isLoading;
@override @override
State<AppointmentCard> createState() => _AppointmentCardState(); State<AppointmentCard> createState() => _AppointmentCardState();

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_assets.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/app_state.dart';
@ -18,6 +19,7 @@ import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_mode
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart';
import 'package:hmg_patient_app_new/presentation/authentication/quick_login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/quick_login.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart'; import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart';
@ -54,6 +56,8 @@ class _LandingPageState extends State<LandingPage> {
late PrescriptionsViewModel prescriptionsViewModel; late PrescriptionsViewModel prescriptionsViewModel;
final CacheService cacheService = GetIt.instance<CacheService>(); final CacheService cacheService = GetIt.instance<CacheService>();
final SwiperController _controller = SwiperController();
@override @override
void initState() { void initState() {
authVM = context.read<AuthenticationViewModel>(); authVM = context.read<AuthenticationViewModel>();
@ -93,35 +97,32 @@ class _LandingPageState extends State<LandingPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
appState.isAuthenticated appState.isAuthenticated
? WelcomeWidget( ? WelcomeWidget(
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
FadePage( FadePage(
page: ProfileSettings(), page: ProfileSettings(),
), ),
); );
}, },
name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'), name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'),
imageUrl: appState imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg,
.getAuthenticatedUser() )
?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg,
)
: CustomButton( : CustomButton(
text: LocaleKeys.loginOrRegister.tr(context: context), text: LocaleKeys.loginOrRegister.tr(context: context),
onPressed: () async { onPressed: () async {
await authVM.onLoginPressed(); await authVM.onLoginPressed();
}, },
backgroundColor: Color(0xffFEE9EA), backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B), textColor: Color(0xffED1C2B),
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50, height: 50,
), ),
Row( Row(
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() {
@ -156,156 +157,194 @@ class _LandingPageState extends State<LandingPage> {
SizedBox(height: 16.h), SizedBox(height: 16.h),
appState.isAuthenticated appState.isAuthenticated
? Column( ? Column(
children: [ children: [
Container( SizedBox(height: 12.h),
width: double.infinity, Row(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( mainAxisAlignment: MainAxisAlignment.spaceBetween,
color: AppColors.whiteColor, children: [
borderRadius: 24, "Appointments & Visits".toText16(isBold: true),
), Row(
child: Padding( children: [
padding: EdgeInsets.all(12.h), LocaleKeys.viewAll.tr(context: context).toText12(color: AppColors.primaryRedColor),
child: Column( SizedBox(width: 2.h),
children: [ Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), ],
SizedBox(height: 12.h), ),
"You do not have any upcoming appointment. Please book an appointment".toText12(isCenter: true), ],
SizedBox(height: 12.h), ).paddingSymmetrical(24.h, 0.h).onPress(() {
CustomButton( Navigator.of(context).push(
text: LocaleKeys.bookAppo.tr(context: context), FadePage(
onPressed: () { page: MyAppointmentsPage(),
Navigator.of(context) ),
.push( );
FadePage( }),
page: BookAppointmentPage(), SizedBox(height: 12.h),
), Swiper(
); itemCount: 3,
}, layout: SwiperLayout.STACK,
backgroundColor: Color(0xffFEE9EA), loop: true,
borderColor: Color(0xffFEE9EA), itemWidth: MediaQuery.of(context).size.width - 42,
textColor: Color(0xffED1C2B), indicatorLayout: PageIndicatorLayout.COLOR,
fontSize: 14, axisDirection: AxisDirection.right,
fontWeight: FontWeight.w500, controller: _controller,
borderRadius: 12, itemHeight: 210 + 16,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), pagination: const SwiperPagination(
height: 40, alignment: Alignment.bottomCenter,
icon: AppAssets.add_icon, margin: EdgeInsets.only(top: 210 + 8 + 24),
iconColor: AppColors.primaryRedColor, builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor),
), ),
], itemBuilder: (BuildContext context, int index) {
), return FamilyCardWidget().paddingOnly(right: 16);
), },
).paddingSymmetrical(24.h, 0.h), ),
SizedBox(height: 12.h), // Container(
Row( // width: double.infinity,
mainAxisAlignment: MainAxisAlignment.spaceBetween, // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
children: [ // color: AppColors.whiteColor,
"Quick Links".toText16(isBold: true), // borderRadius: 24,
Row( // ),
children: [ // child: Padding(
"View medical file".toText12(color: AppColors.primaryRedColor), // padding: EdgeInsets.all(12.h),
SizedBox(width: 2.h), // child: Column(
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), // children: [
], // Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h),
), // SizedBox(height: 12.h),
], // "You do not have any upcoming appointment. Please book an appointment".toText12(isCenter: true),
).paddingSymmetrical(24.h, 0.h).onPress(() { // SizedBox(height: 12.h),
Navigator.of(context).push( // CustomButton(
FadePage( // text: LocaleKeys.bookAppo.tr(context: context),
page: MedicalFilePage(), // onPressed: () {
), // Navigator.of(context).push(
); // FadePage(
}), // page: BookAppointmentPage(),
SizedBox(height: 12.h), // ),
Container( // );
height: 127.h, // },
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // backgroundColor: Color(0xffFEE9EA),
color: AppColors.whiteColor, // borderColor: Color(0xffFEE9EA),
borderRadius: 24, // textColor: Color(0xffED1C2B),
), // fontSize: 14,
child: Padding( // fontWeight: FontWeight.w500,
padding: EdgeInsets.all(16.h), // borderRadius: 12,
child: Column( // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
children: [ // height: 40,
Expanded( // icon: AppAssets.add_icon,
child: ListView.separated( // iconColor: AppColors.primaryRedColor,
scrollDirection: Axis.horizontal, // ),
itemCount: LandingPageData.getLoggedInServiceCardsList.length, // ],
shrinkWrap: true, // ),
padding: const EdgeInsets.only(left: 0, right: 8), // ),
itemBuilder: (context, index) { // ).paddingSymmetrical(24.h, 0.h),
return AnimationConfiguration.staggeredList( SizedBox(height: 12.h),
position: index, Row(
duration: const Duration(milliseconds: 1000), mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: SlideAnimation( children: [
horizontalOffset: 100.0, "Quick Links".toText16(isBold: true),
child: FadeInAnimation( Row(
child: SmallServiceCard( children: [
icon: LandingPageData.getLoggedInServiceCardsList[index].icon, "View medical file".toText12(color: AppColors.primaryRedColor),
title: LandingPageData.getLoggedInServiceCardsList[index].title, SizedBox(width: 2.h),
subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle, Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor, ],
textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor,
backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor,
isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold,
serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName,
),
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => 0.width,
), ),
],
).paddingSymmetrical(24.h, 0.h).onPress(() {
Navigator.of(context).push(
FadePage(
page: MedicalFilePage(),
),
);
}),
SizedBox(height: 12.h),
Container(
height: 127.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24,
), ),
], child: Padding(
), padding: EdgeInsets.all(16.h),
), child: Column(
).paddingSymmetrical(24.h, 0.h), children: [
], Expanded(
) child: ListView.separated(
: Container( scrollDirection: Axis.horizontal,
height: 127.h, itemCount: LandingPageData.getLoggedInServiceCardsList.length,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( shrinkWrap: true,
color: AppColors.whiteColor, padding: const EdgeInsets.only(left: 0, right: 8),
borderRadius: 24, itemBuilder: (context, index) {
), return AnimationConfiguration.staggeredList(
child: Padding( position: index,
padding: EdgeInsets.all(16.h), duration: const Duration(milliseconds: 1000),
child: Column( child: SlideAnimation(
children: [ horizontalOffset: 100.0,
Expanded( child: FadeInAnimation(
child: ListView.separated( child: SmallServiceCard(
scrollDirection: Axis.horizontal, icon: LandingPageData.getLoggedInServiceCardsList[index].icon,
itemCount: LandingPageData.getNotLoggedInServiceCardsList.length, title: LandingPageData.getLoggedInServiceCardsList[index].title,
shrinkWrap: true, subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle,
padding: const EdgeInsets.only(left: 0, right: 8), iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor,
itemBuilder: (context, index) { textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor,
return AnimationConfiguration.staggeredList( backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor,
position: index, isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold,
duration: const Duration(milliseconds: 1000), serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName,
child: SlideAnimation( ),
horizontalOffset: 100.0, ),
child: FadeInAnimation( ),
child: SmallServiceCard( );
icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, },
title: LandingPageData.getNotLoggedInServiceCardsList[index].title, separatorBuilder: (BuildContext cxt, int index) => 0.width,
subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle,
iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor,
textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor,
backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor,
isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold,
), ),
), ),
],
),
),
).paddingSymmetrical(24.h, 0.h),
],
)
: Container(
height: 127.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24,
),
child: Padding(
padding: EdgeInsets.all(16.h),
child: Column(
children: [
Expanded(
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: LandingPageData.getNotLoggedInServiceCardsList.length,
shrinkWrap: true,
padding: const EdgeInsets.only(left: 0, right: 8),
itemBuilder: (context, index) {
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 1000),
child: SlideAnimation(
horizontalOffset: 100.0,
child: FadeInAnimation(
child: SmallServiceCard(
icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon,
title: LandingPageData.getNotLoggedInServiceCardsList[index].title,
subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle,
iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor,
textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor,
backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor,
isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold,
),
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => 0.width,
), ),
); ),
}, ],
separatorBuilder: (BuildContext cxt, int index) => 0.width,
), ),
), ),
], ).paddingSymmetrical(24.h, 0.h),
),
),
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 16.h), SizedBox(height: 16.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -375,7 +414,7 @@ class _LandingPageState extends State<LandingPage> {
// sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, true); // sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, true);
authVM.loginWithFingerPrintFace(() { authVM.loginWithFingerPrintFace(() {
isDone = true; isDone = true;
cacheService.saveBool(key: CacheConst.quickLoginEnabled,value: true); cacheService.saveBool(key: CacheConst.quickLoginEnabled, value: true);
setState(() {}); setState(() {});
}); });
}, },

Loading…
Cancel
Save