From 85fac13314e145f0713a564c0fb8df18bd3cee03 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 4 Sep 2025 08:35:41 +0300 Subject: [PATCH] changes --- assets/langs/ar-SA.json | 6 +- assets/langs/en-US.json | 6 +- lib/core/enums.dart | 51 +++- lib/extensions/string_extensions.dart | 30 +- .../authentication_view_model.dart | 3 +- lib/generated/locale_keys.g.dart | 4 + .../authentication/saved_login_screen.dart | 289 ++++++++++++++++++ lib/presentation/home/landing_page.dart | 5 +- lib/theme/colors.dart | 1 + .../dropdown/country_dropdown_widget.dart | 89 +++--- lib/widgets/input_widget.dart | 49 +-- pubspec.lock | 22 +- 12 files changed, 452 insertions(+), 103 deletions(-) create mode 100644 lib/presentation/authentication/saved_login_screen.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index df18bfd..0ad2cd6 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -793,5 +793,9 @@ "fullName": "الاسم الكامل", "married": "متزوج", "uae": "الإمارات العربية المتحدة", - "malE": "ذكر" + "malE": "ذكر", + "loginBy": "تسجيل الدخول بواسطة", + "loginByOTP": "تسجيل الدخول بواسطة OTP", + "guest": "زائر", + "switchAccount": "تبديل الحساب" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index c9493db..bbe9b0c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -789,5 +789,9 @@ "fullName": "Full Name", "married": "Married", "uae" : "United Arab Emirates", - "malE": "Male" + "malE": "Male", + "loginBy": "Login By", + "loginByOTP": "Login By OTP", + "guest": "Guest", + "switchAccount": "Switch Account" } \ No newline at end of file diff --git a/lib/core/enums.dart b/lib/core/enums.dart index 2fd5867..34aa911 100644 --- a/lib/core/enums.dart +++ b/lib/core/enums.dart @@ -22,12 +22,6 @@ enum ViewStateEnum { errorLocal, } -enum LoginTypeEnum { - fromLogin, - silentLogin, - silentWithOTP, -} - enum OTPTypeEnum { sms, whatsapp } enum CountryEnum { saudiArabia, unitedArabEmirates } @@ -40,6 +34,51 @@ enum MaritalStatusTypeEnum { single, married, divorced, widowed } enum ChipTypeEnum { success, error, alert, info, warning } +enum LoginTypeEnum { sms, whatsapp, face, fingerprint } + +extension LoginTypeExtension on LoginTypeEnum { + int get toInt { + switch (this) { + case LoginTypeEnum.sms: + return 1; + case LoginTypeEnum.whatsapp: + return 4; + case LoginTypeEnum.face: + return 3; + case LoginTypeEnum.fingerprint: + return 2; + } + } + + String get displayName { + switch (this) { + case LoginTypeEnum.sms: + return 'SMS'; + case LoginTypeEnum.whatsapp: + return 'WhatsApp'; + case LoginTypeEnum.face: + return 'Face Recognition'; + case LoginTypeEnum.fingerprint: + return 'Fingerprint'; + } + } + + static LoginTypeEnum? fromValue(int value) { + switch (value) { + case 1: + return LoginTypeEnum.sms; + case 2: + return LoginTypeEnum.fingerprint; + case 3: + return LoginTypeEnum.face; + case 4: + return LoginTypeEnum.whatsapp; + default: + return null; + } + } +} + extension OTPTypeEnumExtension on OTPTypeEnum { /// Convert enum to int int toInt() { diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index c9d6e39..4d813f0 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -206,19 +206,25 @@ extension EmailValidator on String { Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( this, maxLines: maxlines, - style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 21.fSize, letterSpacing: -0.4, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)), + style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 21.fSize, letterSpacing: -0.4, fontWeight: weight ?? (isBold ? FontWeight.w600 : FontWeight.normal)), ); Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - style: TextStyle(height: 1, color: color ?? AppColors.blackColor, fontSize: 22.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle(height: 1, color: color ?? AppColors.blackColor, fontSize: 22.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), ); Widget toText24({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - style: TextStyle(height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle(height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), + ); + + Widget toText26({Color? color, bool isBold = false, bool isCenter = false, double height = 23/26}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(height: height, color: color ?? AppColors.blackColor, fontSize: 26.fSize, letterSpacing: -1, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), ); Widget toText28({Color? color, bool isBold = false, bool isCenter = false, TextScaler? textScaler}) => Text( @@ -231,20 +237,18 @@ extension EmailValidator on String { Widget toText32({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 32.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 32.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), ); Widget toText36({Color? color, bool isBold = false, bool isCenter = false}) => Text( - this, - textAlign: isCenter ? TextAlign.center : null, - style: TextStyle(height: 47 / 36, color: color ?? AppColors.blackColor, fontSize: 36.fSize, letterSpacing: -1, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), - ); - - + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(height: 47 / 36, color: color ?? AppColors.blackColor, fontSize: 36.fSize, letterSpacing: -1, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), + ); Widget toText44({Color? color, bool isBold = false}) => Text( this, - style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), ); Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { @@ -383,7 +387,6 @@ class FontUtils { } } - extension CountryExtension on CountryEnum { String get displayName { switch (this) { @@ -435,7 +438,6 @@ extension CountryExtension on CountryEnum { } } - extension GenderTypeExtension on GenderTypeEnum { String get value => this == GenderTypeEnum.male ? "M" : "F"; @@ -536,5 +538,3 @@ extension MaritalStatusTypeExtension on MaritalStatusTypeEnum { } } } - - diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index f192db2..baa6f7e 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -26,9 +26,8 @@ class AuthenticationViewModel extends ChangeNotifier { void login() { if (ValidationUtils.isValidatePhoneAndId(nationalId: nationalIdController.text, phoneNumber: phoneNumberController.text)) { - } else { - } + } else {} } Future selectDeviceImei({Function(dynamic)? onSuccess, Function(String)? onError}) async { diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 881e730..0877462 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -793,5 +793,9 @@ abstract class LocaleKeys { static const married = 'married'; static const uae = 'uae'; static const malE = 'malE'; + static const loginBy = 'loginBy'; + static const loginByOTP = 'loginByOTP'; + static const guest = 'guest'; + static const switchAccount = 'switchAccount'; } diff --git a/lib/presentation/authentication/saved_login_screen.dart b/lib/presentation/authentication/saved_login_screen.dart new file mode 100644 index 0000000..da04c40 --- /dev/null +++ b/lib/presentation/authentication/saved_login_screen.dart @@ -0,0 +1,289 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/enums.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/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; +import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; + +class SavedLogin extends StatefulWidget { + // final SelectDeviceIMEIRES savedLoginData; + + // const SavedLogin(this.savedLoginData, {Key? key}) : super(key: key); + const SavedLogin(); + + @override + _SavedLogin createState() => _SavedLogin(); +} + +class _SavedLogin extends State { + LoginTypeEnum loginType = LoginTypeEnum.sms; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + onBackPressed: () {}, + onLanguageChanged: (lang) {}, + ), + body: SafeArea( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 24.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Spacer(flex: 2), + // Welcome back text + LocaleKeys.welcomeBack.tr().toText16(color: AppColors.inputLabelTextColor), + SizedBox(height: 16.h), + ("widget.savedLoginData.name!.toLowerCase().capitalizeFirstofEach").toText26(isBold: true, height: 26 / 36, color: AppColors.textColor), + SizedBox(height: 24.h), + Container( + padding: EdgeInsets.all(16.h), + decoration: BoxDecoration( + color: AppColors.whiteColor, + border: Border.all(color: AppColors.whiteColor), + borderRadius: BorderRadius.circular(24.h), + boxShadow: [ + BoxShadow(color: Color(0x0D000000), blurRadius: 16, offset: Offset(0, 0), spreadRadius: 5), + ], + ), + child: Column( + children: [ + // Last login info + ('LocaleKeys.lastloginBy.tr()' + ' {getType(widget.savedLoginData.logInType!, context)}').toText14(isBold: true, color: AppColors.greyTextColor), + ('widget.savedLoginData.createdOn != null ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(widget.savedLoginData.createdOn!), "d MMMM, y at HH:mm") : --') + .toText16(isBold: true, color: AppColors.textColor), + + Container(margin: EdgeInsets.all(16.h), child: Utils.buildSvgWithAssets(icon: getTypeIcons(loginType.toInt), iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)), + // Face ID login button + Container( + height: 45, + child: CustomButton( + text: "${LocaleKeys.loginBy.tr()} ${loginType.displayName}", + onPressed: () { + if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) { + // loginWithFingerPrintFace(loginType.toInt, widget.savedLoginData.iMEI!); + } else { + int? val = loginType.toInt; + //checkUserAuthentication(val); + } + }, + backgroundColor: Color(0xffED1C2B), + borderColor: Color(0xffFEE9EA), + textColor: Colors.white, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(0, 10, 0, 10), + icon: AppAssets.apple_finder, + ), + ), + ], + ), + ), + const SizedBox(height: 24), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + LocaleKeys.oR.tr(), + style: context.dynamicTextStyle(fontSize: 16, fontWeight: FontWeight.w500), + ), + ), + const SizedBox(height: 24), + // OTP login button + loginType != null && loginType.toInt != 1 + ? Column( + children: [ + loginType.toInt != 1 + ? CustomButton( + text: LocaleKeys.loginByOTP.tr(), + onPressed: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + isDismissible: false, + useSafeArea: true, + backgroundColor: Colors.transparent, + enableDrag: false, + // Prevent dragging to avoid focus conflicts + builder: (bottomSheetContext) => StatefulBuilder(builder: (BuildContext context, StateSetter setModalState) { + return Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom), + child: SingleChildScrollView( + child: GenericBottomSheet( + countryCode: "966", + initialPhoneNumber: "", + textController: TextEditingController(), + isFromSavedLogin: true, + isEnableCountryDropdown: true, + onCountryChange: (value) {}, + onChange: (String? value) {}, + buttons: [ + Padding( + padding: EdgeInsets.only(bottom: 10.h), + child: CustomButton( + text: LocaleKeys.sendOTPSMS.tr(), + onPressed: () { + Navigator.of(context).pop(); + loginType = LoginTypeEnum.sms; + int? val = loginType.toInt; + // checkUserAuthentication(val); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedBorderColor, + textColor: AppColors.whiteColor, + icon: AppAssets.message, + ), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding(padding: EdgeInsets.symmetric(horizontal: 8.h), child: (LocaleKeys.oR.tr()).toText16(color: AppColors.textColor)), + ], + ), + Padding( + padding: const EdgeInsets.only(bottom: 10, top: 10), + child: CustomButton( + text: LocaleKeys.sendOTPWHATSAPP.tr(), + onPressed: () { + Navigator.of(context).pop(); + loginType = LoginTypeEnum.whatsapp; + int? val = loginType.toInt; + // checkUserAuthentication(val); + }, + backgroundColor: AppColors.transparent, + borderColor: AppColors.textColor, + textColor: AppColors.textColor, + icon: AppAssets.whatsapp, + ), + ), + ], + ), + ), + ); + }), + ); + }, + backgroundColor: AppColors.whiteColor, + borderColor: AppColors.borderOnlyColor, + textColor: AppColors.textColor, + borderWidth: 2, + padding: EdgeInsets.fromLTRB(0, 14, 0, 14), + icon: AppAssets.password_validation, + ) + : Container(), + SizedBox( + height: 20, + ), + ], + ) + : CustomButton( + text: "${LocaleKeys.loginBy.tr()} ${LoginTypeEnum.whatsapp.displayName}", + onPressed: () { + if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) { + // loginWithFingerPrintFace(loginType.toInt, "iMEI"); + } else { + loginType = LoginTypeEnum.whatsapp; + int? val = loginType.toInt; + // checkUserAuthentication(val); + } + }, + backgroundColor: AppColors.whiteColor, + borderColor: Color(0xFF2E3039), + textColor: Color(0xFF2E3039), + borderWidth: 2, + padding: EdgeInsets.fromLTRB(0, 14, 0, 14), + icon: AppAssets.whatsapp, + ), + const Spacer(flex: 2), + // OR divider + + const SizedBox(height: 24), + // Guest and Switch account + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Container( + height: 56, + child: CustomButton( + text: LocaleKeys.guest.tr(), + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (BuildContext context) => LoginScreen()), + ); + }, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Color(0xffED1C2B), + fontSize: 16, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(0, 10, 0, 10), + // icon: "assets/images/svg/apple-finder.svg", + ), + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.05, + ), + Expanded( + child: Container( + height: 56, + child: CustomButton( + text: LocaleKeys.switchAccount.tr(), + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (BuildContext context) => LoginScreen()), + ); + }, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Color(0xffED1C2B), + fontSize: 15, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(0, 10, 0, 10), + // icon: "assets/images/svg/apple-finder.svg", + ), + ), + ), + ], + ), + const SizedBox(height: 20), + ], + ), + ), + ), + ); + } + + String getTypeIcons(int type) { + final types = { + 1: AppAssets.sms, + 2: AppAssets.fingerprint, + 3: AppAssets.fingerprint, + 4: AppAssets.whatsapp, + }; + + if (types.containsKey(type)) { + return types[type]!; + } else { + throw Exception('Invalid login type: $type'); + } + } +} diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 60161f0..5e755d1 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -179,10 +179,7 @@ class _LandingPageState extends State { ) : Container( height: 127.h, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24, - ), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), child: Padding( padding: EdgeInsets.all(16.h), child: Column( diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 4b2d69b..c1b9541 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -34,6 +34,7 @@ class AppColors { static const Color blackBgColor = Color(0xFF2E3039); static const blackColor = textColor; static const inputLabelTextColor = Color(0xff898A8D); + static const greyTextColor = Color(0xFF8F9AA3); static const lightGreenColor = Color(0xFF0ccedde); diff --git a/lib/widgets/dropdown/country_dropdown_widget.dart b/lib/widgets/dropdown/country_dropdown_widget.dart index 5e4bddf..603cfed 100644 --- a/lib/widgets/dropdown/country_dropdown_widget.dart +++ b/lib/widgets/dropdown/country_dropdown_widget.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; @@ -5,17 +6,24 @@ 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/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'; class CustomCountryDropdown extends StatefulWidget { final List countryList; final Function(CountryEnum)? onCountryChange; final bool isRtl; + final bool isFromBottomSheet; + final bool isEnableTextField; + Widget? textField; - const CustomCountryDropdown({ + CustomCountryDropdown({ Key? key, required this.countryList, this.onCountryChange, required this.isRtl, + this.isFromBottomSheet = false, + this.isEnableTextField = false, + this.textField, }) : super(key: key); @override @@ -52,15 +60,36 @@ class _CustomCountryDropdownState extends State { SizedBox(width: 8.h), Utils.buildSvgWithAssets(icon: _isDropdownOpen ? AppAssets.dropdow_icon : AppAssets.dropdow_icon), SizedBox(width: 4.h), - Text( - selectedCountry != null ? selectedCountry!.displayName : "Select Country", - style: TextStyle( - fontSize: 14.fSize, - height: 21 / 14, - fontWeight: FontWeight.w500, - letterSpacing: -0.2, + if (widget.isFromBottomSheet) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + Text( + LocaleKeys.phoneNumber.tr(), + style: TextStyle(fontSize: 12.fSize, height: 21 / 12, fontWeight: FontWeight.w500, letterSpacing: -1), + ), + ], + ), + Row( + children: [ + Text( + selectedCountry!.countryCode, + style: TextStyle(fontSize: 12.fSize, height: 21 / 18, fontWeight: FontWeight.w600, letterSpacing: -0.2), + ), + SizedBox(width: 4.h), + if (widget.isEnableTextField) widget.textField!, + ], + ) + ], + ), + if (!widget.isFromBottomSheet) + Text( + selectedCountry != null ? selectedCountry!.displayName : "Select Country", + style: TextStyle(fontSize: 14.fSize, height: 21 / 14, fontWeight: FontWeight.w500, letterSpacing: -0.2), ), - ), ], ), ), @@ -84,27 +113,11 @@ class _CustomCountryDropdownState extends State { ), Positioned( top: offset.dy + renderBox.size.height, - left: widget.isRtl ? offset.dx + 15.h : offset.dx - 15.h, + left: widget.isRtl ? offset.dx + 6.h : offset.dx - 6.h, width: renderBox.size.width, child: Material( child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: Colors.white, - borderRadius: 12, - ), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // boxShadow: [ - // BoxShadow( - // color: Color(0xFFF8F8FA), - // blurRadius: 8.h, - // offset: Offset( - // 0, - // 2, - // ), - // ), - // ], - // ), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 12), child: Column( children: widget.countryList .map( @@ -117,25 +130,13 @@ class _CustomCountryDropdownState extends State { _closeDropdown(); }, child: Container( - padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 16.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - borderRadius: 16.h, - ), + padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 16.h), child: Row( children: [ - Utils.buildSvgWithAssets( - icon: country.iconPath, - width: 38.h, - height: 38.h, - ), - SizedBox(width: 12.h), - Text(country.displayName, - style: TextStyle( - fontSize: 14.fSize, - height: 21 / 14, - fontWeight: FontWeight.w500, - letterSpacing: -0.2, - )), + Utils.buildSvgWithAssets(icon: country.iconPath, width: 38.h, height: 38.h), + if (!widget.isFromBottomSheet) SizedBox(width: 12.h), + if (!widget.isFromBottomSheet) Text(country.displayName, style: TextStyle(fontSize: 14.fSize, height: 21 / 14, fontWeight: FontWeight.w500, letterSpacing: -0.2)), ], ), ), diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart index ca72fe8..6cefbbf 100644 --- a/lib/widgets/input_widget.dart +++ b/lib/widgets/input_widget.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/utils.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/widgets/dropdown/country_dropdown_widget.dart'; // TODO: Import AppColors if bgRedColor is defined there // import 'package:hmg_patient_app_new/core/ui_utils/app_colors.dart'; @@ -72,17 +74,26 @@ class TextInputWidget extends StatelessWidget { child: Row( textDirection: Directionality.of(context), children: [ - if (isAllowLeadingIcon && leadingIcon != null) _buildLeadingIcon(context), - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildLabelText(), - _buildTextField(context), - ], + if (isAllowLeadingIcon && leadingIcon != null) + isCountryDropDown + ? CustomCountryDropdown( + countryList: CountryEnum.values, + onCountryChange: (CountryEnum? value) {}, + isRtl: Directionality.of(context) == TextDirection.rtl, + isFromBottomSheet: isCountryDropDown, + isEnableTextField:true, + textField: _buildTextField(context), + ) + : Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildLabelText(), + _buildTextField(context), + ], + ), ), - ), ], ), ), @@ -161,15 +172,15 @@ class TextInputWidget extends StatelessWidget { prefixIcon: prefix == null ? null : Text( - "+" + prefix!, - style: TextStyle( - fontSize: 14.fSize, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: Color(0xff2E303A), - letterSpacing: -0.2, - ), - ), + "+" + prefix!, + style: TextStyle( + fontSize: 14.fSize, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.2, + ), + ), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, diff --git a/pubspec.lock b/pubspec.lock index 679a57e..5665d11 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -874,26 +874,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.1" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -1455,10 +1455,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.6" time: dependency: transitive description: @@ -1583,10 +1583,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -1636,5 +1636,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.7.0 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.29.0"