pull/8/head
aamir-csol 2 months ago
parent cf1908b44a
commit 0309299f44

@ -782,7 +782,7 @@
"resultsPending": "النتائج معلقة", "resultsPending": "النتائج معلقة",
"resultsAvailable": "النتائج متاحة", "resultsAvailable": "النتائج متاحة",
"viewReport": "عرض التقرير", "viewReport": "عرض التقرير",
"prescriptionDeliveryError": "هذه العيادة لا تدعم إعادة التعبئة والتسليم." "prescriptionDeliveryError": "هذه العيادة لا تدعم إعادة التعبئة والتسليم.",
"receiveOtpToast": "أين تود تلقي رمز التحقق OTP؟", "receiveOtpToast": "أين تود تلقي رمز التحقق OTP؟",
"enterPhoneNumber": "أدخل رقم الهاتف", "enterPhoneNumber": "أدخل رقم الهاتف",
"enterEmailDesc": "أدخل عنوان بريدك الإلكتروني لإكمال عملية إنشاء ملف طبي", "enterEmailDesc": "أدخل عنوان بريدك الإلكتروني لإكمال عملية إنشاء ملف طبي",

@ -783,8 +783,7 @@
"resultsPending": "Results Pending", "resultsPending": "Results Pending",
"resultsAvailable": "Results Available", "resultsAvailable": "Results Available",
"viewReport": "View Report", "viewReport": "View Report",
"prescriptionDeliveryError": "This clinic doesn't support refill" "prescriptionDeliveryError": "This clinic doesn't support refill",
"loginOrRegister": "Login or Register",
"prepareToElevate": "Prepared to elevate your health and well-being?", "prepareToElevate": "Prepared to elevate your health and well-being?",
"iAcceptTermsConditions": "I Accept the Terms and Conditions", "iAcceptTermsConditions": "I Accept the Terms and Conditions",
"alreadyHaveAccount": "Already have an account?", "alreadyHaveAccount": "Already have an account?",

