|
|
|
|
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/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/int_extensions.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/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/providers/authentication_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/providers/bottom_navigation_provider.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/bottom_navigation/bottom_navigation.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../core/app_assets.dart';
|
|
|
|
|
import '../../core/utils/utils.dart';
|
|
|
|
|
import '../../widgets/buttons/custom_button.dart';
|
|
|
|
|
|
|
|
|
|
class LandingPage extends StatefulWidget {
|
|
|
|
|
const LandingPage({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<LandingPage> createState() => _LandingPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _LandingPageState extends State<LandingPage> {
|
|
|
|
|
late AuthenticationViewModel authenticationViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Consumer<BottomNavigationProvider>(builder: (context, navigationProvider, child) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.bgScaffoldColor,
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: EdgeInsets.all(24.h),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 50.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: LocaleKeys.loginOrRegister.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pushReplacement(
|
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) => LandingPage()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: Color(0xffFEE9EA),
|
|
|
|
|
borderColor: Color(0xffFEE9EA),
|
|
|
|
|
textColor: Color(0xffED1C2B),
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
height: 50,
|
|
|
|
|
),
|
|
|
|
|
Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.contact_icon,
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
AppState().isAuthenticated
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 24,
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(12.h),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
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),
|
|
|
|
|
SizedBox(height: 12.h),
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: LocaleKeys.bookAppo.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pushReplacement(
|
|
|
|
|
MaterialPageRoute(builder: (BuildContext context) => LandingPage()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: Color(0xffFEE9EA),
|
|
|
|
|
borderColor: Color(0xffFEE9EA),
|
|
|
|
|
textColor: Color(0xffED1C2B),
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
height: 40,
|
|
|
|
|
icon: AppAssets.add_icon,
|
|
|
|
|
iconColor: AppColors.primaryRedColor,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12.h),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Quick Links".toText14(isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"View medical file".toText12(color: AppColors.primaryRedColor),
|
|
|
|
|
SizedBox(width: 2.h),
|
|
|
|
|
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
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(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
itemCount: LandingPageData.getLoggedInServiceCardsList.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.getLoggedInServiceCardsList[index].icon,
|
|
|
|
|
title: LandingPageData.getLoggedInServiceCardsList[index].title,
|
|
|
|
|
subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle,
|
|
|
|
|
iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor,
|
|
|
|
|
textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor,
|
|
|
|
|
backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor,
|
|
|
|
|
isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.width,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: 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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Services".toText14(isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"View all services".toText12(color: AppColors.primaryRedColor),
|
|
|
|
|
SizedBox(width: 2.h),
|
|
|
|
|
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 325.h,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
itemCount: LandingPageData.getServiceCardsList.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: LargeServiceCard(
|
|
|
|
|
image: LandingPageData.getServiceCardsList[index].icon,
|
|
|
|
|
title: LandingPageData.getServiceCardsList[index].title,
|
|
|
|
|
subtitle: LandingPageData.getServiceCardsList[index].subtitle,
|
|
|
|
|
icon: LandingPageData.getServiceCardsList[index].largeCardIcon,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.width,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
AppState().isAuthenticated
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"My Balance".toText14(isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"View all services".toText12(color: AppColors.primaryRedColor),
|
|
|
|
|
SizedBox(width: 2.h),
|
|
|
|
|
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomNavigationBar: BottomNavigation(),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|