user profile welcome widget improvement.

pull/46/head
Sikander Saleem 1 month ago
parent 8f0e910e4f
commit c83754fc4a

@ -132,7 +132,16 @@ extension EmailValidator on String {
decoration: isUnderLine ? TextDecoration.underline : null), decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = -1, TextOverflow? textOverflow}) => Widget toText14(
{Color? color,
bool isUnderLine = false,
bool isBold = false,
bool isCenter = false,
FontWeight? weight,
int? maxlines,
double? letterSpacing = -1,
double? height,
TextOverflow? textOverflow}) =>
Text( Text(
this, this,
textAlign: isCenter ? TextAlign.center : null, textAlign: isCenter ? TextAlign.center : null,
@ -142,6 +151,7 @@ extension EmailValidator on String {
color: color ?? AppColors.blackColor, color: color ?? AppColors.blackColor,
fontSize: 14.fSize, fontSize: 14.fSize,
letterSpacing: letterSpacing, letterSpacing: letterSpacing,
height: height,
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
decoration: isUnderLine ? TextDecoration.underline : null), decoration: isUnderLine ? TextDecoration.underline : null),
); );
@ -167,6 +177,7 @@ extension EmailValidator on String {
double? height, double? height,
TextAlign? textAlign, TextAlign? textAlign,
FontWeight? weight, FontWeight? weight,
TextOverflow? textOverflow,
double? letterSpacing = -0.4, double? letterSpacing = -0.4,
}) => }) =>
Text( Text(
@ -178,6 +189,7 @@ extension EmailValidator on String {
fontSize: 16.fSize, fontSize: 16.fSize,
letterSpacing: letterSpacing, letterSpacing: letterSpacing,
height: height, height: height,
overflow: textOverflow,
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
decoration: isUnderLine ? TextDecoration.underline : null, decoration: isUnderLine ? TextDecoration.underline : null,
), ),

@ -95,33 +95,32 @@ class _LandingPageState extends State<LandingPage> {
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() ).expanded
?.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(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() {
Navigator.of(context).push( Navigator.of(context).push(
@ -155,156 +154,155 @@ class _LandingPageState extends State<LandingPage> {
SizedBox(height: 16.h), SizedBox(height: 16.h),
appState.isAuthenticated appState.isAuthenticated
? Column( ? Column(
children: [ children: [
Container( Container(
width: double.infinity, width: double.infinity,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, color: AppColors.whiteColor,
borderRadius: 24, borderRadius: 24,
),
child: Padding(
padding: EdgeInsets.all(12.h),
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)
.push(
FadePage(
page: BookAppointmentPage(),
),
);
},
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,
), ),
], child: Padding(
), padding: EdgeInsets.all(12.h),
), child: Column(
).paddingSymmetrical(24.h, 0.h), children: [
SizedBox(height: 12.h), Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h),
Row( SizedBox(height: 12.h),
mainAxisAlignment: MainAxisAlignment.spaceBetween, "You do not have any upcoming appointment. Please book an appointment".toText12(isCenter: true),
children: [ SizedBox(height: 12.h),
"Quick Links".toText16(isBold: true), CustomButton(
Row( text: LocaleKeys.bookAppo.tr(context: context),
children: [ onPressed: () {
"View medical file".toText12(color: AppColors.primaryRedColor), Navigator.of(context).push(
SizedBox(width: 2.h), FadePage(
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), page: BookAppointmentPage(),
],
),
],
).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(
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,
serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName,
), ),
), );
), },
); backgroundColor: Color(0xffFEE9EA),
}, borderColor: Color(0xffFEE9EA),
separatorBuilder: (BuildContext cxt, int index) => 0.width, 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,
),
],
), ),
), ),
], ).paddingSymmetrical(24.h, 0.h),
), SizedBox(height: 12.h),
), Row(
).paddingSymmetrical(24.h, 0.h), mainAxisAlignment: MainAxisAlignment.spaceBetween,
], children: [
) "Quick Links".toText16(isBold: true),
: Container( Row(
height: 127.h, children: [
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( "View medical file".toText12(color: AppColors.primaryRedColor),
color: AppColors.whiteColor, SizedBox(width: 2.h),
borderRadius: 24, Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
), ],
child: Padding( ),
padding: EdgeInsets.all(16.h), ],
child: Column( ).paddingSymmetrical(24.h, 0.h).onPress(() {
children: [ Navigator.of(context).push(
Expanded( FadePage(
child: ListView.separated( page: MedicalFilePage(),
scrollDirection: Axis.horizontal, ),
itemCount: LandingPageData.getNotLoggedInServiceCardsList.length, );
shrinkWrap: true, }),
padding: const EdgeInsets.only(left: 0, right: 8), SizedBox(height: 12.h),
itemBuilder: (context, index) { Container(
return AnimationConfiguration.staggeredList( height: 127.h,
position: index, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
duration: const Duration(milliseconds: 1000), color: AppColors.whiteColor,
child: SlideAnimation( borderRadius: 24,
horizontalOffset: 100.0, ),
child: FadeInAnimation( child: Padding(
child: SmallServiceCard( padding: EdgeInsets.all(16.h),
icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, child: Column(
title: LandingPageData.getNotLoggedInServiceCardsList[index].title, children: [
subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, Expanded(
iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor, child: ListView.separated(
textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor, scrollDirection: Axis.horizontal,
backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor, itemCount: LandingPageData.getLoggedInServiceCardsList.length,
isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold, 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,
serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName,
),
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => 0.width,
), ),
), ),
],
),
),
).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,
@ -374,7 +372,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(() {});
}); });
}, },

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/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/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
class WelcomeWidget extends StatelessWidget { class WelcomeWidget extends StatelessWidget {
@ -23,32 +25,25 @@ class WelcomeWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 8.h,
children: [ children: [
// Profile image
Image.asset(imageUrl, width: 40, height: 40), Image.asset(imageUrl, width: 40, height: 40),
const SizedBox(width: 10),
// Text column
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 4.h,
mainAxisSize: MainAxisSize.min,
children: [ children: [
"Welcome".needTranslation.toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500),
"Welcome".toText14(color: AppColors.greyTextColor),
Row( Row(
spacing: 4.h,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
name.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1, height: 1).expanded,
name.toText16(isBold: true),
const SizedBox(width: 4),
const Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.black), const Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.black),
], ],
), ),
], ],
), ).expanded,
], ],
), ),
); );

@ -7,10 +7,13 @@ 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/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart';
import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart';
import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/theme/colors.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/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ProfileSettings extends StatefulWidget { class ProfileSettings extends StatefulWidget {
@ -123,10 +126,14 @@ class _ProfileSettingsState extends State<ProfileSettings> {
backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08), backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08),
padding: EdgeInsets.all(8.h), padding: EdgeInsets.all(8.h),
fontSize: 14, fontSize: 14,
onPressed: () {}, onPressed: () {
Navigator.of(context).push(FadePage(page: RechargeWalletPage()));
},
), ),
], ],
), ).onPress(() {
Navigator.of(context).push(FadePage(page: HabibWalletPage()));
}),
) )
], ],
), ),

Loading…
Cancel
Save