@ -774,13 +774,13 @@ abstract class LocaleKeys {
static const validPassportNumber = 'validPassportNumber'; static const validPassportNumber = 'validPassportNumber';
static const continuePlan = 'continuePlan'; static const continuePlan = 'continuePlan';
static const aboutApp = 'aboutApp'; static const aboutApp = 'aboutApp';
static const dontHaveAccount = 'dontHaveAccount';
static const loginOrRegister = 'loginOrRegister'; static const loginOrRegister = 'loginOrRegister';
static const myFiles = 'myFiles'; static const myFiles = 'myFiles';
static const resultsPending = 'resultsPending'; static const resultsPending = 'resultsPending';
static const resultsAvailable = 'resultsAvailable'; static const resultsAvailable = 'resultsAvailable';
static const viewReport = 'viewReport'; static const viewReport = 'viewReport';
static const prescriptionDeliveryError = 'prescriptionDeliveryError'; static const prescriptionDeliveryError = 'prescriptionDeliveryError';
static const dontHaveAccount = 'dontHaveAccount';
static const receiveOtpToast = 'receiveOtpToast'; static const receiveOtpToast = 'receiveOtpToast';
static const enterPhoneNumber = 'enterPhoneNumber'; static const enterPhoneNumber = 'enterPhoneNumber';
static const enterEmailDesc = 'enterEmailDesc'; static const enterEmailDesc = 'enterEmailDesc';

@ -218,6 +218,7 @@ class _RegisterNew extends State<RegisterNew> {
countryCode: "966", countryCode: "966",
initialPhoneNumber: "", initialPhoneNumber: "",
textController: TextEditingController(), textController: TextEditingController(),
isEnableCountryDropdown: true,
onChange: (String? value) {}, onChange: (String? value) {},
buttons: [ buttons: [
Padding( Padding(

@ -53,6 +53,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar(onBackPressed: () {}, onLanguageChanged: (lang) {}, hideLogoAndLang: true,), appBar: CustomAppBar(onBackPressed: () {}, onLanguageChanged: (lang) {}, hideLogoAndLang: true,),
body: SingleChildScrollView( body: SingleChildScrollView(
reverse: false, reverse: false,
@ -78,8 +79,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_circle), leadingIcon: AppAssets.user_circle).paddingSymmetrical(0.h,16.h),
Divider(height: 1), Divider(height: 1, color: AppColors.greyColor,),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(), labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""), hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""),
@ -90,8 +91,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.student_card), leadingIcon: AppAssets.student_card).paddingSymmetrical(0.h,16.h),
Divider(height: 1), Divider(height: 1, color: AppColors.greyColor,),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.gender.tr(), labelText: LocaleKeys.gender.tr(),
@ -108,7 +109,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowRadius: false, isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down, selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/user-full.svg', leadingIcon: AppAssets.user_full,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.gender.tr(), labelText: LocaleKeys.gender.tr(),
@ -121,8 +122,9 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: isFromDubai ? false : true,
leadingIcon: AppAssets.user_full, leadingIcon: AppAssets.user_full,
onChange: (value) {}),
Divider(height: 1), onChange: (value) {}).paddingSymmetrical(0.h,16.h),
Divider(height: 1, color: AppColors.greyColor,),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.maritalStatus.tr(), labelText: LocaleKeys.maritalStatus.tr(),
@ -136,7 +138,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowRadius: false, isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down, selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/smart-phone.svg', leadingIcon: AppAssets.smart_phone,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.maritalStatus.tr(), labelText: LocaleKeys.maritalStatus.tr(),
@ -150,8 +152,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.smart_phone, leadingIcon: AppAssets.smart_phone,
onChange: (value) {}), onChange: (value) {}).paddingSymmetrical(0.h,16.h),
Divider(height: 1), Divider(height: 1, color: AppColors.greyColor,),
isFromDubai isFromDubai
? DropdownWidget( ? DropdownWidget(
labelText: LocaleKeys.country.tr(), labelText: LocaleKeys.country.tr(),
@ -165,7 +167,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowRadius: false, isAllowRadius: false,
padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0),
selectionCustomIcon: AppAssets.arrow_down, selectionCustomIcon: AppAssets.arrow_down,
// leadingIcon: 'assets/images/svg/globe.svg', leadingIcon: AppAssets.globe,
).withVerticalPadding(8) ).withVerticalPadding(8)
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.nationality.tr(), labelText: LocaleKeys.nationality.tr(),
@ -179,8 +181,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.globe, leadingIcon: AppAssets.globe,
onChange: (value) {}), onChange: (value) {}).paddingSymmetrical(0.h,16.h),
Divider(height: 1), Divider(height: 1, color: AppColors.greyColor,),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(), labelText: LocaleKeys.mobileNumber.tr(),
hintText: ("widget.payload.mobileNo" ?? ""), hintText: ("widget.payload.mobileNo" ?? ""),
@ -192,8 +194,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.call, leadingIcon: AppAssets.call,
onChange: (value) {}), onChange: (value) {}).paddingSymmetrical(0.h,16.h),
Divider(height: 1), Divider(height: 1, color: AppColors.greyColor,),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.dob.tr(), labelText: LocaleKeys.dob.tr(),
hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""), hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""),
@ -203,11 +205,11 @@ class _RegisterNew extends State<RegisterNewStep2> {
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
// selectionType: SelectionType.calendar, // : SelectionType.calendar,
// selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null, // selectedValue: widget.payload.dob != null ? Utils.formatDateToDisplay(widget.payload.dob.toString()) : null,
// selectionCustomIcon: AppAssets.calendar, // selectionCustomIcon: AppAssets.calendar,
// leadingIcon: AppAssets.birthday_cake, leadingIcon: AppAssets.birthday_cake,
onChange: (value) {}), onChange: (value) {}).paddingSymmetrical(0.h,16.h),
], ],
), ),
), ),

