forget password changes

This commit is contained in:
mohammad
2024-08-15 13:17:35 +03:00
parent 75d5c7a4ac
commit 5cce050013
5 changed files with 259 additions and 258 deletions

View File

@ -100,7 +100,7 @@ class AccessManagementPage extends StatelessWidget {
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Wrap( Row(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -31,11 +31,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
} }
}, },
builder: (context, state) { builder: (context, state) {
if (state is AuthLoading) {
return const Center(child: CircularProgressIndicator());
} else {
return _buildForm(context, state); return _buildForm(context, state);
}
}, },
), ),
), ),
@ -62,287 +58,293 @@ class ForgetPasswordWebPage extends StatelessWidget {
Size size = MediaQuery.of(context).size; Size size = MediaQuery.of(context).size;
return FirstLayer( return FirstLayer(
second: Center( second: Center(
child: ListView( child: Stack(
shrinkWrap: true,
controller: _scrollController,
children: [ children: [
Container( if (state is AuthLoading)
padding: EdgeInsets.all(size.width * 0.02), const Center(child: CircularProgressIndicator()),
margin: EdgeInsets.all(size.width * 0.09), ListView(
decoration: BoxDecoration( shrinkWrap: true,
color: Colors.black.withOpacity(0.3), controller: _scrollController,
borderRadius: const BorderRadius.all(Radius.circular(20)), children: [
), Container(
child: Center( padding: EdgeInsets.all(size.width * 0.02),
child: Row( margin: EdgeInsets.all(size.width * 0.09),
crossAxisAlignment: CrossAxisAlignment.center, decoration: BoxDecoration(
mainAxisAlignment: MainAxisAlignment.center, color: Colors.black.withOpacity(0.3),
children: [ borderRadius: const BorderRadius.all(Radius.circular(20)),
const Spacer(), ),
Expanded( child: Center(
flex: 3, child: Row(
child: SvgPicture.asset( crossAxisAlignment: CrossAxisAlignment.center,
Assets.loginLogo, mainAxisAlignment: MainAxisAlignment.center,
), children: [
), const Spacer(),
const Spacer(), Expanded(
Expanded( flex: 3,
flex: 3, child: SvgPicture.asset(
child: Container( Assets.loginLogo,
decoration: BoxDecoration( ),
color: Colors.white.withOpacity(0.1),
borderRadius:
const BorderRadius.all(Radius.circular(30)),
border: Border.all(
color: ColorsManager.graysColor.withOpacity(0.2)),
), ),
child: Form( const Spacer(),
key: forgetBloc.forgetFormKey, Expanded(
child: Padding( flex: 3,
padding: EdgeInsets.symmetric( child: Container(
horizontal: size.width * 0.02, decoration: BoxDecoration(
vertical: size.width * 0.003), color: Colors.white.withOpacity(0.1),
child: Column( borderRadius:
mainAxisAlignment: MainAxisAlignment.spaceEvenly, const BorderRadius.all(Radius.circular(30)),
crossAxisAlignment: CrossAxisAlignment.start, border: Border.all(
children: <Widget>[ color: ColorsManager.graysColor.withOpacity(0.2)),
const SizedBox(height: 10), ),
const Text( child: Form(
'Forget Password', key: forgetBloc.forgetFormKey,
style: TextStyle( child: Padding(
color: Colors.white, padding: EdgeInsets.symmetric(
fontSize: 24, horizontal: size.width * 0.02,
fontWeight: FontWeight.bold), vertical: size.width * 0.003),
), child: Column(
const SizedBox(height: 10), mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Text(
'Please fill in your account information to\nretrieve your password',
style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontSize: 14,
fontWeight: FontWeight.w400),
),
const SizedBox(height: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
children: [ const SizedBox(height: 10),
const Text(
'Forget Password',
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
Text( Text(
"Country/Region", 'Please fill in your account information to\nretrieve your password',
style: Theme.of(context).textTheme.bodySmall!.copyWith( style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
SizedBox( Column(
child: DropdownButtonFormField<String>( crossAxisAlignment: CrossAxisAlignment.start,
validator: forgetBloc.validateRegion, mainAxisAlignment: MainAxisAlignment.start,
icon: const Icon( children: [
Icons.keyboard_arrow_down_outlined, Text(
"Country/Region",
style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontSize: 14,
fontWeight: FontWeight.w400),
), ),
decoration: textBoxDecoration()!.copyWith( const SizedBox(height: 10),
hintText: null, SizedBox(
), child: DropdownButtonFormField<String>(
hint: SizedBox( validator: forgetBloc.validateRegion,
width: size.width * 0.12, icon: const Icon(
child: const Align( Icons.keyboard_arrow_down_outlined,
alignment: Alignment.centerLeft,
child: Text(
'Select your region/country',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
), ),
decoration: textBoxDecoration()!.copyWith(
hintText: null,
),
hint: SizedBox(
width: size.width * 0.12,
child: const Align(
alignment: Alignment.centerLeft,
child: Text(
'Select your region/country',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
),
),
isDense: true,
style:
const TextStyle(color: Colors.black),
items: forgetBloc.regionList!
.map((RegionModel region) {
return DropdownMenuItem<String>(
value: region.id,
child: SizedBox(
width: size.width*0.06,
child: Text(region.name)),
);
}).toList(),
onChanged: (String? value) {
forgetBloc.add(SelectRegionEvent(
val: value!,
));
},
),
)
],
),
const SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Account",
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
),
const SizedBox(height: 10),
SizedBox(
child: TextFormField(
validator: forgetBloc.validateEmail,
controller:
forgetBloc.forgetEmailController,
decoration: textBoxDecoration()!.copyWith(
hintText: 'Enter your email'),
style:
const TextStyle(color: Colors.black),
), ),
), ),
isDense: true, ],
style:
const TextStyle(color: Colors.black),
items: forgetBloc.regionList!
.map((RegionModel region) {
return DropdownMenuItem<String>(
value: region.id,
child: SizedBox(
width: size.width*0.06,
child: Text(region.name)),
);
}).toList(),
onChanged: (String? value) {
forgetBloc.add(SelectRegionEvent(
val: value!,
));
},
),
)
],
),
const SizedBox(height: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Account",
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
), ),
const SizedBox(height: 10), const SizedBox(height: 20.0),
SizedBox( Column(
child: TextFormField( crossAxisAlignment: CrossAxisAlignment.start,
validator: forgetBloc.validateEmail, mainAxisAlignment: MainAxisAlignment.start,
controller: children: [
forgetBloc.forgetEmailController, Text(
decoration: textBoxDecoration()!.copyWith( "One Time Password",
hintText: 'Enter your email'), style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
style: ),
const TextStyle(color: Colors.black), const SizedBox(height: 10),
), SizedBox(
), child: TextFormField(
], validator: forgetBloc.validateCode,
), keyboardType:
const SizedBox(height: 20.0), TextInputType.visiblePassword,
Column( controller: forgetBloc.forgetOtp,
crossAxisAlignment: CrossAxisAlignment.start, decoration: textBoxDecoration()!.copyWith(
mainAxisAlignment: MainAxisAlignment.start, hintText: 'Enter Code',
children: [ suffixIcon: SizedBox(
Text( width: 100,
"One Time Password", child: Center(
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400), child: InkWell(
), onTap: () {
const SizedBox(height: 10), forgetBloc.add(StartTimerEvent());
SizedBox( },
child: TextFormField( child: Text(
validator: forgetBloc.validateCode, 'Get Code ${state is TimerState && !state.isButtonEnabled && state.remainingTime!=1? "(${forgetBloc.formattedTime(state.remainingTime)}) " : ""}',
keyboardType: style: TextStyle(
TextInputType.visiblePassword, color: state is TimerState &&
controller: forgetBloc.forgetOtp, !state.isButtonEnabled
decoration: textBoxDecoration()!.copyWith( ? Colors.grey
hintText: 'Enter Code', : ColorsManager.btnColor,
suffixIcon: SizedBox( ),
width: 100, ),
child: Center(
child: InkWell(
onTap: () {
forgetBloc.add(StartTimerEvent());
},
child: Text(
'Get Code ${state is TimerState && !state.isButtonEnabled && state.remainingTime!=1? "(${forgetBloc.formattedTime(state.remainingTime)}) " : ""}',
style: TextStyle(
color: state is TimerState &&
!state.isButtonEnabled
? Colors.grey
: ColorsManager.btnColor,
), ),
), ),
), ),
), ),
style:
const TextStyle(color: Colors.black),
), ),
), ),
style: ],
const TextStyle(color: Colors.black),
),
), ),
], const SizedBox(height: 20.0),
), Column(
const SizedBox(height: 20.0), crossAxisAlignment: CrossAxisAlignment.start,
Column( mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.start, Text(
children: [ "Password",
Text( style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
"Password",
style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 14,fontWeight: FontWeight.w400),
),
const SizedBox(height: 10),
SizedBox(
child: TextFormField(
validator: forgetBloc.passwordValidator,
keyboardType: TextInputType.visiblePassword,
controller: forgetBloc.forgetPasswordController,
decoration: textBoxDecoration()!.copyWith(
hintText: 'At least 8 characters',
), ),
style: const TextStyle(color: Colors.black), const SizedBox(height: 10),
SizedBox(
child: TextFormField(
validator: forgetBloc.passwordValidator,
keyboardType: TextInputType.visiblePassword,
controller: forgetBloc.forgetPasswordController,
decoration: textBoxDecoration()!.copyWith(
hintText: 'At least 8 characters',
),
style: const TextStyle(color: Colors.black),
),
),
],
),
const SizedBox(
height: 10,
),
const SizedBox(height: 20.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: size.width * 0.2,
child: DefaultButton(
backgroundColor: ColorsManager.btnColor,
child: const Text('Submit'),
onPressed: () {
if (forgetBloc.forgetFormKey.currentState!.validate()) {
forgetBloc.add(ChangePasswordEvent());
}
},
),
),
],
),
const SizedBox(height: 10.0),
SizedBox(
child: Text(
forgetBloc.validate,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: ColorsManager.red),
), ),
), ),
], SizedBox(
), height: 10,
const SizedBox( ),
height: 10,
),
const SizedBox(height: 20.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox( SizedBox(
width: size.width * 0.2, width: size.width * 0.2,
child: DefaultButton( child: Row(
backgroundColor: ColorsManager.btnColor, mainAxisAlignment: MainAxisAlignment.center,
child: const Text('Submit'), crossAxisAlignment: CrossAxisAlignment.center,
onPressed: () { children: [
if (forgetBloc.forgetFormKey.currentState!.validate()) { const Flexible(
forgetBloc.add(ChangePasswordEvent()); child: Text(
} "Do you have an account? ",
}, style: TextStyle(color: Colors.white),
)),
InkWell(
onTap: () {
forgetBloc.add(StopTimerEvent());
Navigator.pop(context);
},
child: const Flexible(
child: Text(
"Sign in",
)),
),
],
), ),
), ),
const SizedBox(height: 15.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ SizedBox(child: Text(forgetBloc.forgetValidate,
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)
],
)
], ],
), ),
const SizedBox(height: 10.0), ),
SizedBox(
child: Text(
forgetBloc.validate,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: ColorsManager.red),
),
),
SizedBox(
height: 10,
),
SizedBox(
width: size.width * 0.2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Flexible(
child: Text(
"Do you have an account? ",
style: TextStyle(color: Colors.white),
)),
InkWell(
onTap: () {
forgetBloc.add(StopTimerEvent());
Navigator.pop(context);
},
child: const Flexible(
child: Text(
"Sign in",
)),
),
],
),
),
const SizedBox(height: 15.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ SizedBox(child: Text(forgetBloc.forgetValidate,
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)
],
)
],
), ),
), ),
), ),
), const Spacer(),
],
), ),
const Spacer(), ),
],
), ),
), ],
), ),
], ],
), ),

