diff --git a/lib/presentation/Screens/auth_verification/registration.dart b/lib/presentation/Screens/auth_verification/registration.dart index 1f9bdce1..0c885f53 100644 --- a/lib/presentation/Screens/auth_verification/registration.dart +++ b/lib/presentation/Screens/auth_verification/registration.dart @@ -388,10 +388,10 @@ class _RegisterScreenState extends ConsumerState { if (didPop) return; context.go('/login'); // Show exit confirmation dialog }, - child: SafeArea( - child: Scaffold( - backgroundColor: Colors.white, - body: Stack(children: [ + child:Scaffold( + backgroundColor: Colors.white, + body: SafeArea( + child: Stack(children: [ SingleChildScrollView( child: Column( children: [ @@ -402,7 +402,7 @@ class _RegisterScreenState extends ConsumerState { child: Consumer( builder: (context, ref, _) { final locale = - ref.watch(localeProvider); // Current locale + ref.watch(localeProvider); // Current locale return MyToggle( isOn: locale?.languageCode == 'en', knobTextWhenOn: 'ع', @@ -429,918 +429,918 @@ class _RegisterScreenState extends ConsumerState { Column(children: [ registrationSuccess ? Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: screenheight / 4), - buildIconContainer( - Icons.report, Color(0xFF7DAFBC)), - SizedBox(height: 20), - Text( - context.translate( - 'Your registration is pending for verification.', - 'تسجيلك في انتظار التحقق.'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Color(0xFF414042)), - ), - SizedBox(height: 10), - Text( - context.translate( - 'Kindly verify your mail to proceed further.', - 'يرجى التحقق من البريد الخاص بك للمضي قدما.'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - color: Color(0xFF898C81), - ), - ), - SizedBox(height: 10), - ElevatedButton( - onPressed: () => {context.go('/login')}, - style: ElevatedButton.styleFrom( - backgroundColor: - Color(0xFFAA8E83), // Background color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 12), // Border radius - ), - ), - child: Text( - context.translate('Go to Login', - 'اذهب إلى تسجيل الدخول'), - style: TextStyle( - color: Colors.white, // Text color - ), - ), - ), - SizedBox(height: screenheight / 5), - Center( - child: Container( - height: screenheight / 16, - width: screenwidth / 2.5, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/splash_screen/logo.png"), // Background image asset - fit: BoxFit.fill, - ), - ), - )) - ], + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: screenheight / 4), + buildIconContainer( + Icons.report, Color(0xFF7DAFBC)), + SizedBox(height: 20), + Text( + context.translate( + 'Your registration is pending for verification.', + 'تسجيلك في انتظار التحقق.'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Color(0xFF414042)), + ), + SizedBox(height: 10), + Text( + context.translate( + 'Kindly verify your mail to proceed further.', + 'يرجى التحقق من البريد الخاص بك للمضي قدما.'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + color: Color(0xFF898C81), ), - ) + ), + SizedBox(height: 10), + ElevatedButton( + onPressed: () => {context.go('/login')}, + style: ElevatedButton.styleFrom( + backgroundColor: + Color(0xFFAA8E83), // Background color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 12), // Border radius + ), + ), + child: Text( + context.translate('Go to Login', + 'اذهب إلى تسجيل الدخول'), + style: TextStyle( + color: Colors.white, // Text color + ), + ), + ), + SizedBox(height: screenheight / 5), + Center( + child: Container( + height: screenheight / 16, + width: screenwidth / 2.5, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/splash_screen/logo.png"), // Background image asset + fit: BoxFit.fill, + ), + ), + )) + ], + ), + ) : registrationFailed - ? Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: screenheight / 8), - buildIconContainer( - Icons.report, Colors.red), - SizedBox(height: 20), - Text( - context.translate( - 'Sorry ${_usernameController.text}!', - 'آسف ${_usernameController.text}!'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: Color(0xFF414042)), + ? Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: screenheight / 8), + buildIconContainer( + Icons.report, Colors.red), + SizedBox(height: 20), + Text( + context.translate( + 'Sorry ${_usernameController.text}!', + 'آسف ${_usernameController.text}!'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: Color(0xFF414042)), + ), + SizedBox(height: 10), + Text( + context.translate( + 'Your registration process failed. For further assistance, please contact support.', + 'فشلت عملية التسجيل الخاصة بك. لمزيد من المساعدة، يرجى الاتصال بالدعم.'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + color: Color(0xFF898C81), + ), + ), + SizedBox(height: 10), + ElevatedButton( + onPressed: () => { + setState(() { + registrationFailed = false; + registrationSuccess = false; + _usernameController.clear(); + _emailController.clear(); + _passwordController.clear(); + _confirmpasswordController.clear(); + isChecked = false; + }) + }, + child: Text( + context.translate( + 'Retry', 'أعد المحاولة'), + ), + ), + SizedBox(height: screenheight / 5), + Center( + child: Container( + height: screenheight / 16, + width: screenwidth / 2.5, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/splash_screen/logo.png"), // Background image asset + fit: BoxFit.fill, + ), + ), + )) + ], + ), + ) + : Form( + key: _formKey, + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SizedBox(height: screenheight / 60), + Text( + // 'Register', + AppLocalizations.of(context)! + .register_title, + style: TextStyle( + fontSize: 32, + fontWeight: FontWeight.w400), + ), + SizedBox(height: 10), + Text( + AppLocalizations.of(context)! + .register_details, + style: TextStyle( + fontSize: + context.translate(18.0, 14.0), + color: const Color(0xff898C81), + fontWeight: FontWeight.w600, + ), + ), + + SizedBox(height: 20), + // Display this if registration is pending approval + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: TextFormField( + controller: _usernameController, + // focusNode: _focusNodes[0], + decoration: InputDecoration( + // hintText: _showHints[0] ? 'Username' : null, + hintText: _showHints[0] + ? AppLocalizations.of( + context)! + .register_name + : null, + prefixIconConstraints: + const BoxConstraints( + maxWidth: 25 + 16 + 10, + maxHeight: 25 + (8 * 2), + ), + prefixIcon: Padding( + padding: + const EdgeInsetsDirectional + .only( + start: 16, + end: 10, ), - SizedBox(height: 10), - Text( - context.translate( - 'Your registration process failed. For further assistance, please contact support.', - 'فشلت عملية التسجيل الخاصة بك. لمزيد من المساعدة، يرجى الاتصال بالدعم.'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - color: Color(0xFF898C81), + child: Image.asset( + MiscIconAssetPath.person, + fit: BoxFit.fitHeight, + height: 25, + width: 25, + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade300, + ), + ), + + // prefixIcon: Icon( + // Icons.person, + // color: Color(0xFF90B0D5), + // + // ), + // border: OutlineInputBorder(), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade400, + width: 1), // Enabled border + ), + focusedBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Colors.deepPurple, + width: 2), // Focused border + ), + errorBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: 1), // Error border + ), + focusedErrorBorder: + OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: + 1), // Match the error color + ), + counterText: '', + hintStyle: TextStyle( + color: Color(0xFFC3C6CB), + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 14 + : 16, + ), + ), + validator: _validateUsername, + maxLength: + 40, // Set the maximum length to 20 characters + maxLengthEnforcement: + MaxLengthEnforcement.enforced, + ), + ), + SizedBox(height: 15), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: TextFormField( + controller: _emailController, + // focusNode: _focusNodes[1], + decoration: InputDecoration( + // hintText: 'Enter your email', + hintText: _showHints[1] + ? AppLocalizations.of( + context)! + .enter_your_email + : null, + // _showHints[1] ? 'Enter your email' : null, + prefixIconConstraints: + const BoxConstraints( + maxWidth: 25 + 16 + 10, + maxHeight: 25 + (8 * 2), + ), + prefixIcon: Padding( + padding: + const EdgeInsetsDirectional + .only( + start: 16, + end: 10, + ), + child: Image.asset( + MiscIconAssetPath.vector, + fit: BoxFit.fitHeight, + height: 20, + width: 25, + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade100, + ), + ), + + // border: OutlineInputBorder(), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade400, + width: 1), + ), + focusedBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Colors.deepPurple, + width: 2), // Focused border + ), + errorBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: 1), // Error border + ), + focusedErrorBorder: + OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: + 1), // Match the error color + ), + counterText: '', + hintStyle: TextStyle( + color: Color(0xFFC3C6CB), + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 14 + : 16, + ), + ), + validator: _validateEmail, + maxLength: 320, + maxLengthEnforcement: + MaxLengthEnforcement.enforced, + inputFormatters: [ + LengthLimitingTextInputFormatter( + 320), // Limit to 320 characters + ], + ), + ), + SizedBox(height: 15), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: TextFormField( + controller: _passwordController, + // focusNode: _focusNodes[2], + obscureText: _obscurePassword, + decoration: InputDecoration( + hintText: _showHints[2] + ? AppLocalizations.of( + context)! + .enter_your_password + : null, + // _showHints[2] ? 'Enter your password' : null, + prefixIconConstraints: + const BoxConstraints( + maxWidth: 25 + 16 + 10, + maxHeight: 25 + (8 * 2), + ), + prefixIcon: Padding( + padding: + const EdgeInsetsDirectional + .only( + start: 16, + end: 10, + ), + child: Image.asset( + MiscIconAssetPath.lock, + fit: BoxFit.fitHeight, + height: 25, + width: 25, + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade300, + ), + ), + + // prefixIcon: Icon( + // Icons.lock, + // color: Color(0xFF90B0D5), + // ), + suffixIcon: IconButton( + // icon: Icon( + // _obscurePassword + // ? Icons.visibility_off + // : Icons.visibility, + // color: Color(0xFF9EA2A9), + // ), + + icon: Image.asset( + _obscurePassword + ? MiscIconAssetPath + .visibilityOff + : MiscIconAssetPath + .visibleOn, + + color: Color( + 0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly. + width: 24, + height: 24, + ), + + onPressed: () { + setState(() { + _obscurePassword = + !_obscurePassword; + }); + }, + ), + // border: OutlineInputBorder(), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade400, + width: 1), + ), + focusedBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Colors.deepPurple, + width: 2), // Focused border + ), + errorBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: 1), // Error border + ), + focusedErrorBorder: + OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: + 1), // Match the error color + ), + + counterText: '', + hintStyle: TextStyle( + color: Color(0xFFC3C6CB), + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 14 + : 16, + ), + ), + validator: _validatePassword, + maxLength: 40, + maxLengthEnforcement: + MaxLengthEnforcement.enforced, + ), + ), + SizedBox(height: 15), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: TextFormField( + controller: + _confirmpasswordController, + // focusNode: _focusNodes[3], + obscureText: + _obscureConfirmPassword, + decoration: InputDecoration( + hintText: _showHints[3] + ? AppLocalizations.of( + context)! + .register_Confirm_password + : null, + // _showHints[3] ? 'Confirm password' : null, + prefixIconConstraints: + const BoxConstraints( + maxWidth: 25 + 16 + 10, + maxHeight: 25 + (8 * 2), + ), + prefixIcon: Padding( + padding: + const EdgeInsetsDirectional + .only( + start: 16, + end: 10, + ), + child: Image.asset( + MiscIconAssetPath.lock, + fit: BoxFit.fitHeight, + height: 25, + width: 25, + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade300, + ), + ), + + suffixIcon: IconButton( + icon: Image.asset( + _obscureConfirmPassword + ? MiscIconAssetPath + .visibilityOff + : MiscIconAssetPath + .visibleOn, + + color: Color( + 0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly. + width: 24, + height: 24, + ), + onPressed: () { + setState(() { + _obscureConfirmPassword = + !_obscureConfirmPassword; + }); + }, + ), + // border: OutlineInputBorder( + // borderSide: BorderSide(color: Colors.blue, width: 2), // Default border color + // ), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: MyTheme.topicColor( + IndicatorTopic + .economy) + .shade400, + width: 1), + ), + focusedBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Colors.deepPurple, + width: 2), // Focused border + ), + errorBorder: OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: 1), // Error border + ), + focusedErrorBorder: + OutlineInputBorder( + borderRadius: + BorderRadius.circular(10), + borderSide: BorderSide( + color: Color(0xFFb22222), + width: + 1), // Match the error color + ), + counterText: '', + hintStyle: TextStyle( + color: Color(0xFFC3C6CB), + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 14 + : 16, + ), + ), + validator: _validateConfirmPassword, + maxLength: 40, + maxLengthEnforcement: + MaxLengthEnforcement.enforced, + inputFormatters: [ + LengthLimitingTextInputFormatter( + 64), // Limit to 40 characters + ], + ), + ), + SizedBox(height: 10), + Padding( + padding: const EdgeInsets.only( + top: 0, + bottom: 10, + left: 15.5, + right: 30), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Checkbox( + value: isChecked, + onChanged: (value) { + setState(() { + isChecked = value ?? false; + showError = false; + }); + }, + side: BorderSide( + color: showError + ? Color(0xFFb22222) + : MyTheme.topicColor( + IndicatorTopic + .economy) + .shade400, + width: 1, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.only( + top: 0, ), - ), - SizedBox(height: 10), - ElevatedButton( - onPressed: () => { - setState(() { - registrationFailed = false; - registrationSuccess = false; - _usernameController.clear(); - _emailController.clear(); - _passwordController.clear(); - _confirmpasswordController.clear(); - isChecked = false; - }) - }, - child: Text( - context.translate( - 'Retry', 'أعد المحاولة'), - ), - ), - SizedBox(height: screenheight / 5), - Center( - child: Container( - height: screenheight / 16, - width: screenwidth / 2.5, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/splash_screen/logo.png"), // Background image asset - fit: BoxFit.fill, + child: Text.rich( + TextSpan( + text: AppLocalizations.of( + context, + )! + .agree, + // text: 'I agree to ', + style: TextStyle( + fontWeight: + FontWeight.w500, + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 12 + : 14, + color: Color( + 0xFF898C81, + ), // Change to your desired color + ), + children: [ + TextSpan( + recognizer: + TapGestureRecognizer() + ..onTap = () => + context.push( + '/terms&conditions'), + text: AppLocalizations + .of(context)! + .terms_conditions, + // text: 'Terms & Conditions', + style: TextStyle( + fontSize: + registerLocale + ?.languageCode == + 'ar' + ? 12 + : 14, + fontWeight: + FontWeight + .bold, + color: Color( + 0xFF985400), + // Makes the text bold + // decoration: + // TextDecoration.underline, + decorationColor: + Color( + 0xFF985400), + decorationThickness: + 1), + ), + TextSpan( + text: AppLocalizations + .of(context)! + .t_and, + style: TextStyle( + color: Color( + 0xFF898C81), // Change to your desired color + ), + ), + TextSpan( + recognizer: + TapGestureRecognizer() + ..onTap = () => + context.push( + '/privacy_policy'), + text: AppLocalizations + .of(context)! + .privacy_policy, + style: TextStyle( + fontWeight: + FontWeight + .bold, + fontSize: + registerLocale + ?.languageCode == + 'ar' + ? 12 + : 14, + fontFamily: + 'Roboto', + color: Color( + 0xFF985400), + // decoration: + // TextDecoration.underline, + decorationColor: + Color( + 0xFF648CBA), + decorationThickness: + 1), + ), + TextSpan( + text: AppLocalizations + .of(context)! + .conditions, + style: TextStyle( + fontWeight: + FontWeight.w500, + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 12 + : 14, + color: Color( + 0xFF898C81), // Change to your desired color + ), + ), + ], ), ), - )) - ], - ), - ) - : Form( - key: _formKey, - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, + ), + ), + ], + ), + ), + if (showError) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + left: registerLocale + ?.languageCode == + 'ar' + ? 0 + : 40.0, + right: registerLocale + ?.languageCode == + 'ar' + ? 45 + : 0.0, + ), + child: Text( + context.translate( + 'Required', 'مطلوب'), + style: TextStyle( + color: Color(0xFFb22222), + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 12 + : 12, + ), + ), + ), + ], + ), + SizedBox(height: 20), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: SizedBox( + width: screenwidth / 1, + child: ElevatedButton( + onPressed: isRegistering + ? null + : _registerUser, + style: ElevatedButton.styleFrom( + backgroundColor: Color( + 0xFFA7887A), // Brownish color for Register + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10), + ), + ), + child: Row( + mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: screenheight / 60), Text( - // 'Register', - AppLocalizations.of(context)! + // "Register", + AppLocalizations.of( + context)! .register_title, style: TextStyle( - fontSize: 32, - fontWeight: FontWeight.w400), - ), - SizedBox(height: 10), - Text( - AppLocalizations.of(context)! - .register_details, - style: TextStyle( - fontSize: - context.translate(18.0, 14.0), - color: const Color(0xff898C81), - fontWeight: FontWeight.w600, - ), - ), - - SizedBox(height: 20), - // Display this if registration is pending approval - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: TextFormField( - controller: _usernameController, - // focusNode: _focusNodes[0], - decoration: InputDecoration( - // hintText: _showHints[0] ? 'Username' : null, - hintText: _showHints[0] - ? AppLocalizations.of( - context)! - .register_name - : null, - prefixIconConstraints: - const BoxConstraints( - maxWidth: 25 + 16 + 10, - maxHeight: 25 + (8 * 2), - ), - prefixIcon: Padding( - padding: - const EdgeInsetsDirectional - .only( - start: 16, - end: 10, - ), - child: Image.asset( - MiscIconAssetPath.person, - fit: BoxFit.fitHeight, - height: 25, - width: 25, - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade300, - ), - ), - - // prefixIcon: Icon( - // Icons.person, - // color: Color(0xFF90B0D5), - // - // ), - // border: OutlineInputBorder(), - enabledBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade400, - width: 1), // Enabled border - ), - focusedBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Colors.deepPurple, - width: 2), // Focused border - ), - errorBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: 1), // Error border - ), - focusedErrorBorder: - OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: - 1), // Match the error color - ), - counterText: '', - hintStyle: TextStyle( - color: Color(0xFFC3C6CB), - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 14 - : 16, - ), - ), - validator: _validateUsername, - maxLength: - 40, // Set the maximum length to 20 characters - maxLengthEnforcement: - MaxLengthEnforcement.enforced, - ), - ), - SizedBox(height: 15), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: TextFormField( - controller: _emailController, - // focusNode: _focusNodes[1], - decoration: InputDecoration( - // hintText: 'Enter your email', - hintText: _showHints[1] - ? AppLocalizations.of( - context)! - .enter_your_email - : null, - // _showHints[1] ? 'Enter your email' : null, - prefixIconConstraints: - const BoxConstraints( - maxWidth: 25 + 16 + 10, - maxHeight: 25 + (8 * 2), - ), - prefixIcon: Padding( - padding: - const EdgeInsetsDirectional - .only( - start: 16, - end: 10, - ), - child: Image.asset( - MiscIconAssetPath.vector, - fit: BoxFit.fitHeight, - height: 20, - width: 25, - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade100, - ), - ), - - // border: OutlineInputBorder(), - enabledBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade400, - width: 1), - ), - focusedBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Colors.deepPurple, - width: 2), // Focused border - ), - errorBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: 1), // Error border - ), - focusedErrorBorder: - OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: - 1), // Match the error color - ), - counterText: '', - hintStyle: TextStyle( - color: Color(0xFFC3C6CB), - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 14 - : 16, - ), - ), - validator: _validateEmail, - maxLength: 320, - maxLengthEnforcement: - MaxLengthEnforcement.enforced, - inputFormatters: [ - LengthLimitingTextInputFormatter( - 320), // Limit to 320 characters - ], - ), - ), - SizedBox(height: 15), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: TextFormField( - controller: _passwordController, - // focusNode: _focusNodes[2], - obscureText: _obscurePassword, - decoration: InputDecoration( - hintText: _showHints[2] - ? AppLocalizations.of( - context)! - .enter_your_password - : null, - // _showHints[2] ? 'Enter your password' : null, - prefixIconConstraints: - const BoxConstraints( - maxWidth: 25 + 16 + 10, - maxHeight: 25 + (8 * 2), - ), - prefixIcon: Padding( - padding: - const EdgeInsetsDirectional - .only( - start: 16, - end: 10, - ), - child: Image.asset( - MiscIconAssetPath.lock, - fit: BoxFit.fitHeight, - height: 25, - width: 25, - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade300, - ), - ), - - // prefixIcon: Icon( - // Icons.lock, - // color: Color(0xFF90B0D5), - // ), - suffixIcon: IconButton( - // icon: Icon( - // _obscurePassword - // ? Icons.visibility_off - // : Icons.visibility, - // color: Color(0xFF9EA2A9), - // ), - - icon: Image.asset( - _obscurePassword - ? MiscIconAssetPath - .visibilityOff - : MiscIconAssetPath - .visibleOn, - - color: Color( - 0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly. - width: 24, - height: 24, - ), - - onPressed: () { - setState(() { - _obscurePassword = - !_obscurePassword; - }); - }, - ), - // border: OutlineInputBorder(), - enabledBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade400, - width: 1), - ), - focusedBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Colors.deepPurple, - width: 2), // Focused border - ), - errorBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: 1), // Error border - ), - focusedErrorBorder: - OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: - 1), // Match the error color - ), - - counterText: '', - hintStyle: TextStyle( - color: Color(0xFFC3C6CB), - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 14 - : 16, - ), - ), - validator: _validatePassword, - maxLength: 40, - maxLengthEnforcement: - MaxLengthEnforcement.enforced, - ), - ), - SizedBox(height: 15), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: TextFormField( - controller: - _confirmpasswordController, - // focusNode: _focusNodes[3], - obscureText: - _obscureConfirmPassword, - decoration: InputDecoration( - hintText: _showHints[3] - ? AppLocalizations.of( - context)! - .register_Confirm_password - : null, - // _showHints[3] ? 'Confirm password' : null, - prefixIconConstraints: - const BoxConstraints( - maxWidth: 25 + 16 + 10, - maxHeight: 25 + (8 * 2), - ), - prefixIcon: Padding( - padding: - const EdgeInsetsDirectional - .only( - start: 16, - end: 10, - ), - child: Image.asset( - MiscIconAssetPath.lock, - fit: BoxFit.fitHeight, - height: 25, - width: 25, - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade300, - ), - ), - - suffixIcon: IconButton( - icon: Image.asset( - _obscureConfirmPassword - ? MiscIconAssetPath - .visibilityOff - : MiscIconAssetPath - .visibleOn, - - color: Color( - 0xFF9EA2A9), // Apply color if needed, but keep in mind `Image.asset` might not support color directly. - width: 24, - height: 24, - ), - onPressed: () { - setState(() { - _obscureConfirmPassword = - !_obscureConfirmPassword; - }); - }, - ), - // border: OutlineInputBorder( - // borderSide: BorderSide(color: Colors.blue, width: 2), // Default border color - // ), - enabledBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: MyTheme.topicColor( - IndicatorTopic - .economy) - .shade400, - width: 1), - ), - focusedBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Colors.deepPurple, - width: 2), // Focused border - ), - errorBorder: OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: 1), // Error border - ), - focusedErrorBorder: - OutlineInputBorder( - borderRadius: - BorderRadius.circular(10), - borderSide: BorderSide( - color: Color(0xFFb22222), - width: - 1), // Match the error color - ), - counterText: '', - hintStyle: TextStyle( - color: Color(0xFFC3C6CB), - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 14 - : 16, - ), - ), - validator: _validateConfirmPassword, - maxLength: 40, - maxLengthEnforcement: - MaxLengthEnforcement.enforced, - inputFormatters: [ - LengthLimitingTextInputFormatter( - 64), // Limit to 40 characters - ], - ), - ), - SizedBox(height: 10), - Padding( - padding: const EdgeInsets.only( - top: 0, - bottom: 10, - left: 15.5, - right: 30), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Checkbox( - value: isChecked, - onChanged: (value) { - setState(() { - isChecked = value ?? false; - showError = false; - }); - }, - side: BorderSide( - color: showError - ? Color(0xFFb22222) - : MyTheme.topicColor( - IndicatorTopic - .economy) - .shade400, - width: 1, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsets.only( - top: 0, - ), - child: Text.rich( - TextSpan( - text: AppLocalizations.of( - context, - )! - .agree, - // text: 'I agree to ', - style: TextStyle( - fontWeight: - FontWeight.w500, - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 12 - : 14, - color: Color( - 0xFF898C81, - ), // Change to your desired color - ), - children: [ - TextSpan( - recognizer: - TapGestureRecognizer() - ..onTap = () => - context.push( - '/terms&conditions'), - text: AppLocalizations - .of(context)! - .terms_conditions, - // text: 'Terms & Conditions', - style: TextStyle( - fontSize: - registerLocale - ?.languageCode == - 'ar' - ? 12 - : 14, - fontWeight: - FontWeight - .bold, - color: Color( - 0xFF985400), - // Makes the text bold - // decoration: - // TextDecoration.underline, - decorationColor: - Color( - 0xFF985400), - decorationThickness: - 1), - ), - TextSpan( - text: AppLocalizations - .of(context)! - .t_and, - style: TextStyle( - color: Color( - 0xFF898C81), // Change to your desired color - ), - ), - TextSpan( - recognizer: - TapGestureRecognizer() - ..onTap = () => - context.push( - '/privacy_policy'), - text: AppLocalizations - .of(context)! - .privacy_policy, - style: TextStyle( - fontWeight: - FontWeight - .bold, - fontSize: - registerLocale - ?.languageCode == - 'ar' - ? 12 - : 14, - fontFamily: - 'Roboto', - color: Color( - 0xFF985400), - // decoration: - // TextDecoration.underline, - decorationColor: - Color( - 0xFF648CBA), - decorationThickness: - 1), - ), - TextSpan( - text: AppLocalizations - .of(context)! - .conditions, - style: TextStyle( - fontWeight: - FontWeight.w500, - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 12 - : 14, - color: Color( - 0xFF898C81), // Change to your desired color - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - if (showError) - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: registerLocale - ?.languageCode == - 'ar' - ? 0 - : 40.0, - right: registerLocale - ?.languageCode == - 'ar' - ? 45 - : 0.0, - ), - child: Text( - context.translate( - 'Required', 'مطلوب'), - style: TextStyle( - color: Color(0xFFb22222), - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 12 - : 12, - ), - ), - ), - ], - ), - SizedBox(height: 20), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: SizedBox( - width: screenwidth / 1, - child: ElevatedButton( - onPressed: isRegistering - ? null - : _registerUser, - style: ElevatedButton.styleFrom( - backgroundColor: Color( - 0xFFA7887A), // Brownish color for Register - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10), - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - // "Register", - AppLocalizations.of( - context)! - .register_title, - style: TextStyle( - fontSize: registerLocale - ?.languageCode == - 'ar' - ? 14 - : 16, - color: Colors.white), - ), - SizedBox(width: 8), - const Icon( - Icons - .chevron_right_outlined, - color: Colors - .white, // Set your desired color here - ) - ], - ), - ), - ), - ), - SizedBox(height: 15), - Text( - AppLocalizations.of(context)! - .account_confirmation, - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: - registerLocale?.languageCode == - 'ar' - ? 12 - : 14, - color: Color(0xFF898C81), - ), - ), - SizedBox(height: 15), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - bottom: 10, - left: 30, - right: 30), - child: SizedBox( - width: screenwidth / 1, - child: ElevatedButton( - onPressed: () { - context.pop(); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Color( - 0xFF82AFCB), // Blueish color for Login - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10), - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - AppLocalizations.of( - context)! - .login_title, - style: TextStyle( - fontSize: 16, - color: Colors.white), - ), - SizedBox(width: 8), - const Icon( - Icons - .chevron_right_outlined, - color: Colors - .white, // Set your desired color here - ) - ], - ), - ), - ), - ), - SizedBox( - height: 10, - ), - Center( - // child: Container( - // height: screenheight / 16, - // width: screenwidth / 3, - // decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage( - // "assets/splash_screen/logo.png"), // Background image asset - // fit: BoxFit.fill, - // ), - // ), - // ) - child: fcscBanner, - ), - SizedBox( - height: 20, + fontSize: registerLocale + ?.languageCode == + 'ar' + ? 14 + : 16, + color: Colors.white), ), + SizedBox(width: 8), + const Icon( + Icons + .chevron_right_outlined, + color: Colors + .white, // Set your desired color here + ) ], ), ), ), + ), + SizedBox(height: 15), + Text( + AppLocalizations.of(context)! + .account_confirmation, + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: + registerLocale?.languageCode == + 'ar' + ? 12 + : 14, + color: Color(0xFF898C81), + ), + ), + SizedBox(height: 15), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + bottom: 10, + left: 30, + right: 30), + child: SizedBox( + width: screenwidth / 1, + child: ElevatedButton( + onPressed: () { + context.pop(); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Color( + 0xFF82AFCB), // Blueish color for Login + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10), + ), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + AppLocalizations.of( + context)! + .login_title, + style: TextStyle( + fontSize: 16, + color: Colors.white), + ), + SizedBox(width: 8), + const Icon( + Icons + .chevron_right_outlined, + color: Colors + .white, // Set your desired color here + ) + ], + ), + ), + ), + ), + SizedBox( + height: 10, + ), + Center( + // child: Container( + // height: screenheight / 16, + // width: screenwidth / 3, + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage( + // "assets/splash_screen/logo.png"), // Background image asset + // fit: BoxFit.fill, + // ), + // ), + // ) + child: fcscBanner, + ), + SizedBox( + height: 20, + ), + ], + ), + ), + ), ]), // Container( // height: MediaQuery.of(context).size.height / 1.2, @@ -1361,7 +1361,7 @@ class _RegisterScreenState extends ConsumerState { child: LinearProgressIndicator( minHeight: 5, // Adjust thickness backgroundColor: - Colors.grey[100], // Optional: Background color + Colors.grey[100], // Optional: Background color valueColor: AlwaysStoppedAnimation( Color(0xFFAA8E83)), // Loader color ), @@ -1369,8 +1369,8 @@ class _RegisterScreenState extends ConsumerState { ], ), ) - ])), - ), + ]), + )), ); } }