@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
class CustomCountryDropdown extends StatefulWidget { class CustomCountryDropdown extends StatefulWidget {
final List<CountryEnum> countryList; final List<CountryEnum> countryList;
final Function(CountryEnum)? onCountryChange; final Function(CountryEnum)? onCountryChange;
final Function(String)? onPhoneNumberChanged;
final bool isRtl; final bool isRtl;
final bool isFromBottomSheet; final bool isFromBottomSheet;
final bool isEnableTextField; final bool isEnableTextField;
@ -20,6 +21,7 @@ class CustomCountryDropdown extends StatefulWidget {
Key? key, Key? key,
required this.countryList, required this.countryList,
this.onCountryChange, this.onCountryChange,
this.onPhoneNumberChanged,
required this.isRtl, required this.isRtl,
this.isFromBottomSheet = false, this.isFromBottomSheet = false,
this.isEnableTextField = false, this.isEnableTextField = false,
@ -34,34 +36,55 @@ class _CustomCountryDropdownState extends State<CustomCountryDropdown> {
CountryEnum? selectedCountry; CountryEnum? selectedCountry;
late OverlayEntry _overlayEntry; late OverlayEntry _overlayEntry;
bool _isDropdownOpen = false; bool _isDropdownOpen = false;
FocusNode textFocusNode = new FocusNode();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
selectedCountry = CountryEnum.saudiArabia; selectedCountry = CountryEnum.saudiArabia;
if (widget.isEnableTextField && widget.isFromBottomSheet) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && textFocusNode.canRequestFocus) {
FocusScope.of(context).requestFocus(textFocusNode);
}
});
}
}
@override
void dispose() {
textFocusNode.dispose();
super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return Container(
onTap: () { height: 40.h,
if (_isDropdownOpen) { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 10.h),
_closeDropdown(); child: Row(
} else { children: [
_openDropdown(); GestureDetector(
} onTap: () {
}, if (_isDropdownOpen) {
child: Container( _closeDropdown();
height: 40.h, } else {
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 10.h), _openDropdown();
child: Row( }
children: [ },
Utils.buildSvgWithAssets(icon: selectedCountry != null ? selectedCountry!.iconPath : AppAssets.ksa, width: 40.h, height: 40.h), child: Utils.buildSvgWithAssets(icon: selectedCountry != null ? selectedCountry!.iconPath : AppAssets.ksa, width: 40.h, height: 40.h)),
SizedBox(width: 8.h), SizedBox(width: 8.h),
Utils.buildSvgWithAssets(icon: _isDropdownOpen ? AppAssets.dropdow_icon : AppAssets.dropdow_icon), Utils.buildSvgWithAssets(icon: _isDropdownOpen ? AppAssets.dropdow_icon : AppAssets.dropdow_icon),
SizedBox(width: 4.h), SizedBox(width: 4.h),
if (widget.isFromBottomSheet) if (widget.isFromBottomSheet)
Column( GestureDetector(
onTap: () {
if (widget.isEnableTextField && textFocusNode.canRequestFocus) {
FocusScope.of(context).requestFocus(textFocusNode);
}
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
@ -80,23 +103,36 @@ class _CustomCountryDropdownState extends State<CustomCountryDropdown> {
style: TextStyle(fontSize: 12.fSize, height: 21 / 18, fontWeight: FontWeight.w600, letterSpacing: -0.2), style: TextStyle(fontSize: 12.fSize, height: 21 / 18, fontWeight: FontWeight.w600, letterSpacing: -0.2),
), ),
SizedBox(width: 4.h), SizedBox(width: 4.h),
if (widget.isEnableTextField) widget.textField!, if (widget.isEnableTextField)
SizedBox(
height: 20,
width: 200,
child: TextField(
focusNode: textFocusNode,
decoration: InputDecoration(hintText: "", isDense: true, border: InputBorder.none),
keyboardType: TextInputType.phone,
onChanged: widget.onPhoneNumberChanged),
),
], ],
) )
], ],
), ),
if (!widget.isFromBottomSheet) ),
Text( if (!widget.isFromBottomSheet)
selectedCountry != null ? selectedCountry!.displayName : "Select Country", Text(
style: TextStyle(fontSize: 14.fSize, height: 21 / 14, fontWeight: FontWeight.w500, letterSpacing: -0.2), selectedCountry != null ? selectedCountry!.displayName : "Select Country",
), style: TextStyle(fontSize: 14.fSize, height: 21 / 14, fontWeight: FontWeight.w500, letterSpacing: -0.2),
], ),
), ],
), ),
); );
} }
void _openDropdown() { void _openDropdown() {
if (textFocusNode.hasFocus) {
textFocusNode.unfocus();
}
RenderBox renderBox = context.findRenderObject() as RenderBox; RenderBox renderBox = context.findRenderObject() as RenderBox;
Offset offset = renderBox.localToGlobal(Offset.zero); Offset offset = renderBox.localToGlobal(Offset.zero);
@ -162,5 +198,13 @@ class _CustomCountryDropdownState extends State<CustomCountryDropdown> {
setState(() { setState(() {
_isDropdownOpen = false; _isDropdownOpen = false;
}); });
if (widget.isEnableTextField && widget.isFromBottomSheet) {
Future.delayed(Duration(milliseconds: 100), () {
if (mounted && textFocusNode.canRequestFocus) {
FocusScope.of(context).requestFocus(textFocusNode);
}
});
}
} }
} }

