@ -1,4 +1,5 @@
import ' package:flutter/gestures.dart ' ;
import ' package:flutter_svg/flutter_svg.dart ' ;
import ' package:hmg_patient_app/config/config.dart ' ;
import ' package:hmg_patient_app/config/shared_pref_kay.dart ' ;
import ' package:hmg_patient_app/config/size_config.dart ' ;
@ -24,6 +25,7 @@ import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
import ' package:hmg_patient_app/uitl/translations_delegate_base.dart ' ;
import ' package:hmg_patient_app/uitl/utils.dart ' ;
import ' package:hmg_patient_app/uitl/utils_new.dart ' ;
import ' package:hmg_patient_app/widgets/drawer/langauge_picker.dart ' ;
import ' package:hmg_patient_app/widgets/others/app_scaffold_widget.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:hmg_patient_app/widgets/otp/sms-popup.dart ' ;
@ -61,7 +63,6 @@ class _RegisterNew extends State<RegisterNew> {
final sharedPref = new AppSharedPreferences ( ) ;
late PageController _controller ;
late bool isLoading ;
int _currentIndex = 0 ;
String ? LoginTokenID ;
bool isDubai = false ;
final intl . DateFormat dateFormat = intl . DateFormat ( ' dd/MM/yyyy ' ) ;
@ -84,6 +85,9 @@ class _RegisterNew extends State<RegisterNew> {
@ override
Widget build ( BuildContext context ) {
return AppScaffold (
/ / extendBody: true ,
/ / extendBodyBehindAppBar: true ,
appBarTitle: TranslationBase . of ( context ) . register ,
isShowDecPage: false ,
isShowAppBar: true ,
@ -99,260 +103,285 @@ class _RegisterNew extends State<RegisterNew> {
dropDownIndexChange: ( value ) {
Utils . changeAppLanguage ( context: context ) ;
} ,
body: SafeArea (
child: SingleChildScrollView (
reverse: false ,
/ / physics: NeverScrollableScrollPhysics ( ) ,
padding: EdgeInsets . only ( left: 24 , right: 24 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Utils . showLottie ( context: context , assetPath: ' assets/animations/lottie/register.json ' , width: context . getLottieScaledWidth ( 238 ) , fit: BoxFit . cover , repeat: true ) ,
SizedBox ( height: 8 ) ,
Text (
TranslationBase . of ( context ) . prepareToElevate ,
style: TextStyle ( fontSize: 32 , fontFamily: context . fontFamily , fontWeight: FontWeight . w600 , color: Color ( 0xff2B353E ) , letterSpacing: - 0.4 , height: 47 / 35 ) ,
body: GestureDetector (
onTap: ( ) {
FocusScope . of ( context ) . unfocus ( ) ; / / Dismiss the keyboard when tapping outside
} ,
child: ScrollConfiguration (
behavior: ScrollConfiguration . of ( context ) . copyWith ( overscroll: false , physics: const ClampingScrollPhysics ( ) ) ,
child: NotificationListener < OverscrollIndicatorNotification > (
onNotification: ( notification ) {
notification . disallowIndicator ( ) ;
return true ;
} ,
child: SingleChildScrollView (
physics: ClampingScrollPhysics ( ) , / / Remove NeverScrollableScrollPhysics ( )
padding: EdgeInsets . only (
left: 24 ,
right: 24 ,
) ,
SizedBox ( height: 24 ) ,
Directionality (
textDirection: Directionality . of ( context ) ,
child: Container (
decoration: BoxDecoration ( color: Colors . white , borderRadius: BorderRadius . circular ( 24 ) ) ,
padding: EdgeInsets . only ( left: 16 , right: 16 ) ,
child: Column (
children: [
inputWidget (
TranslationBase . of ( context ) . country ,
" Kingdom Of Saudi Arabia " ,
nationalIDorFile ,
isEnable: true ,
prefix: null ,
hasSelection: true ,
dropdownItems: Country . values . map ( ( e ) = > context . selectedLanguage = = " ar " ? e . nameArabic : e . displayName ) . toList ( ) ,
selectedValue: context . selectedLanguage = = " ar " ? selectedCountry . nameArabic : selectedCountry . displayName ,
selectionType: SelectionType . dropdown ,
onChange: ( val ) {
if ( val ! = null ) {
setState ( ( ) {
selectedCountry = CountryExtension . fromDisplayName ( val ) ;
} ) ;
}
} ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
hasSelectionCustomIcon: true ,
removePadding: true ,
isLeadingCountry: true ,
isAllowRadius: false ,
selectionCustomIcon: " assets/images/svg/arrow-down.svg " ,
leadingIcon: selectedCountry . iconPath ,
) ,
Divider ( height: 1 ) ,
inputWidget ( TranslationBase . of ( context ) . nationalIdNumber , " 1xxxxxxxx " , nationalIDorFile ,
isEnable: true ,
prefix: null ,
removePadding: true ,
isAllowRadius: false ,
hasSelection: false ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
leadingIcon: " assets/images/svg/student-card.svg " , onChange: ( value ) {
print ( value ) ;
} ) ,
Divider ( height: 1 ) ,
inputWidget ( TranslationBase . of ( context ) . dob , " 11 July, 1994 " , nationalIDorFile ,
isEnable: true ,
prefix: null ,
hasSelection: true ,
removePadding: true ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
hasSelectionCustomIcon: true ,
selectionType: SelectionType . calendar ,
selectedValue: selectedDOB ! = null ? Utils . formatDateToDisplay ( selectedDOB . toString ( ) ) : null ,
selectionCustomIcon: " assets/images/svg/calendar.svg " ,
lang: context . selectedLanguage ,
leadingIcon: " assets/images/svg/birthday-cake.svg " , onChange: ( value ) {
print ( " =========== " + value ! ) ;
selectedDOB = DateTime . parse ( value ) ;
setState ( ( ) { } ) ;
} , onCalendarTypeChanged: ( bool value ) {
if ( value ) {
print ( " gregorian " ) ;
isHijri = 0 ; / / Hijri
} else {
print ( " hijri " ) ;
isHijri = 1 ; / / Gregorian
}
} ) ,
] ,
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Utils . showLottie (
context: context ,
assetPath: ' assets/animations/lottie/register.json ' ,
width: MediaQuery . of ( context ) . size . width * 0.45 ,
height: MediaQuery . of ( context ) . size . height * 0.22 ,
fit: BoxFit . cover ,
repeat: true ) ,
SizedBox ( height: 8 ) ,
Text (
TranslationBase . of ( context ) . prepareToElevate ,
textScaler: TextScaler . linear ( MediaQuery . textScalerOf ( context ) . scale ( 1 ) ) ,
style: TextStyle ( fontSize: 28 , fontFamily: context . fontFamily , fontWeight: FontWeight . w600 , color: Color ( 0xff2B353E ) , letterSpacing: - 0.4 , height: 40 / 28 ) ,
) ,
) ,
) ,
SizedBox ( height: 25 ) ,
GestureDetector (
onTap: ( ) {
setState ( ( ) {
isTermsAccepted = ! isTermsAccepted ;
} ) ;
} ,
child: Row (
children: [
AnimatedContainer (
duration: const Duration ( milliseconds: 200 ) ,
height: 24 ,
width: 24 ,
decoration: BoxDecoration (
color: isTermsAccepted ? const Color ( 0xFFE92227 ) : Colors . transparent ,
borderRadius: BorderRadius . circular ( 6 ) ,
border: Border . all (
color: isTermsAccepted ? const Color ( 0xFFE92227 ) : Colors . grey ,
width: 2 ,
) ,
SizedBox ( height: 24 ) ,
Directionality (
textDirection: Directionality . of ( context ) ,
child: Container (
decoration: BoxDecoration ( color: Colors . white , borderRadius: BorderRadius . circular ( 24 ) ) ,
padding: EdgeInsets . only ( left: 16 , right: 16 , top: 0 , bottom: 0 ) ,
child: Column (
children: [
newInputWidget (
TranslationBase . of ( context ) . country ,
" Kingdom Of Saudi Arabia " ,
nationalIDorFile ,
isEnable: true ,
prefix: null ,
hasSelection: true ,
dropdownItems: Country . values . map ( ( e ) = > context . selectedLanguage = = " ar " ? e . nameArabic : e . displayName ) . toList ( ) ,
selectedValue: context . selectedLanguage = = " ar " ? selectedCountry . nameArabic : selectedCountry . displayName ,
selectionType: SelectionType . dropdown ,
onChange: ( val ) {
if ( val ! = null ) {
setState ( ( ) {
selectedCountry = CountryExtension . fromDisplayName ( val ) ;
} ) ;
}
} ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
hasSelectionCustomIcon: true ,
removePadding: true ,
isLeadingCountry: true ,
isAllowRadius: false ,
padding: const EdgeInsets . only ( top: 8 , bottom: 8 , left: 0 , right: 0 ) ,
selectionCustomIcon: " assets/images/svg/arrow-down.svg " ,
leadingIcon: selectedCountry . iconPath ,
) . withVerticalPadding ( 8 ) ,
Divider ( height: 1 ) ,
newInputWidget ( TranslationBase . of ( context ) . nationalIdNumber , " 1xxxxxxxx " , nationalIDorFile ,
isEnable: true ,
prefix: null ,
removePadding: true ,
isAllowRadius: false ,
hasSelection: false ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
padding: const EdgeInsets . only ( top: 8 , bottom: 8 , left: 0 , right: 0 ) ,
leadingIcon: " assets/images/svg/student-card.svg " , onChange: ( value ) {
print ( value ) ;
} ) . withVerticalPadding ( 8 ) ,
Divider ( height: 1 ) ,
newInputWidget ( TranslationBase . of ( context ) . dob , " 11 July, 1994 " , nationalIDorFile ,
isEnable: true ,
prefix: null ,
hasSelection: true ,
removePadding: true ,
isBorderAllowed: false ,
isAllowLeadingIcon: true ,
hasSelectionCustomIcon: true ,
selectionType: SelectionType . calendar ,
selectedValue: selectedDOB ! = null ? Utils . formatDateToDisplay ( selectedDOB . toString ( ) ) : null ,
selectionCustomIcon: " assets/images/svg/calendar.svg " ,
lang: context . selectedLanguage ,
padding: const EdgeInsets . only ( top: 8 , bottom: 8 , left: 0 , right: 0 ) ,
leadingIcon: " assets/images/svg/birthday-cake.svg " , onChange: ( value ) {
print ( " =========== " + value ! ) ;
selectedDOB = DateTime . parse ( value ) ;
setState ( ( ) { } ) ;
} , onCalendarTypeChanged: ( bool value ) {
if ( value ) {
print ( " gregorian " ) ;
isHijri = 0 ; / / Hijri
} else {
print ( " hijri " ) ;
isHijri = 1 ; / / Gregorian
}
} ) . withVerticalPadding ( 8 ) ,
] ,
) ,
child: isTermsAccepted ? const Icon ( Icons . check , size: 16 , color: Colors . white ) : null ,
) ,
const SizedBox ( width: 12 ) ,
Expanded (
child: Text (
TranslationBase . of ( context ) . iAcceptTermsConditions ,
style: TextStyle ( fontSize: 14 , fontWeight: FontWeight . w500 , color: Color ( 0xFF2E3039 ) ) ,
) ,
) ,
SizedBox ( height: 25 ) ,
GestureDetector (
onTap: ( ) {
setState ( ( ) {
isTermsAccepted = ! isTermsAccepted ;
} ) ;
} ,
child: Row (
children: [
AnimatedContainer (
duration: const Duration ( milliseconds: 200 ) ,
height: 24 ,
width: 24 ,
decoration: BoxDecoration (
color: isTermsAccepted ? const Color ( 0xFFE92227 ) : Colors . transparent ,
borderRadius: BorderRadius . circular ( 6 ) ,
border: Border . all (
color: isTermsAccepted ? const Color ( 0xFFE92227 ) : Colors . grey ,
width: 2 ,
) ,
) ,
child: isTermsAccepted ? const Icon ( Icons . check , size: 16 , color: Colors . white ) : null ,
) ,
const SizedBox ( width: 12 ) ,
Expanded (
child: Text (
TranslationBase . of ( context ) . iAcceptTermsConditions ,
style: TextStyle ( fontSize: 14 , fontWeight: FontWeight . w500 , color: Color ( 0xFF2E3039 ) ) ,
) ,
) ,
] ,
) ,
] ,
) ,
) ,
SizedBox ( height: 25 ) ,
CustomButton (
text: TranslationBase . of ( context ) . register ,
icon: " assets/images/svg/note-edit.svg " ,
onPressed: ( ) {
/ / bool isValid = Utils . validateIqama ( nationalIDorFile . text ) ;
if ( nationalIDorFile = = null ) {
Utils . showErrorToast ( " Please enter your national id. " ) ;
return ;
}
if ( selectedCountry = = null ) {
Utils . showErrorToast ( " Please select your country. " ) ;
return ;
}
) ,
SizedBox ( height: 25 ) ,
CustomButton (
text: TranslationBase . of ( context ) . register ,
icon: " assets/images/svg/note-edit.svg " ,
onPressed: ( ) {
/ / bool isValid = Utils . validateIqama ( nationalIDorFile . text ) ;
if ( nationalIDorFile = = null ) {
Utils . showErrorToast ( " Please enter your national id. " ) ;
return ;
}
if ( selectedCountry = = null ) {
Utils . showErrorToast ( " Please select your country. " ) ;
return ;
}
if ( selectedDOB = = null ) {
Utils . showErrorToast ( " Please enter your date of birth. " ) ;
return ;
}
if ( ! isTermsAccepted ) {
Utils . showErrorToast ( " Please accept the terms and conditions. " ) ;
return ;
}
if ( selectedDOB = = null ) {
Utils . showErrorToast ( " Please enter your date of birth. " ) ;
return ;
}
if ( ! isTermsAccepted ) {
Utils . showErrorToast ( " Please accept the terms and conditions. " ) ;
return ;
}
showModalBottomSheet (
context: context ,
isScrollControlled: true ,
isDismissible: false ,
backgroundColor: Colors . transparent ,
builder: ( bottomSheetContext ) = > Padding (
padding: EdgeInsets . only ( bottom: MediaQuery . of ( bottomSheetContext ) . viewInsets . bottom ) ,
child: SingleChildScrollView (
child: GenericBottomSheet (
countryCode: selectedCountry . countryCode ,
initialPhoneNumber: " " ,
textController: phoneController ,
buttons: [
Padding (
padding: const EdgeInsets . only ( bottom: 10 ) ,
child: CustomButton (
text: " Send me OTP on SMS " ,
onPressed: ( ) {
int ? val = Utils . onOtpBtnPressed ( OTPType . sms , phoneController ) ;
registerUser ( val ) ;
/ / if ( val ! = null ) checkUserAuthentication ( val ) ;
} ,
backgroundColor: Colors . red ,
borderColor: Colors . red ,
textColor: Colors . white ,
icon: " assets/images/svg/message.svg " ,
) ,
) ,
Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
showModalBottomSheet (
context: context ,
isScrollControlled: true ,
isDismissible: false ,
backgroundColor: Colors . transparent ,
builder: ( bottomSheetContext ) = > Padding (
padding: EdgeInsets . only ( bottom: MediaQuery . of ( bottomSheetContext ) . viewInsets . bottom ) ,
child: SingleChildScrollView (
child: GenericBottomSheet (
countryCode: selectedCountry . countryCode ,
initialPhoneNumber: " " ,
textController: phoneController ,
buttons: [
Padding (
padding: const EdgeInsets . symmetric ( horizontal: 8 ) ,
child: AppText (
" OR " ,
fontSize: 16 ,
fontFamily: context . fontFamily ,
color: Color ( 0xFF2E3039 ) ,
fontWeight: FontWeight . w500 ,
padding: const EdgeInsets . only ( bottom: 10 ) ,
child: CustomButton (
text: " Send me OTP on SMS " ,
onPressed: ( ) {
int ? val = Utils . onOtpBtnPressed ( OTPType . sms , phoneController ) ;
registerUser ( val ) ;
/ / if ( val ! = null ) checkUserAuthentication ( val ) ;
} ,
backgroundColor: Colors . red ,
borderColor: Colors . red ,
textColor: Colors . white ,
icon: " assets/images/svg/message.svg " ,
) ,
) ,
Row (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: [
Padding (
padding: const EdgeInsets . symmetric ( horizontal: 8 ) ,
child: AppText (
" OR " ,
fontSize: 16 ,
fontFamily: context . fontFamily ,
color: Color ( 0xFF2E3039 ) ,
fontWeight: FontWeight . w500 ,
) ,
) ,
] ,
) ,
Padding (
padding: const EdgeInsets . only ( bottom: 10 , top: 10 ) ,
child: CustomButton (
text: " Send me OTP on WhatsApp " ,
onPressed: ( ) {
int ? val = Utils . onOtpBtnPressed ( OTPType . whatsapp , phoneController ) ;
registerUser ( val ) ;
/ / if ( val ! = null ) checkUserAuthentication ( val ) ;
} ,
backgroundColor: Colors . white ,
borderColor: Color ( 0xFF2E3039 ) ,
textColor: Color ( 0xFF2E3039 ) ,
icon: " assets/images/svg/whatsapp.svg " ,
) ,
) ,
] ,
) ,
Padding (
padding: const EdgeInsets . only ( bottom: 10 ) ,
child: CustomButton (
text: " Send me OTP on WhatsApp " ,
onPressed: ( ) {
int ? val = Utils . onOtpBtnPressed ( OTPType . whatsapp , phoneController ) ;
registerUser ( val ) ;
/ / if ( val ! = null ) checkUserAuthentication ( val ) ;
} ,
backgroundColor: Colors . white ,
borderColor: Color ( 0xFF2E3039 ) ,
textColor: Color ( 0xFF2E3039 ) ,
icon: " assets/images/svg/whatsapp.svg " ,
) ,
) ,
] ,
) ,
) ,
) ,
) ;
} ,
fontFamily: context . fontFamily ,
) ,
SizedBox ( height: 14 ) ,
Center (
child: RichText (
textAlign: TextAlign . center ,
text: TextSpan (
style: TextStyle (
color: Colors . black ,
fontSize: 16 ,
height: 26 / 16 ,
fontFamily: context . fontFamily ,
fontWeight: FontWeight . w500 ,
) ,
children: < TextSpan > [
TextSpan (
text: TranslationBase . of ( context ) . alreadyHaveAccount ,
style: TextStyle (
fontFamily: context . fontFamily ,
) ,
) ,
) ,
TextSpan ( text: " " ) ,
TextSpan (
text: TranslationBase . of ( context ) . loginNow ,
) ;
} ,
fontFamily: context . fontFamily ,
) ,
SizedBox ( height: 14 ) ,
Center (
child: RichText (
textAlign: TextAlign . center ,
text: TextSpan (
style: TextStyle (
color: Colors . red ,
color: Colors . black ,
fontSize: 16 ,
height: 26 / 16 ,
fontFamily: context . fontFamily ,
fontWeight: FontWeight . w500 ,
) ,
recognizer: TapGestureRecognizer ( )
. . onTap = ( ) {
Navigator . of ( context ) . pop ( ) ;
} ,
children: < TextSpan > [
TextSpan (
text: TranslationBase . of ( context ) . alreadyHaveAccount ,
style: TextStyle (
fontFamily: context . fontFamily ,
) ,
) ,
TextSpan ( text: " " ) ,
TextSpan (
text: TranslationBase . of ( context ) . loginNow ,
style: TextStyle (
color: Colors . red ,
fontSize: 16 ,
height: 26 / 16 ,
fontFamily: context . fontFamily ,
fontWeight: FontWeight . w500 ,
) ,
recognizer: TapGestureRecognizer ( )
. . onTap = ( ) {
Navigator . of ( context ) . pop ( ) ;
} ,
) ,
] ,
) ,
] ,
) ,
) ,
) ,
SizedBox ( height: 30 ) ,
] ,
) ,
SizedBox ( height: 30 ) ,
] ,
) ,
) ,
) ,
) ) ;