View File

@ -28,7 +28,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
selectAccessType(SelectPasswordType event, Emitter<VisitorPasswordState> emit) { selectAccessType(SelectPasswordType event, Emitter<VisitorPasswordState> emit) {
accessTypeSelected=event.type; accessTypeSelected=event.type;
print(accessTypeSelected); print(accessTypeSelected);
emit(PasswordTypeSelected(event.type)); emit(PasswordTypeSelected(event.type));
} }

View File

@ -86,7 +86,7 @@ class VisitorPasswordDialog extends StatelessWidget {
SizedBox( SizedBox(
width: size.width*0.15, width: size.width*0.15,
child: RadioListTile<String>( child: RadioListTile<String>(
title: Text('Online Password'), title: const Text('Online Password'),
value: 'Online Password', value: 'Online Password',
groupValue: (state is PasswordTypeSelected) groupValue: (state is PasswordTypeSelected)
? state.selectedType ? state.selectedType

View File

@ -8,24 +8,24 @@ InputDecoration? textBoxDecoration({bool suffixIcon = false}) => InputDecoration
filled: true, // Enable background filling filled: true, // Enable background filling
fillColor: Colors.grey.shade200, // Set the background color fillColor: Colors.grey.shade200, // Set the background color
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), // Add border radius borderRadius: BorderRadius.circular(8), // Add border radius
borderSide: BorderSide.none, // Remove the underline borderSide: BorderSide.none, // Remove the underline
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), // Add border radius borderRadius: BorderRadius.circular(8), // Add border radius
borderSide: BorderSide.none, // Remove the underline borderSide: BorderSide.none, // Remove the underline
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), // Add border radius borderRadius: BorderRadius.circular(8), // Add border radius
borderSide: BorderSide.none, // Remove the underline borderSide: BorderSide.none, // Remove the underline
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 2), borderSide: BorderSide(color: Colors.red, width: 2),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(8),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 2), borderSide: BorderSide(color: Colors.red, width: 2),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(8),
), ),
); );