@ -3,6 +3,7 @@ import 'package:flutter/material.dart' show Icons, PopupMenuItem, showMenu, Colo
import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class DropdownWidget extends StatelessWidget { class DropdownWidget extends StatelessWidget {
final String labelText; final String labelText;
@ -16,6 +17,7 @@ class DropdownWidget extends StatelessWidget {
final EdgeInsetsGeometry? padding; final EdgeInsetsGeometry? padding;
final bool hasSelectionCustomIcon; final bool hasSelectionCustomIcon;
final String? selectionCustomIcon; final String? selectionCustomIcon;
final String? leadingIcon;
const DropdownWidget({ const DropdownWidget({
Key? key, Key? key,
@ -30,29 +32,49 @@ class DropdownWidget extends StatelessWidget {
this.padding, this.padding,
this.hasSelectionCustomIcon = false, this.hasSelectionCustomIcon = false,
this.selectionCustomIcon, this.selectionCustomIcon,
this.leadingIcon,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget content = Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [_buildLabelText(), _buildDropdown(context)],
);
return Container( return Container(
padding: padding, padding: padding,
alignment: Alignment.center, alignment: Alignment.center, // This might need adjustment based on layout
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: Colors.white, color: Colors.white,
borderRadius: isAllowRadius ? 15.h : null, borderRadius: isAllowRadius ? 15.h : null,
side: isBorderAllowed ? BorderSide(color: const Color(0xffefefef), width: 1) : null, side: isBorderAllowed ? BorderSide(color: const Color(0xffefefef), width: 1) : null,
), ),
child: Column( child: Row(
mainAxisSize: MainAxisSize.min, // Wrap with a Row
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, // Align items vertically in the center
children: [ children: [
_buildLabelText(), if (leadingIcon != null) ...[
_buildDropdown(context), _buildLeadingIcon(),
SizedBox(width: 3.h),
],
Expanded(child: content),
], ],
), ),
); );
} }
Widget _buildLeadingIcon() {
return Container(
height: 40.h,
width: 40.h,
margin: EdgeInsets.only(right: 10.h),
padding: EdgeInsets.all(8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 10.h, color: AppColors.greyColor),
child: Utils.buildSvgWithAssets(icon: leadingIcon!));
}
Widget _buildLabelText() { Widget _buildLabelText() {
return Text( return Text(
labelText, labelText,

@ -74,26 +74,32 @@ class TextInputWidget extends StatelessWidget {
child: Row( child: Row(
textDirection: Directionality.of(context), textDirection: Directionality.of(context),
children: [ children: [
if (isAllowLeadingIcon && leadingIcon != null) if (isAllowLeadingIcon && leadingIcon != null && !isCountryDropDown)
_buildLeadingIcon(context),
isCountryDropDown isCountryDropDown
? CustomCountryDropdown( ? CustomCountryDropdown(
countryList: CountryEnum.values, countryList: CountryEnum.values,
onCountryChange: (CountryEnum? value) {}, onCountryChange: (CountryEnum? value) {
isRtl: Directionality.of(context) == TextDirection.rtl, print(value);
isFromBottomSheet: isCountryDropDown, },
isEnableTextField:true, isRtl: Directionality.of(context) == TextDirection.rtl,
textField: _buildTextField(context), isFromBottomSheet: isCountryDropDown,
) isEnableTextField: true,
onPhoneNumberChanged: (value) {
print(value);
},
textField: _buildTextField(context),
)
: Expanded( : Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_buildLabelText(), _buildLabelText(),
_buildTextField(context), _buildTextField(context),
], ],
), ),
), ),
], ],
), ),
), ),
@ -172,15 +178,15 @@ class TextInputWidget extends StatelessWidget {
prefixIcon: prefix == null prefixIcon: prefix == null
? null ? null
: Text( : Text(
"+" + prefix!, "+" + prefix!,
style: TextStyle( style: TextStyle(
fontSize: 14.fSize, fontSize: 14.fSize,
height: 21 / 14, height: 21 / 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xff2E303A), color: Color(0xff2E303A),
letterSpacing: -0.2, letterSpacing: -0.2,
), ),
), ),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,

Loading…
Cancel
Save