From e17d207ce59e040926c1f4dd17c464ee6aa57fc5 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 15 Sep 2025 09:04:18 +0300 Subject: [PATCH] swiper carousal view added in profile settings --- assets/images/svg/add_family.svg | 5 + assets/images/svg/wallet.svg | 4 + lib/core/app_assets.dart | 2 + lib/extensions/string_extensions.dart | 21 +-- .../profile_settings_view_model.dart | 8 + lib/main.dart | 4 + .../profile_settings/profile_settings.dart | 173 ++++++++++++++++++ pubspec.yaml | 1 + 8 files changed, 204 insertions(+), 14 deletions(-) create mode 100644 assets/images/svg/add_family.svg create mode 100644 assets/images/svg/wallet.svg create mode 100644 lib/features/profile_settings/profile_settings_view_model.dart create mode 100644 lib/presentation/profile_settings/profile_settings.dart diff --git a/assets/images/svg/add_family.svg b/assets/images/svg/add_family.svg new file mode 100644 index 0000000..e873f89 --- /dev/null +++ b/assets/images/svg/add_family.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/wallet.svg b/assets/images/svg/wallet.svg new file mode 100644 index 0000000..3382609 --- /dev/null +++ b/assets/images/svg/wallet.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index d0acea0..ffbbbee 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -51,6 +51,8 @@ class AppAssets { static const String insurance_update_icon = '$svgBasePath/insurance_update.svg'; static const String home_calendar_icon = '$svgBasePath/home_calendar_icon.svg'; static const String add_icon = '$svgBasePath/add_icon.svg'; + static const String add_family = '$svgBasePath/add_family.svg'; + static const String wallet = '$svgBasePath/wallet.svg'; static const String livecare_icon = '$svgBasePath/livecare_icon.svg'; static const String file_icon = '$svgBasePath/file_icon.svg'; static const String checkmark_icon = '$svgBasePath/checkmark_icon.svg'; diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 66847a4..509385c 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -34,7 +34,8 @@ extension EmailValidator on String { ), ); - Widget toText10({Color? color, FontWeight? weight, bool isBold = false, bool isUnderLine = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow, double letterSpacing = -1}) => Text( + Widget toText10({Color? color, FontWeight? weight, bool isBold = false, bool isUnderLine = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow, double letterSpacing = -1}) => + Text( this, maxLines: maxlines, overflow: textOverflow, @@ -119,16 +120,7 @@ extension EmailValidator on String { ), ); - Widget toText13({ - Color? color, - bool isUnderLine = false, - bool isBold = false, - bool isCenter = false, - int maxLine = 0, - FontWeight? weight, - double? letterSpacing = -1 - }) => - Text( + Widget toText13({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0, FontWeight? weight, double? letterSpacing = -1}) => Text( this, textAlign: isCenter ? TextAlign.center : null, maxLines: (maxLine > 0) ? maxLine : null, @@ -193,11 +185,12 @@ extension EmailValidator on String { style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 17.fSize, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); - Widget toText18({Color? color, bool isBold = false, bool isCenter = false, int? maxlines}) => Text( + Widget toText18({Color? color, FontWeight? weight, bool isBold = false, bool isCenter = false, int? maxlines, TextOverflow? textOverflow}) => Text( maxLines: maxlines, textAlign: isCenter ? TextAlign.center : null, this, - style: TextStyle(fontSize: 18.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4), + overflow: textOverflow, + style: TextStyle(fontSize: 18.fSize, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), ); Widget toText19({Color? color, bool isBold = false}) => Text( @@ -205,7 +198,7 @@ extension EmailValidator on String { style: TextStyle(fontSize: 19.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4), ); - Widget toText20({Color? color,FontWeight? weight, bool isBold = false}) => Text( + Widget toText20({Color? color, FontWeight? weight, bool isBold = false}) => Text( this, style: TextStyle(fontSize: 20.fSize, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), ); diff --git a/lib/features/profile_settings/profile_settings_view_model.dart b/lib/features/profile_settings/profile_settings_view_model.dart new file mode 100644 index 0000000..61acb26 --- /dev/null +++ b/lib/features/profile_settings/profile_settings_view_model.dart @@ -0,0 +1,8 @@ +import 'package:flutter/foundation.dart'; + +class ProfileSettingsViewModel extends ChangeNotifier { + + void notify(){ + notifyListeners(); + } +} diff --git a/lib/main.dart b/lib/main.dart index 70a2158..f76e372 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,6 +15,7 @@ import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_mode import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; +import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; @@ -97,6 +98,9 @@ void main() async { ChangeNotifierProvider( create: (_) => MedicalFileViewModel(), ), + ChangeNotifierProvider( + create: (_) => ProfileSettingsViewModel(), + ), ChangeNotifierProvider( create: (_) => MyAppointmentsViewModel( myAppointmentsRepo: getIt(), diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart new file mode 100644 index 0000000..baccbe2 --- /dev/null +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -0,0 +1,173 @@ +import 'package:flutter/material.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_export.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/features/profile_settings/profile_settings_view_model.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/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:provider/provider.dart'; + +class ProfileSettings extends StatefulWidget { + ProfileSettings({Key? key}) : super(key: key); + + @override + _ProfileSettingsState createState() { + return _ProfileSettingsState(); + } +} + +class _ProfileSettingsState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + int length = 3; + final SwiperController _controller = SwiperController(); + + int _index = 0; + + @override + Widget build(BuildContext context) { + return CollapsingListView( + title: "Profile & Settings".needTranslation, + logout: () {}, + isClose: true, + child: SingleChildScrollView( + padding: EdgeInsets.only(top: 24, bottom: 24), + physics: NeverScrollableScrollPhysics(), + child: Consumer( + builder: (context, model, child) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Swiper( + itemCount: length, + layout: SwiperLayout.STACK, + loop: true, + itemWidth: MediaQuery.of(context).size.width - 42, + indicatorLayout: PageIndicatorLayout.COLOR, + axisDirection: AxisDirection.right, + controller: _controller, + itemHeight: 210 + 16, + pagination: const SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 210 + 8 + 24), + builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + ), + itemBuilder: (BuildContext context, int index) { + return FamilyCardWidget().paddingOnly(right: 16); + }, + ), + GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 105 / 105, crossAxisSpacing: 9, mainAxisSpacing: 9), + physics: const NeverScrollableScrollPhysics(), + padding: const EdgeInsets.all(24), + shrinkWrap: true, + children: [ + Container( + padding: EdgeInsets.all(16), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Column( + children: [ + Row( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 40.h, height: 40.h), + ], + ) + ], + ), + ) + ], + ) + ], + ); + }, + ), + ), + ); + } +} + +class FamilyCardWidget extends StatelessWidget { + FamilyCardWidget(); + + @override + Widget build(BuildContext context) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Column( + children: [ + Column( + spacing: 8.h, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.h, + children: [ + Image.asset(true ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 0.h, + mainAxisSize: MainAxisSize.min, + children: [ + "Mahmoud Shrouf Shrouf".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), + AppCustomChipWidget( + icon: AppAssets.file_icon, + labelText: "File no: 3423443", + iconSize: 14, + ), + ], + ).expanded, + Icon(Icons.qr_code, size: 56) + ], + ).expanded, + SizedBox( + width: double.infinity, + child: Wrap( + alignment: WrapAlignment.start, + spacing: 8.h, + children: [ + AppCustomChipWidget(labelText: "35 Years Old"), + AppCustomChipWidget(labelText: "Blood: A+"), + AppCustomChipWidget( + icon: AppAssets.insurance_active_icon, + labelText: "Insurance Active", + iconColor: AppColors.bgGreenColor, + iconSize: 14, + backgroundColor: AppColors.bgGreenColor.withValues(alpha: 0.15), + ), + ], + ), + ), + ], + ).paddingOnly(top: 16, right: 16, left: 16, bottom: 12).expanded, + Divider( + height: 1, + thickness: 1, + color: Color(0x30D2D2D2), + ), + CustomButton(icon: AppAssets.add_family, text: "Add a new family member", onPressed: () {}).paddingOnly(top: 12, right: 16, left: 16, bottom: 16), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index afbac11..da58aca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,6 +75,7 @@ dependencies: network_info_plus: ^6.1.4 flutter_nfc_kit: ^3.6.0 barcode_scan2: ^4.5.1 + flutter_swiper_view: ^1.1.8 dev_dependencies: flutter_test: