From 24a4020f5c4472edead762ce1165d9eea3ec2dcd Mon Sep 17 00:00:00 2001 From: Aamir Muhammad Date: Tue, 12 Aug 2025 16:43:03 +0300 Subject: [PATCH] fixes --- lib/config/localized_values.dart | 4 +- .../ExceptionBottomSheet.dart | 31 +- .../otp/otp_validation_bootmsheet_widget.dart | 115 +- .../health_calculator/carbs/carbs.dart | 1311 ++++++++--------- lib/pages/login/register_new.dart | 4 +- lib/pages/login/saved_login.dart | 34 +- lib/pages/login/welcome.dart | 2 +- lib/uitl/utils.dart | 21 + lib/widgets/drawer/langauge_picker.dart | 2 +- lib/widgets/others/app_scaffold_widget.dart | 1 + lib/widgets/quick_login.dart | 2 +- 11 files changed, 730 insertions(+), 797 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7bb585d1..eb14cadc 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -29,8 +29,8 @@ const Map localizedValues = { 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'lanEnglish': {'en': 'English', 'ar': 'English'}, 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, - 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, - 'done': {'en': 'DONE', 'ar': 'تأكيد'}, + 'cancel': {'en': 'Cancel', 'ar': 'الغاء'}, + 'done': {'en': 'Done', 'ar': 'تأكيد'}, 'replay2': {'en': 'Replay', 'ar': 'رد الطبيب'}, 'home': {'en': 'Home', 'ar': 'الرئيسية'}, 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, diff --git a/lib/new_ui/exception_widget/ExceptionBottomSheet.dart b/lib/new_ui/exception_widget/ExceptionBottomSheet.dart index af734520..44c5453c 100644 --- a/lib/new_ui/exception_widget/ExceptionBottomSheet.dart +++ b/lib/new_ui/exception_widget/ExceptionBottomSheet.dart @@ -56,7 +56,7 @@ class _ExceptionBottomSheetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AppText(TranslationBase.of(context).notice, fontSize: 28, letterSpacing: -2, color: Color(0xFF2E3039), fontWeight: FontWeight.w600), + AppText(TranslationBase.of(context).notice, fontSize: 28, letterSpacing: -1, color: Color(0xFF2E3039), fontWeight: FontWeight.w600), InkWell( onTap: () { Navigator.of(context).pop(); @@ -72,25 +72,20 @@ class _ExceptionBottomSheetState extends State { Row( children: [ Expanded( - child: Padding( - padding: const EdgeInsets.only(right: 8), - child: CustomButton( - text: TranslationBase.of(context).cancel, - onPressed: widget.onCancelPressed != null - ? widget.onCancelPressed! - : () { - Navigator.of(context).pop(); - }, - backgroundColor: CustomColors.bgRedLightColor, - borderColor: CustomColors.bgRedLightColor, - textColor: CustomColors.bgRedColor, - icon: "assets/images/svg/cancel.svg", - ), + child: CustomButton( + text: TranslationBase.of(context).cancel, + onPressed: widget.onCancelPressed != null + ? widget.onCancelPressed! + : () { + Navigator.of(context).pop(); + }, + backgroundColor: CustomColors.bgRedLightColor, + borderColor: CustomColors.bgRedLightColor, + textColor: CustomColors.bgRedColor, + icon: "assets/images/svg/cancel.svg", ), ), - SizedBox( - width: 16, - ), + SizedBox(width: MediaQuery.of(context).size.width * 0.05), Expanded( child: CustomButton( text: widget.showCancel ? TranslationBase.of(context).confirm : TranslationBase.of(context).ok, diff --git a/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart b/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart index 45331cd9..2b209fa4 100644 --- a/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart +++ b/lib/new_ui/otp/otp_validation_bootmsheet_widget.dart @@ -8,6 +8,7 @@ import 'package:hmg_patient_app/uitl/translations_delegate_base.dart'; import 'package:hmg_patient_app/uitl/utils.dart'; import 'package:hmg_patient_app/uitl/font_utils.dart'; import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart'; +import 'package:smooth_corner/smooth_corner.dart'; class GenericBottomSheet extends StatefulWidget { String? countryCode; @@ -86,7 +87,8 @@ class _GenericBottomSheetState extends State { ? TranslationBase.of(context).enterEmail : TranslationBase.of(context).enterPhoneNumber, fontSize: 28, - letterSpacing: -2, + letterSpacing: -1, + height: 1.33, color: Color(0xFF2E3039), fontWeight: FontWeight.w600), ), @@ -100,7 +102,7 @@ class _GenericBottomSheetState extends State { )), ], ), - const SizedBox(height: 10), + const SizedBox(height: 8), // Subtitle AppText( widget.isFromSavedLogin @@ -109,9 +111,9 @@ class _GenericBottomSheetState extends State { ? TranslationBase.of(context).enterEmailDesc : TranslationBase.of(context).enterPhoneDesc, fontSize: 16, + height: 1.33, color: Color(0xFF2E3039), fontWeight: FontWeight.w500), - const SizedBox(height: 10), if (widget.isFromSavedLogin) ...[] @@ -120,35 +122,6 @@ class _GenericBottomSheetState extends State { ? Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - // Directionality( - // textDirection: TextDirection.ltr, - // child: newInputWidget( - // labelText: widget.isForEmail ? TranslationBase.of(context).email : TranslationBase.of(context).phoneNumber, - // hintText: widget.isForEmail ? "demo@gmail.com" : "5xxxxxxxx", - // controller: widget.textController, - // padding: const EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8), - // keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number, - // onChange: (value) { - // if (value != null) { - // widget.textController?.text = value; - // widget.onChange?.call(value); - // } - // }, - // isEnable: true, - // autoFocus: true, - // keepFocus: true, - // refocusOnChange: true, - // isReadOnly: widget.isFromSavedLogin, - // prefix: widget.isForEmail ? null : widget.countryCode, - // hasSelection: false, - // isBorderAllowed: false, - // isAllowLeadingIcon: true, - // countryList: Country.values, - // isCountryDropDown: widget.isEnableCountryDropdown, - // onCountryChange: widget.onCountryChange, - // leadingIcon: widget.isForEmail ? "assets/images/svg/email.svg" : "assets/images/svg/smart-phone.svg", - // ), - // ), Directionality( textDirection: TextDirection.ltr, child: newInputWidget( @@ -218,7 +191,7 @@ class CustomButton extends StatelessWidget { this.borderColor = const Color(0xFFED1C2B), this.textColor = Colors.white, this.borderRadius = 12, - this.borderWidth = 1, + this.borderWidth = 2, this.padding = const EdgeInsets.fromLTRB(8, 10, 8, 10), this.fontSize = 16, this.fontFamily, @@ -230,44 +203,50 @@ class CustomButton extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: isDisabled ? null : onPressed, - child: Container( - height: 56, - decoration: BoxDecoration( - color: isDisabled ? backgroundColor.withOpacity(0.5) : backgroundColor, - borderRadius: BorderRadius.circular(borderRadius), - border: Border.all( - color: isDisabled ? borderColor.withOpacity(0.5) : borderColor, - width: borderWidth, + onTap: isDisabled ? null : onPressed, + child: Container( + height: 56, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: isDisabled ? backgroundColor.withOpacity(0.5) : backgroundColor, + borderRadius: borderRadius, ), - ), - child: Padding( - padding: padding, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (icon != null) - Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - icon!, - width: 24, - height: 24, + child: Padding( + padding: padding, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (icon != null) + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + icon!, + width: 24, + height: 24, + ), + ), + Text( + text, + style: context.dynamicTextStyle( + fontSize: fontSize, + color: isDisabled ? textColor.withOpacity(0.5) : textColor, + fontWeight: fontWeight, ), ), - Text( - text, - style: context.dynamicTextStyle( - fontSize: fontSize, - color: isDisabled ? textColor.withOpacity(0.5) : textColor, - fontWeight: fontWeight, - ), - ), - ], + ], + ), ), - ), - ), - ); + ) + + // .toSmoothContainer( + // smoothness: 1, + // side: BorderSide(width: borderWidth, color: backgroundColor), + // borderRadius: BorderRadius.circular(borderRadius * 1.2), + // foregroundDecoration: BoxDecoration( + // color: isDisabled ? backgroundColor.withOpacity(0.5) : Colors.transparent, + // borderRadius: BorderRadius.circular(borderRadius), + // ), + // ), + ); } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index d13aebd9..927c8889 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -42,37 +42,27 @@ class _CarbsState extends State { double? fCalMeal; void calculateDietRatios() { - if (dropdownValue == TranslationBase - .of(context) - .dietVeryLow) { + if (dropdownValue == TranslationBase.of(context).dietVeryLow) { meals = 3; protein = 45; carbs = 10; fat = 45; - } else if (dropdownValue == TranslationBase - .of(context) - .dietLow) { + } else if (dropdownValue == TranslationBase.of(context).dietLow) { meals = 3; protein = 40; carbs = 30; fat = 30; - } else if (dropdownValue == TranslationBase - .of(context) - .dietModerate) { + } else if (dropdownValue == TranslationBase.of(context).dietModerate) { meals = 3; protein = 25; carbs = 50; fat = 25; - } else if (dropdownValue == TranslationBase - .of(context) - .dietUSDA) { + } else if (dropdownValue == TranslationBase.of(context).dietUSDA) { meals = 3; protein = 15; carbs = 55; fat = 30; - } else if (dropdownValue == TranslationBase - .of(context) - .dietZone) { + } else if (dropdownValue == TranslationBase.of(context).dietZone) { meals = 3; protein = 30; carbs = 40; @@ -98,17 +88,13 @@ class _CarbsState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - dropdownValue = TranslationBase - .of(context) - .dietVeryLow; + dropdownValue = TranslationBase.of(context).dietVeryLow; return AppScaffold( isShowAppBar: true, isShowDecPage: false, showNewAppBarTitle: true, showNewAppBar: true, - appBarTitle: TranslationBase - .of(context) - .carbohydrate, + appBarTitle: TranslationBase.of(context).carbohydrate, appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), @@ -128,9 +114,7 @@ class _CarbsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .carbProteinDesc, + TranslationBase.of(context).carbProteinDesc, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -145,9 +129,7 @@ class _CarbsState extends State { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ - inputWidget(TranslationBase - .of(context) - .calDay, "0", textController), + inputWidget(TranslationBase.of(context).calDay, "0", textController), InkWell( onTap: () { Navigator.push( @@ -158,14 +140,8 @@ class _CarbsState extends State { child: Padding( padding: const EdgeInsets.all(12.0), child: Text( - TranslationBase - .of(context) - .notSure, - style: TextStyle(fontSize: 12, - fontWeight: FontWeight.w600, - letterSpacing: -0.56, - color: CustomColors.accentColor, - decoration: TextDecoration.underline), + TranslationBase.of(context).notSure, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline), ), ), ) @@ -190,9 +166,7 @@ class _CarbsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .selectDiet, + TranslationBase.of(context).selectDiet, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -221,21 +195,11 @@ class _CarbsState extends State { }); }, items: [ - TranslationBase - .of(context) - .dietVeryLow, - TranslationBase - .of(context) - .dietLow, - TranslationBase - .of(context) - .dietModerate, - TranslationBase - .of(context) - .dietUSDA, - TranslationBase - .of(context) - .dietZone + TranslationBase.of(context).dietVeryLow, + TranslationBase.of(context).dietLow, + TranslationBase.of(context).dietModerate, + TranslationBase.of(context).dietUSDA, + TranslationBase.of(context).dietZone ].map>((String value) { return DropdownMenuItem( value: value, @@ -269,9 +233,7 @@ class _CarbsState extends State { margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, child: SecondaryButton( - label: TranslationBase - .of(context) - .calculate, + label: TranslationBase.of(context).calculate, color: CustomColors.accentColor, onTap: () { setState(() { @@ -281,16 +243,16 @@ class _CarbsState extends State { context, FadePage( page: CarbsResult( - cCal: cCal!, - pCal: pCal!, - fCal: fCal!, - pCalGram: pCalGram!, - pCalMeal: pCalMeal!, - fCalGram: fCalGram!, - fCalMeal: fCalMeal!, - cCalGram: cCalGram!, - cCalMeal: cCalMeal!, - )), + cCal: cCal!, + pCal: pCal!, + fCal: fCal!, + pCalGram: pCalGram!, + pCalMeal: pCalMeal!, + fCalGram: fCalGram!, + fCalMeal: fCalMeal!, + cCalGram: cCalGram!, + cCalMeal: cCalMeal!, + )), ); } }); @@ -346,30 +308,31 @@ class _CarbsState extends State { // } } -Widget inputWidget(String _labelText, - String _hintText, - TextEditingController? _controller, { - Function(String?)? onChange, - String? prefix, - bool isEnable = true, - bool hasSelection = false, - bool hasSelectionCustomIcon = false, - String? selectionCustomIcon, - bool isBorderAllowed = true, - bool isAllowLeadingIcon = false, - bool isLeadingCountry = false, - String? leadingIcon, - bool removePadding = false, - bool isAllowRadius = true, - bool isReadOnly = false, - TextInputType keyboardType = TextInputType.number, - List? dropdownItems, - String? selectedValue, - SelectionType? selectionType, - Function(bool)? onCalendarTypeChanged, - EdgeInsetsGeometry? padding, - String lang = 'en', - }) { +Widget inputWidget( + String _labelText, + String _hintText, + TextEditingController? _controller, { + Function(String?)? onChange, + String? prefix, + bool isEnable = true, + bool hasSelection = false, + bool hasSelectionCustomIcon = false, + String? selectionCustomIcon, + bool isBorderAllowed = true, + bool isAllowLeadingIcon = false, + bool isLeadingCountry = false, + String? leadingIcon, + bool removePadding = false, + bool isAllowRadius = true, + bool isReadOnly = false, + TextInputType keyboardType = TextInputType.number, + List? dropdownItems, + String? selectedValue, + SelectionType? selectionType, + Function(bool)? onCalendarTypeChanged, + EdgeInsetsGeometry? padding, + String lang = 'en', +}) { return Builder( builder: (context) { final isRtl = Directionality.of(context) == TextDirection.rtl; @@ -380,8 +343,8 @@ Widget inputWidget(String _labelText, padding: padding != null ? padding : removePadding - ? const EdgeInsets.only(top: 16, bottom: 16) - : const EdgeInsets.symmetric(horizontal: 16, vertical: 15), + ? const EdgeInsets.only(top: 16, bottom: 16) + : const EdgeInsets.symmetric(horizontal: 16, vertical: 15), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, @@ -419,176 +382,175 @@ Widget inputWidget(String _labelText, letterSpacing: -0.2, height: 18 / 12, ) - // style: TextStyle( - // fontSize: 12, - // fontWeight: FontWeight.w500, - // color: const Color(0xff898A8D), - // // fontFamily: FontUtils.getFontFamily(context), - // letterSpacing: -0.2, - // height: 18 / 12, - // ), - ), + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.w500, + // color: const Color(0xff898A8D), + // // fontFamily: FontUtils.getFontFamily(context), + // letterSpacing: -0.2, + // height: 18 / 12, + // ), + ), ), hasSelection ? GestureDetector( - onTap: isEnable && !isReadOnly - ? () async { - if (selectionType == SelectionType.dropdown) { - final renderBox = context.findRenderObject() as RenderBox; - final offset = renderBox.localToGlobal(Offset.zero); - final selected = await showMenu( - context: context, - position: RelativeRect.fromLTRB( - offset.dx, - offset.dy + renderBox.size.height, - offset.dx + renderBox.size.width, - 0, - ), - items: dropdownItems - ?.map( - (e) => - PopupMenuItem( - value: e, - child: Text(e), - ), - ) - .toList() ?? - [], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ); + onTap: isEnable && !isReadOnly + ? () async { + if (selectionType == SelectionType.dropdown) { + final renderBox = context.findRenderObject() as RenderBox; + final offset = renderBox.localToGlobal(Offset.zero); + final selected = await showMenu( + context: context, + position: RelativeRect.fromLTRB( + offset.dx, + offset.dy + renderBox.size.height, + offset.dx + renderBox.size.width, + 0, + ), + items: dropdownItems + ?.map( + (e) => PopupMenuItem( + value: e, + child: Text(e), + ), + ) + .toList() ?? + [], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ); - if (selected != null && onChange != null) { - onChange(selected); - } - } else if (selectionType == SelectionType.calendar) { - bool isGregorian = true; - // final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); - final picked = await showHijriGregBottomSheet( - context, - switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), - // fontFamily: FontUtils.getFontFamily(context), - language: lang, - initialDate: DateTime.now(), - okWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/confirm.svg", - width: 24, - height: 24, - ), - ), - cancelWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - colorFilter: ColorFilter.mode( - Colors.white, - BlendMode.srcIn, + if (selected != null && onChange != null) { + onChange(selected); + } + } else if (selectionType == SelectionType.calendar) { + bool isGregorian = true; + // final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); + final picked = await showHijriGregBottomSheet( + context, + switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), + // fontFamily: FontUtils.getFontFamily(context), + language: lang, + initialDate: DateTime.now(), + okWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/confirm.svg", + width: 24, + height: 24, + ), + ), + cancelWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + width: 24, + height: 24, + ), + ), + onCalendarTypeChanged: (bool value) { + isGregorian = value; + }, + ); + if (picked != null && onChange != null) { + if (onCalendarTypeChanged != null) { + onCalendarTypeChanged.call(isGregorian); + } + onChange(picked.toIso8601String()); + } + } + } + : null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text((selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, + textAlign: isRtl ? TextAlign.right : TextAlign.left, + textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + // fontFamily: FontUtils.getFontFamily(context), + color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), + letterSpacing: -0.2, + ) + // style: TextStyle( + // fontSize: 14, + // height: 21 / 14, + // fontWeight: FontWeight.w500, + // // fontFamily: FontUtils.getFontFamily(context), + // color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), + // letterSpacing: -0.2, + // ), + ), ), - width: 24, - height: 24, - ), - ), - onCalendarTypeChanged: (bool value) { - isGregorian = value; - }, - ); - if (picked != null && onChange != null) { - if (onCalendarTypeChanged != null) { - onCalendarTypeChanged.call(isGregorian); - } - onChange(picked.toIso8601String()); - } - } - } - : null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text((selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, - textAlign: isRtl ? TextAlign.right : TextAlign.left, - textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - // fontFamily: FontUtils.getFontFamily(context), - color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - letterSpacing: -0.2, - ) - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontWeight: FontWeight.w500, - // // fontFamily: FontUtils.getFontFamily(context), - // color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - // letterSpacing: -0.2, - // ), + if (hasSelectionCustomIcon && selectionCustomIcon != null) + SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) + else + const Icon(Icons.keyboard_arrow_down_outlined), + ], ), - ), - if (hasSelectionCustomIcon && selectionCustomIcon != null) - SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) - else - const Icon(Icons.keyboard_arrow_down_outlined), - ], - ), - ) + ) : TextField( - enabled: isEnable, - scrollPadding: EdgeInsets.zero, - keyboardType: keyboardType, - controller: _controller, - readOnly: isReadOnly, - textAlignVertical: TextAlignVertical.top, - textAlign: isRtl ? TextAlign.right : TextAlign.left, - textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, - onChanged: onChange, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: const Color(0xff2E3039), - letterSpacing: -0.2, - ), - // TextStyle( - // fontSize: 14, - // height: 21 / 14, - // // fontFamily: FontUtils.getFontFamily(context), - // - // fontWeight: FontWeight.w500, - // color: const Color(0xff2E3039), - // letterSpacing: -0.2, - // ), - decoration: InputDecoration( - isDense: true, - hintText: _hintText, - hintStyle: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 16, - fontWeight: FontWeight.w500, - color: const Color(0xff898A8D), - letterSpacing: -0.2, - ), - prefixIconConstraints: const BoxConstraints(minWidth: 45), - prefixIcon: prefix == null - ? null - : Text("+" + prefix, + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: keyboardType, + controller: _controller, + readOnly: isReadOnly, + textAlignVertical: TextAlignVertical.top, + textAlign: isRtl ? TextAlign.right : TextAlign.left, + textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr, + onChanged: onChange, style: context.dynamicTextStyle( fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, - color: const Color(0xff2E303A), + color: const Color(0xff2E3039), letterSpacing: -0.2, - )), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), - ), + ), + // TextStyle( + // fontSize: 14, + // height: 21 / 14, + // // fontFamily: FontUtils.getFontFamily(context), + // + // fontWeight: FontWeight.w500, + // color: const Color(0xff2E3039), + // letterSpacing: -0.2, + // ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 16, + fontWeight: FontWeight.w500, + color: const Color(0xff898A8D), + letterSpacing: -0.2, + ), + prefixIconConstraints: const BoxConstraints(minWidth: 45), + prefixIcon: prefix == null + ? null + : Text("+" + prefix, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: const Color(0xff2E303A), + letterSpacing: -0.2, + )), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), ], ), ), @@ -601,86 +563,81 @@ Widget inputWidget(String _labelText, } Widget newInputWidget( - String _labelText, - String _hintText, - TextEditingController? _controller, { - Function(String?)? onChange, - String? prefix, - bool isEnable = true, - bool hasSelection = false, - bool hasSelectionCustomIcon = false, - String? selectionCustomIcon, - bool isBorderAllowed = true, - bool isAllowLeadingIcon = false, - bool isLeadingCountry = false, - String? leadingIcon, - bool removePadding = false, - bool isAllowRadius = true, - bool isReadOnly = false, - TextInputType keyboardType = TextInputType.number, - List? dropdownItems, - String? selectedValue, - SelectionType? selectionType, - Function(bool)? onCalendarTypeChanged, - EdgeInsetsGeometry? padding, - String lang = 'en', - bool isCountryDropDown = false, - List countryList = const [], - FocusNode? focusNode, - bool autoFocus = false, - Function(Country)? onCountryChange, - Key? key, - }) { + String _labelText, + String _hintText, + TextEditingController? _controller, { + Function(String?)? onChange, + String? prefix, + bool isEnable = true, + bool hasSelection = false, + bool hasSelectionCustomIcon = false, + String? selectionCustomIcon, + bool isBorderAllowed = true, + bool isAllowLeadingIcon = false, + bool isLeadingCountry = false, + String? leadingIcon, + bool removePadding = false, + bool isAllowRadius = true, + bool isReadOnly = false, + TextInputType keyboardType = TextInputType.number, + List? dropdownItems, + String? selectedValue, + SelectionType? selectionType, + Function(bool)? onCalendarTypeChanged, + EdgeInsetsGeometry? padding, + String lang = 'en', + bool isCountryDropDown = false, + List countryList = const [], + FocusNode? focusNode, + bool autoFocus = false, + Function(Country)? onCountryChange, + Key? key, +}) { return Builder( builder: (context) { // final isRtl = Directionality.of(context) == TextDirection.ltr; return Container( padding: padding, - // padding: removePadding && isAllowLeadingIcon && prefix == null - // ? const EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8) - // : removePadding && !hasSelection - // ? const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0) - // : removePadding && hasSelection - // ? null - // : const EdgeInsets.symmetric(horizontal: 16, vertical: 15), alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, - color: Colors.white, - border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null, - ), + // decoration: BoxDecoration( + // borderRadius: isAllowRadius ? BorderRadius.circular(15) : null, + // color: Colors.white, + // border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null, + // ), + decoration: RoundedRectangleBorder() + .toSmoothCornerDecoration(color: Colors.white, borderRadius: isAllowRadius ? 15 : null, side: isBorderAllowed ? BorderSide(color: const Color(0xffefefef), width: 1) : null), child: Row( textDirection: Directionality.of(context), children: [ if (isAllowLeadingIcon && leadingIcon != null) isCountryDropDown ? _CustomCountryDropdown( - logo: SvgPicture.asset( - prefix == "966" ? "assets/images/svg/ksa.svg" : "assets/images/svg/uae.svg", - width: 40, - height: 40, - fit: BoxFit.cover, - ), - countryList: countryList, - onCountryChange: onCountryChange, - isRtl: Directionality.of(context) == TextDirection.rtl, - ) + logo: SvgPicture.asset( + prefix == "966" ? "assets/images/svg/ksa.svg" : "assets/images/svg/uae.svg", + width: 40, + height: 40, + fit: BoxFit.cover, + ), + countryList: countryList, + onCountryChange: onCountryChange, + isRtl: Directionality.of(context) == TextDirection.rtl, + ) : Container( - height: 40, - width: 40, - margin: const EdgeInsets.only(right: 10), - padding: isLeadingCountry ? null : const EdgeInsets.all(8), - decoration: const BoxDecoration( - color: Color(0xFFEFEFF0), - borderRadius: BorderRadius.all(Radius.circular(10)), - ), - child: SvgPicture.asset( - leadingIcon, - width: 24, - height: 24, - fit: BoxFit.cover, - ), - ), + height: 40, + width: 40, + margin: const EdgeInsets.only(right: 10), + padding: isLeadingCountry ? null : const EdgeInsets.all(8), + decoration: const BoxDecoration( + color: Color(0xFFEFEFF0), + borderRadius: BorderRadius.all(Radius.circular(10)), + ), + child: SvgPicture.asset( + leadingIcon, + width: 24, + height: 24, + fit: BoxFit.cover, + ), + ), Expanded( child: Column( mainAxisSize: MainAxisSize.min, @@ -698,153 +655,154 @@ Widget newInputWidget( ), hasSelection ? GestureDetector( - onTap: isEnable && !isReadOnly - ? () async { - if (selectionType == SelectionType.dropdown) { - final renderBox = context.findRenderObject() as RenderBox; - final offset = renderBox.localToGlobal(Offset.zero); - final selected = await showMenu( - context: context, - position: RelativeRect.fromLTRB( - offset.dx, - offset.dy + renderBox.size.height, - offset.dx + renderBox.size.width, - 0, - ), - items: dropdownItems - ?.map( - (e) => PopupMenuItem( - value: e, - child: Text(e), - ), - ) - .toList() ?? - [], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ); + onTap: isEnable && !isReadOnly + ? () async { + if (selectionType == SelectionType.dropdown) { + final renderBox = context.findRenderObject() as RenderBox; + final offset = renderBox.localToGlobal(Offset.zero); + final selected = await showMenu( + context: context, + position: RelativeRect.fromLTRB( + offset.dx, + offset.dy + renderBox.size.height, + offset.dx + renderBox.size.width, + 0, + ), + items: dropdownItems + ?.map( + (e) => PopupMenuItem( + value: e, + child: Text(e), + ), + ) + .toList() ?? + [], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ); - if (selected != null && onChange != null) { - onChange(selected); - } - } else if (selectionType == SelectionType.calendar) { - bool isGregorian = true; - // final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); - final picked = await showHijriGregBottomSheet( - context, - switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), - // fontFamily: FontUtils.getFontFamily(context), - language: lang, - fontFamily: FontUtils.getFontFamilyForLanguage(context.selectedLanguage == "ar" ? true : false), - initialShowGregorian: true, - initialDate: DateTime.now(), - okWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/confirm.svg", - width: 24, - height: 24, - ), - ), - cancelWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - colorFilter: ColorFilter.mode( - Colors.white, - BlendMode.srcIn, + if (selected != null && onChange != null) { + onChange(selected); + } + } else if (selectionType == SelectionType.calendar) { + bool isGregorian = true; + // final picked = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1900), lastDate: DateTime(2100)); + final picked = await showHijriGregBottomSheet( + context, + switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), + // fontFamily: FontUtils.getFontFamily(context), + language: lang, + fontFamily: FontUtils.getFontFamilyForLanguage(context.selectedLanguage == "ar" ? true : false), + initialShowGregorian: true, + initialDate: DateTime.now(), + okWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/confirm.svg", + width: 24, + height: 24, + ), + ), + cancelWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + width: 24, + height: 24, + ), + ), + onCalendarTypeChanged: (bool value) { + isGregorian = value; + }, + ); + if (picked != null && onChange != null) { + print(picked.toIso8601String()); + if (onCalendarTypeChanged != null) { + print(isGregorian.toString()); + onCalendarTypeChanged.call(isGregorian); + } + onChange(picked.toIso8601String()); + } + } + } + : null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text((selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, + textAlign: TextAlign.left, + textDirection: TextDirection.ltr, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), + letterSpacing: -0.2, + )), ), - width: 24, - height: 24, - ), + if (hasSelectionCustomIcon && selectionCustomIcon != null) + SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) + else + const Icon(Icons.keyboard_arrow_down_outlined), + ], ), - onCalendarTypeChanged: (bool value) { - isGregorian = value; - }, - ); - if (picked != null && onChange != null) { - print(picked.toIso8601String()); - if (onCalendarTypeChanged != null) { - print(isGregorian.toString()); - onCalendarTypeChanged.call(isGregorian); - } - onChange(picked.toIso8601String()); - } - } - } - : null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text((selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue, - textAlign: TextAlign.left, - textDirection: TextDirection.ltr, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: (selectedValue != null && selectedValue.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - letterSpacing: -0.2, - )), - ), - if (hasSelectionCustomIcon && selectionCustomIcon != null) - SvgPicture.asset(selectionCustomIcon, width: 24, height: 24) - else - const Icon(Icons.keyboard_arrow_down_outlined), - ], - ), - ) + ) : TextField( - enabled: isEnable, - key: key, - scrollPadding: EdgeInsets.zero, - keyboardType: keyboardType, - controller: _controller, - readOnly: isReadOnly, - textAlignVertical: TextAlignVertical.top, - textAlign: TextAlign.left, - textDirection: TextDirection.ltr, - onChanged: onChange, - focusNode: focusNode, - autofocus: autoFocus, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: const Color(0xff2E3039), - letterSpacing: -0.2, - ), - decoration: InputDecoration( - isDense: true, - hintText: _hintText, - hintStyle: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 16, - fontWeight: FontWeight.w500, - color: const Color(0xff898A8D), - letterSpacing: -0.2, - ), - prefixIconConstraints: const BoxConstraints(minWidth: 45), - prefixIcon: prefix == null - ? null - : Text( - "+" + prefix, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: const Color(0xff2E303A), - letterSpacing: -0.2, + enabled: isEnable, + key: key, + scrollPadding: EdgeInsets.zero, + keyboardType: keyboardType, + controller: _controller, + readOnly: isReadOnly, + textAlignVertical: TextAlignVertical.top, + textAlign: TextAlign.left, + textDirection: TextDirection.ltr, + onChanged: onChange, + focusNode: focusNode, + autofocus: autoFocus, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: const Color(0xff2E3039), + letterSpacing: -0.2, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 16, + fontWeight: FontWeight.w500, + color: const Color(0xff898A8D), + letterSpacing: -0.2, + ), + prefixIconConstraints: const BoxConstraints(minWidth: 45), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: const Color(0xff2E303A), + letterSpacing: -0.2, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), ), - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), - ), ], ), ), @@ -1107,8 +1065,7 @@ Widget newInputWidget( // } extension BorderedContainer on Widget { - Widget get withBorderedContainer => - Container( + Widget get withBorderedContainer => Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, decoration: BoxDecoration( @@ -1181,67 +1138,65 @@ class __CustomCountryDropdownState extends State<_CustomCountryDropdown> { Offset offset = renderBox.localToGlobal(Offset.zero); _overlayEntry = OverlayEntry( - builder: (context) => - Stack( - children: [ - // Dismiss dropdown when tapping outside - Positioned.fill( - child: GestureDetector( - onTap: _closeDropdown, - behavior: HitTestBehavior.translucent, - child: Container(), - ), - ), - Positioned( - top: offset.dy + renderBox.size.height, - left: widget.isRtl ? offset.dx + 15 : offset.dx - 15, - width: renderBox.size.width, - child: Material( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Color(0xFFF8F8FA), - blurRadius: 8, - offset: Offset(0, 2), - ), - ], + builder: (context) => Stack( + children: [ + // Dismiss dropdown when tapping outside + Positioned.fill( + child: GestureDetector( + onTap: _closeDropdown, + behavior: HitTestBehavior.translucent, + child: Container(), + ), + ), + Positioned( + top: offset.dy + renderBox.size.height, + left: widget.isRtl ? offset.dx + 15 : offset.dx - 15, + width: renderBox.size.width, + child: Material( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Color(0xFFF8F8FA), + blurRadius: 8, + offset: Offset(0, 2), ), - child: Column( - children: widget.countryList - .map( - (country) => - GestureDetector( - onTap: () { - setState(() { - selectedCountry = country; - }); - widget.onCountryChange?.call(country); - _closeDropdown(); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), - child: Row( - children: [ - SvgPicture.asset( - country.iconPath, - width: 38, - height: 38, - fit: BoxFit.cover, - ), - ], + ], + ), + child: Column( + children: widget.countryList + .map( + (country) => GestureDetector( + onTap: () { + setState(() { + selectedCountry = country; + }); + widget.onCountryChange?.call(country); + _closeDropdown(); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: Row( + children: [ + SvgPicture.asset( + country.iconPath, + width: 38, + height: 38, + fit: BoxFit.cover, ), - ), + ], ), + ), + ), ) - .toList(), - ), - ), + .toList(), ), ), - ], + ), ), + ], + ), ); Overlay.of(context)?.insert(_overlayEntry); @@ -1423,32 +1378,32 @@ class _NewInputFieldState extends State { if (widget.isAllowLeadingIcon && widget.leadingIcon != null) widget.isCountryDropDown ? _CustomCountryDropdown( - logo: SvgPicture.asset( - widget.prefix == "966" ? "assets/images/svg/ksa.svg" : "assets/images/svg/uae.svg", - width: 40, - height: 40, - fit: BoxFit.cover, - ), - countryList: widget.countryList, - onCountryChange: widget.onCountryChange, - isRtl: Directionality.of(context) == TextDirection.rtl, - ) + logo: SvgPicture.asset( + widget.prefix == "966" ? "assets/images/svg/ksa.svg" : "assets/images/svg/uae.svg", + width: 40, + height: 40, + fit: BoxFit.cover, + ), + countryList: widget.countryList, + onCountryChange: widget.onCountryChange, + isRtl: Directionality.of(context) == TextDirection.rtl, + ) : Container( - height: 40, - width: 40, - margin: const EdgeInsets.only(right: 10), - padding: widget.isLeadingCountry ? null : const EdgeInsets.all(8), - decoration: const BoxDecoration( - color: Color(0xFFEFEFF0), - borderRadius: BorderRadius.all(Radius.circular(10)), - ), - child: SvgPicture.asset( - widget.leadingIcon!, - width: 24, - height: 24, - fit: BoxFit.cover, - ), - ), + height: 40, + width: 40, + margin: const EdgeInsets.only(right: 10), + padding: widget.isLeadingCountry ? null : const EdgeInsets.all(8), + decoration: const BoxDecoration( + color: Color(0xFFEFEFF0), + borderRadius: BorderRadius.all(Radius.circular(10)), + ), + child: SvgPicture.asset( + widget.leadingIcon!, + width: 24, + height: 24, + fit: BoxFit.cover, + ), + ), Expanded( child: Column( mainAxisSize: MainAxisSize.min, @@ -1466,149 +1421,148 @@ class _NewInputFieldState extends State { ), widget.hasSelection ? GestureDetector( - onTap: widget.isEnable && !widget.isReadOnly - ? () async { - if (widget.selectionType == SelectionType.dropdown) { - final renderBox = context.findRenderObject() as RenderBox; - final offset = renderBox.localToGlobal(Offset.zero); - final selected = await showMenu( - context: context, - position: RelativeRect.fromLTRB( - offset.dx, - offset.dy + renderBox.size.height, - offset.dx + renderBox.size.width, - 0, - ), - items: widget.dropdownItems - ?.map( - (e) => - PopupMenuItem( - value: e, - child: Text(e), - ), - ) - .toList() ?? - [], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ); + onTap: widget.isEnable && !widget.isReadOnly + ? () async { + if (widget.selectionType == SelectionType.dropdown) { + final renderBox = context.findRenderObject() as RenderBox; + final offset = renderBox.localToGlobal(Offset.zero); + final selected = await showMenu( + context: context, + position: RelativeRect.fromLTRB( + offset.dx, + offset.dy + renderBox.size.height, + offset.dx + renderBox.size.width, + 0, + ), + items: widget.dropdownItems + ?.map( + (e) => PopupMenuItem( + value: e, + child: Text(e), + ), + ) + .toList() ?? + [], + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ); - if (selected != null) { - _handleOnChange(selected); - } - } else if (widget.selectionType == SelectionType.calendar) { - bool isGregorian = true; - final picked = await showHijriGregBottomSheet( - context, - switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), - language: widget.lang, - fontFamily: FontUtils.getFontFamilyForLanguage(context.selectedLanguage == "ar" ? true : false), - initialShowGregorian: true, - initialDate: DateTime.now(), - okWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/confirm.svg", - width: 24, - height: 24, - ), - ), - cancelWidget: Padding( - padding: const EdgeInsets.only(right: 8.0), - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - colorFilter: ColorFilter.mode( - Colors.white, - BlendMode.srcIn, + if (selected != null) { + _handleOnChange(selected); + } + } else if (widget.selectionType == SelectionType.calendar) { + bool isGregorian = true; + final picked = await showHijriGregBottomSheet( + context, + switcherIcon: SvgPicture.asset("assets/images/svg/language.svg", width: 24), + language: widget.lang, + fontFamily: FontUtils.getFontFamilyForLanguage(context.selectedLanguage == "ar" ? true : false), + initialShowGregorian: true, + initialDate: DateTime.now(), + okWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/confirm.svg", + width: 24, + height: 24, + ), + ), + cancelWidget: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), + width: 24, + height: 24, + ), + ), + onCalendarTypeChanged: (bool value) { + isGregorian = value; + }, + ); + if (picked != null) { + if (widget.onCalendarTypeChanged != null) { + widget.onCalendarTypeChanged!.call(isGregorian); + } + _handleOnChange(picked.toIso8601String()); + } + } + } + : null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text((widget.selectedValue == null || widget.selectedValue!.isEmpty) ? widget.hintText : widget.selectedValue!, + textAlign: TextAlign.left, + textDirection: TextDirection.ltr, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: (widget.selectedValue != null && widget.selectedValue!.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), + letterSpacing: -0.2, + )), ), - width: 24, - height: 24, - ), + if (widget.hasSelectionCustomIcon && widget.selectionCustomIcon != null) + SvgPicture.asset(widget.selectionCustomIcon!, width: 24, height: 24) + else + const Icon(Icons.keyboard_arrow_down_outlined), + ], ), - onCalendarTypeChanged: (bool value) { - isGregorian = value; - }, - ); - if (picked != null) { - if (widget.onCalendarTypeChanged != null) { - widget.onCalendarTypeChanged!.call(isGregorian); - } - _handleOnChange(picked.toIso8601String()); - } - } - } - : null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text((widget.selectedValue == null || widget.selectedValue!.isEmpty) ? widget.hintText : widget.selectedValue!, - textAlign: TextAlign.left, - textDirection: TextDirection.ltr, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: (widget.selectedValue != null && widget.selectedValue!.isNotEmpty) ? const Color(0xff2E3039) : const Color(0xffB0B0B0), - letterSpacing: -0.2, - )), - ), - if (widget.hasSelectionCustomIcon && widget.selectionCustomIcon != null) - SvgPicture.asset(widget.selectionCustomIcon!, width: 24, height: 24) - else - const Icon(Icons.keyboard_arrow_down_outlined), - ], - ), - ) + ) : TextField( - enabled: widget.isEnable, - scrollPadding: EdgeInsets.zero, - keyboardType: widget.keyboardType, - controller: widget.controller, - readOnly: widget.isReadOnly, - textAlignVertical: TextAlignVertical.top, - textAlign: TextAlign.left, - textDirection: TextDirection.ltr, - onChanged:_handleOnChange, - focusNode: _internalFocusNode, - autofocus: widget.autoFocus, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: const Color(0xff2E3039), - letterSpacing: -0.2, - ), - decoration: InputDecoration( - isDense: true, - hintText: widget.hintText, - hintStyle: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 16, - fontWeight: FontWeight.w500, - color: const Color(0xff898A8D), - letterSpacing: -0.2, - ), - prefixIconConstraints: const BoxConstraints(minWidth: 45), - prefixIcon: widget.prefix == null - ? null - : Text( - "+" + widget.prefix!, - style: context.dynamicTextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: const Color(0xff2E303A), - letterSpacing: -0.2, + enabled: widget.isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: widget.keyboardType, + controller: widget.controller, + readOnly: widget.isReadOnly, + textAlignVertical: TextAlignVertical.top, + textAlign: TextAlign.left, + textDirection: TextDirection.ltr, + onChanged: _handleOnChange, + focusNode: _internalFocusNode, + autofocus: widget.autoFocus, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: const Color(0xff2E3039), + letterSpacing: -0.2, + ), + decoration: InputDecoration( + isDense: true, + hintText: widget.hintText, + hintStyle: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 16, + fontWeight: FontWeight.w500, + color: const Color(0xff898A8D), + letterSpacing: -0.2, + ), + prefixIconConstraints: const BoxConstraints(minWidth: 45), + prefixIcon: widget.prefix == null + ? null + : Text( + "+" + widget.prefix!, + style: context.dynamicTextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: const Color(0xff2E303A), + letterSpacing: -0.2, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), ), - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), - ), ], ), ), @@ -1617,4 +1571,3 @@ class _NewInputFieldState extends State { ); } } - diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart index e73d4645..d6aea8c5 100644 --- a/lib/pages/login/register_new.dart +++ b/lib/pages/login/register_new.dart @@ -128,6 +128,8 @@ class _RegisterNew extends State { isShowLanguageChanger: true, appBarIcons: [], dropDownList: [], + extendBody: true, + resizeToAvoidBottomInset: true, dropDownIndexChange: (value) { Utils.changeAppLanguage(context: context); @@ -166,7 +168,7 @@ class _RegisterNew extends State { textScaler: TextScaler.linear(MediaQuery.textScalerOf(context).scale(1)), style: context.dynamicTextStyle( fontSize: 28, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 40 / 28, diff --git a/lib/pages/login/saved_login.dart b/lib/pages/login/saved_login.dart index 63708495..f59d5571 100644 --- a/lib/pages/login/saved_login.dart +++ b/lib/pages/login/saved_login.dart @@ -104,11 +104,7 @@ class _SavedLogin extends State { // Welcome back text Text( TranslationBase.of(context).welcomeBack, - style: context.dynamicTextStyle( - fontSize: 22, - color: Color(0xFF898A8D), - fontWeight: FontWeight.w500, - ), + style: context.dynamicTextStyle(fontSize: 16, color: Color(0xFF898A8D), fontWeight: FontWeight.w500, letterSpacing: -0.5), ), const SizedBox(height: 16), // Names @@ -118,10 +114,10 @@ class _SavedLogin extends State { widget.savedLoginData.name!.toLowerCase().capitalizeFirstofEach, style: context.dynamicTextStyle( fontSize: 26, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w600, color: Color(0xFF2E3039), height: 26 / 36, - letterSpacing: -0.4, + letterSpacing: -1, ), ), // Text( @@ -156,7 +152,7 @@ class _SavedLogin extends State { Text( TranslationBase.of(context).lastloginBy + ' ${getType(widget.savedLoginData.logInType!, context)}', style: context.dynamicTextStyle( - fontSize: 16, + fontSize: 14, color: Color(0xFF8F9AA3), fontWeight: FontWeight.w600, ), @@ -293,7 +289,7 @@ class _SavedLogin extends State { // int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, phoneNumber, context); // if (val != null) checkUserAuthentication(val); }, - backgroundColor: Colors.white, + backgroundColor: Colors.transparent, borderColor: Color(0xFF2E3039), textColor: Color(0xFF2E3039), icon: "assets/images/svg/whatsapp.svg", @@ -317,20 +313,6 @@ class _SavedLogin extends State { SizedBox( height: 20, ), - // widget.savedLoginData.logInType !=4 ? CustomButton( - // text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}", - // onPressed: () { - // widget.savedLoginData.logInType = 4; - // int? val = widget.savedLoginData.logInType!; - // checkUserAuthentication(val); - // }, - // backgroundColor: Colors.white, - // borderColor: Color(0xFF2E3039), - // textColor: Color(0xFF2E3039), - // borderWidth: 2, - // padding: EdgeInsets.fromLTRB(0, 14, 0, 14), - // icon: "assets/images/svg/whatsapp.svg", - // ) : Container(), ], ) : CustomButton( @@ -372,7 +354,7 @@ class _SavedLogin extends State { backgroundColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA), textColor: Color(0xffED1C2B), - fontSize: 12, + fontSize: 16, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(0, 10, 0, 10), @@ -381,7 +363,7 @@ class _SavedLogin extends State { ), ), SizedBox( - width: 24, + width: MediaQuery.of(context).size.width * 0.05, ), Expanded( child: Container( @@ -396,7 +378,7 @@ class _SavedLogin extends State { backgroundColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA), textColor: Color(0xffED1C2B), - fontSize: 12, + fontSize: 15, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(0, 10, 0, 10), diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index b6d884c2..54bed02e 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -160,7 +160,7 @@ class _WelcomeLogin extends State { TranslationBase.of(context).welcomeToDrSulaiman, style: context.dynamicTextStyle( fontSize: 28, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 40 / 28, diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 58794460..a4486e83 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -56,6 +56,7 @@ import 'dart:math' show asin, cos, pi, pow, sin, sqrt; // import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:provider/provider.dart'; +import 'package:smooth_corner/smooth_corner.dart'; import 'package:url_launcher/url_launcher.dart'; import '../Constants.dart'; @@ -1393,3 +1394,23 @@ extension MaritalStatusTypeExtension on MaritalStatusType { }), ))).values.toList(); */ + +extension SmoothContainerExtension on ShapeBorder { + ShapeDecoration toSmoothCornerDecoration({ + Color color = Colors.transparent, + double? borderRadius, + bool isDisabled = false, + Color? backgroundColor, + BorderSide? side, + }) { + final bgColor = backgroundColor ?? color; + return ShapeDecoration( + color: isDisabled ? bgColor.withOpacity(0.5) : bgColor, + shape: SmoothRectangleBorder( + borderRadius: BorderRadius.circular(borderRadius ?? 0), + smoothness: 1, + side: side ?? BorderSide.none, + ), + ); + } +} diff --git a/lib/widgets/drawer/langauge_picker.dart b/lib/widgets/drawer/langauge_picker.dart index 99be96b0..2d314aa1 100644 --- a/lib/widgets/drawer/langauge_picker.dart +++ b/lib/widgets/drawer/langauge_picker.dart @@ -35,7 +35,7 @@ class _LanguageSelectorState extends State { print(newLanguage); widget.onLanguageChanged(newLanguage); }, - child: SvgPicture.asset("assets/images/svg/globe_black.svg", width: 32), + child: SvgPicture.asset("assets/images/svg/globe_black.svg", width: 32, height: 32,), ); } else { return Stack(clipBehavior: Clip.none, children: [ diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 9f5dbeff..3c186ac9 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -240,6 +240,7 @@ class _AppScaffoldState extends State { // ? widget.customAppBar != null // ? widget.customAppBar extendBodyBehindAppBar: true, + appBar: isUserNotLogin ? null : widget.isShowPharmacyAppbar diff --git a/lib/widgets/quick_login.dart b/lib/widgets/quick_login.dart index cffdaecf..6370f6d3 100644 --- a/lib/widgets/quick_login.dart +++ b/lib/widgets/quick_login.dart @@ -51,7 +51,7 @@ class _QuickLoginBottomSheet extends State { textAlign: TextAlign.center, style: context.dynamicTextStyle( fontSize: 16, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, color: Colors.black, ), ),