@ -3,12 +3,16 @@ import 'package:flutter/material.dart';
import ' package:flutter_swiper_view/flutter_swiper_view.dart ' ;
import ' package:flutter_swiper_view/flutter_swiper_view.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_export.dart ' ;
import ' package:hmg_patient_app_new/core/app_export.dart ' ;
import ' package:hmg_patient_app_new/core/app_state.dart ' ;
import ' package:hmg_patient_app_new/core/utils/date_util.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/int_extensions.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/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/habib_wallet/habib_wallet_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart ' ;
import ' package:hmg_patient_app_new/features/insurance/insurance_view_model.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/generated/locale_keys.g.dart ' ;
import ' package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.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/habib_wallet/recharge_wallet_page.dart ' ;
import ' package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart ' ;
import ' package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart ' ;
@ -21,6 +25,8 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import ' package:hmg_patient_app_new/widgets/transitions/fade_page.dart ' ;
import ' package:hmg_patient_app_new/widgets/transitions/fade_page.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:provider/provider.dart ' ;
import ' ../../core/dependencies.dart ' show getIt ;
class ProfileSettings extends StatefulWidget {
class ProfileSettings extends StatefulWidget {
ProfileSettings ( { Key ? key } ) : super ( key: key ) ;
ProfileSettings ( { Key ? key } ) : super ( key: key ) ;
@ -75,7 +81,7 @@ class _ProfileSettingsState extends State<ProfileSettings> {
builder: DotSwiperPaginationBuilder ( color: Color ( 0xffD9D9D9 ) , activeColor: AppColors . blackBgColor ) ,
builder: DotSwiperPaginationBuilder ( color: Color ( 0xffD9D9D9 ) , activeColor: AppColors . blackBgColor ) ,
) ,
) ,
itemBuilder: ( BuildContext context , int index ) {
itemBuilder: ( BuildContext context , int index ) {
return FamilyCardWidget ( ) . paddingOnly ( right: 16 ) ;
return FamilyCardWidget ( isRootUser: true ) . paddingOnly ( right: 16 ) ;
} ,
} ,
) ,
) ,
GridView (
GridView (
@ -224,10 +230,14 @@ class _ProfileSettingsState extends State<ProfileSettings> {
}
}
class FamilyCardWidget extends StatelessWidget {
class FamilyCardWidget extends StatelessWidget {
FamilyCardWidget ( ) ;
FamilyCardWidget ( { this . isRootUser = true , Key ? key } ) : super ( key: key ) ;
bool isRootUser ;
late AppState appState ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
appState = getIt . get < AppState > ( ) ;
return Container (
return Container (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration (
color: AppColors . whiteColor ,
color: AppColors . whiteColor ,
@ -243,17 +253,18 @@ class FamilyCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
spacing: 8. h ,
spacing: 8. h ,
children: [
children: [
Image . asset ( true ? AppAssets . male_img : AppAssets . femaleImg , width: 56. h , height: 56. h ) ,
Image . asset ( appState . getAuthenticatedUser ( ) ? . gender = = 1 ? AppAssets . male_img : AppAssets . femaleImg , width: 56. h , height: 56. h ) ,
Column (
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
spacing: 0. h ,
spacing: 0. h ,
mainAxisSize: MainAxisSize . min ,
mainAxisSize: MainAxisSize . min ,
children: [
children: [
" Mahmoud Shrouf Shrouf " . toText18 ( isBold: true , weight: FontWeight . w600 , textOverflow: TextOverflow . ellipsis , maxlines: 1 ) ,
" ${ appState . getAuthenticatedUser ( ) ! . firstName } ${ appState . getAuthenticatedUser ( ) ! . lastName } "
. toText18 ( isBold: true , weight: FontWeight . w600 , textOverflow: TextOverflow . ellipsis , maxlines: 1 ) ,
AppCustomChipWidget (
AppCustomChipWidget (
icon: AppAssets . file_icon ,
icon: AppAssets . file_icon ,
labelText: " File no: 3423443 " ,
labelText: " ${ LocaleKeys . fileNo . tr ( context: context ) } : ${ appState . getAuthenticatedUser ( ) ! . patientId } " ,
iconSize: 1 4 ,
iconSize: 1 2 ,
) ,
) ,
] ,
] ,
) . expanded ,
) . expanded ,
@ -266,22 +277,52 @@ class FamilyCardWidget extends StatelessWidget {
alignment: WrapAlignment . start ,
alignment: WrapAlignment . start ,
spacing: 8. h ,
spacing: 8. h ,
children: [
children: [
AppCustomChipWidget ( labelText: " 35 Years Old " ) ,
AppCustomChipWidget ( labelText: " ${ appState . getAuthenticatedUser ( ) ! . age } Years Old " ) ,
AppCustomChipWidget ( labelText: " Blood: A+ " ) ,
AppCustomChipWidget (
AppCustomChipWidget (
icon: AppAssets . insurance_active_icon ,
icon: AppAssets . blood_icon ,
labelText: " Insurance Active " ,
labelText: " ${ LocaleKeys . bloodType . tr ( context: context ) } : ${ appState . getUserBloodGroup } " ,
iconColor: AppColors . bgGreenColor ,
iconColor: AppColors . primaryRedColor ,
iconSize: 14 ,
backgroundColor: AppColors . bgGreenColor . withValues ( alpha: 0.15 ) ,
) ,
) ,
Consumer < InsuranceViewModel > ( builder: ( context , insuranceVM , child ) {
return AppCustomChipWidget (
icon: insuranceVM . isInsuranceLoading
? AppAssets . cancel_circle_icon
: ( DateTime . now ( ) . isAfter (
DateUtil . convertStringToDate ( insuranceVM . patientInsuranceList . first . cardValidTo ) ,
) )
? AppAssets . cancel_circle_icon
: AppAssets . insurance_active_icon ,
labelText: insuranceVM . isInsuranceLoading
? " Insurance "
: ( DateTime . now ( ) . isAfter (
DateUtil . convertStringToDate ( insuranceVM . patientInsuranceList . first . cardValidTo ) ,
)
? " Insurance Expired " . needTranslation
: " Insurance Active " . needTranslation ) ,
iconColor: insuranceVM . isInsuranceLoading
? AppColors . primaryRedColor
: ( DateTime . now ( ) . isAfter (
DateUtil . convertStringToDate ( insuranceVM . patientInsuranceList . first . cardValidTo ) ,
) )
? AppColors . primaryRedColor
: AppColors . successColor ,
iconSize: 14 ,
backgroundColor: insuranceVM . isInsuranceLoading
? AppColors . primaryRedColor
: ( DateTime . now ( ) . isAfter (
DateUtil . convertStringToDate ( insuranceVM . patientInsuranceList . first . cardValidTo ) ,
) )
? AppColors . primaryRedColor . withValues ( alpha: 0.15 )
: AppColors . successColor . withValues ( alpha: 0.15 ) ,
) . toShimmer2 ( isShow: insuranceVM . isInsuranceLoading ) ;
} ) ,
] ,
] ,
) ,
) ,
) ,
) ,
] ,
] ,
) . paddingOnly ( top: 16 , right: 16 , left: 16 , bottom: 12 ) . expanded ,
) . paddingOnly ( top: 16 , right: 16 , left: 16 , bottom: 12 ) . expanded ,
1. divider ,
1. divider ,
CustomButton ( icon: AppAssets . add_family , text: " Add a new family member " . needTranslation , onPressed: ( ) { } ) . paddingOnly ( top: 12 , right: 16 , left: 16 , bottom: 16 ) ,
CustomButton ( icon: AppAssets . add_family , text: " Add a new family member " . needTranslation , height: 40. h , fontSize: 14 , onPressed: ( ) { } ) . paddingOnly ( top: 12 , right: 16 , left: 16 , bottom: 16 ) ,
] ,
] ,
) ,
) ,
) ;
) ;