feat:resetting password done
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/create_new_password_page/widgets/create_new_password_body.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class CreateNewPasswordPage extends StatelessWidget {
|
||||
@@ -7,6 +9,6 @@ class CreateNewPasswordPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(child: Scaffold());
|
||||
return CreateNewPasswordBody(phoneNumber: phoneNumber );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class ChangePasswordSuccessPassword extends StatelessWidget {
|
||||
const ChangePasswordSuccessPassword({super.key});
|
||||
|
||||
void show(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: AppColors.cTransparent,
|
||||
enableDrag: false,
|
||||
isDismissible: false,
|
||||
useSafeArea: false,
|
||||
builder: (context) => Wrap(children: [this]),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: context.w,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: context.theme.scaffoldBackgroundColor,
|
||||
borderRadius: AppUtils.kBorderRadius30,
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
10.verticalSpace,
|
||||
SizedBox(
|
||||
height: 6,
|
||||
width: 60,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cDFE2EB,
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
),
|
||||
),
|
||||
),
|
||||
54.verticalSpace,
|
||||
SizedBox(
|
||||
height: 162,
|
||||
width: 162,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(160),
|
||||
color: context.appThemeColors.rippleColor.newWithOpacity(
|
||||
.2,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
height: 103.74,
|
||||
width: 103.74,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFF6F00,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Center(
|
||||
child: SvgPicture.asset(AppIcons.icClock),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
54.verticalSpace,
|
||||
Text(
|
||||
context.loc.changePasswordSuccess,
|
||||
style: context.appThemeTextStyles.size24Bold,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
14.verticalSpace,
|
||||
Text(
|
||||
context.loc.changePasswordMessage,
|
||||
style: context.appThemeTextStyles.size14Regular,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
65.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.login,
|
||||
onPressed: () {
|
||||
context.go(Routes.login);
|
||||
},
|
||||
),
|
||||
15.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 24),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,126 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/app_text_form_field.dart';
|
||||
|
||||
class CreateNewPasswordBody extends StatelessWidget {
|
||||
const CreateNewPasswordBody({super.key});
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
import 'change_password_success.dart';
|
||||
|
||||
class CreateNewPasswordBody extends StatefulWidget {
|
||||
const CreateNewPasswordBody({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
State<CreateNewPasswordBody> createState() => _CreateNewPasswordBodyState();
|
||||
}
|
||||
|
||||
class _CreateNewPasswordBodyState extends State<CreateNewPasswordBody> {
|
||||
late TextEditingController _passwordController;
|
||||
late TextEditingController _repeatPasswordController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isValid = false;
|
||||
|
||||
void _validateForm() {
|
||||
final isValid = _formKey.currentState?.validate() ?? false;
|
||||
if (_isValid != isValid) {
|
||||
setState(() {
|
||||
_isValid = isValid;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_passwordController = TextEditingController();
|
||||
_repeatPasswordController = TextEditingController();
|
||||
_passwordController.addListener(_validateForm);
|
||||
_repeatPasswordController.addListener(_validateForm);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_passwordController.removeListener(_validateForm);
|
||||
_repeatPasswordController.removeListener(_validateForm);
|
||||
_passwordController.dispose();
|
||||
_repeatPasswordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(child: Scaffold());
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: WLayout(
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
body: SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
30.verticalSpace,
|
||||
WBackButton(),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.createNewPassword,
|
||||
style: context.appThemeTextStyles.size24Bold,
|
||||
),
|
||||
8.verticalSpace,
|
||||
Text(
|
||||
context.loc.createNewPasswordSubtitle,
|
||||
style: context.appThemeTextStyles.size14Regular,
|
||||
),
|
||||
|
||||
40.verticalSpace,
|
||||
Text(
|
||||
context.loc.newPassword,
|
||||
style: context.appThemeTextStyles.size16Medium,
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
controller: _passwordController,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
hintText: context.loc.enter_password,
|
||||
validator: (value) {
|
||||
return Validators.validatePassword(
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
16.verticalSpace,
|
||||
Text(
|
||||
context.loc.confirmNewPassword,
|
||||
style: context.appThemeTextStyles.size16Medium,
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
controller: _repeatPasswordController,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
hintText: context.loc.enter_password,
|
||||
validator: (value) {
|
||||
return Validators.validateRepeatPassword(
|
||||
_repeatPasswordController.text.trim(),
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
130.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.resetPassword,
|
||||
isActive: _isValid,
|
||||
onPressed: () {
|
||||
ChangePasswordSuccessPassword().show(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,10 @@ class _ForgotPasswordBodyState extends State<ForgotPasswordBody> {
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
|
||||
controller: _phoneNumberController,
|
||||
keyBoardType: TextInputType.number,
|
||||
hintText: context.loc.enter_email_or_phone,
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: context.appThemeTextStyles.size14Regular,
|
||||
|
||||
@@ -98,7 +98,7 @@ class _VerifyAccountBodyState extends State<VerifyAccountBody> {
|
||||
Pinput(
|
||||
autofocus: true,
|
||||
enabled: true,
|
||||
length: 5,
|
||||
length: 5,
|
||||
controller: _otpController,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -123,7 +123,14 @@ class _VerifyAccountBodyState extends State<VerifyAccountBody> {
|
||||
AppButton(
|
||||
isActive: _isValid,
|
||||
name: context.loc.verifyAccount,
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.push(
|
||||
Routes.createNewPassword,
|
||||
extra: widget.phoneNumber,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
20.verticalSpace,
|
||||
Align(
|
||||
|
||||
@@ -92,7 +92,7 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
|
||||
widget.hintTextStyle ??
|
||||
context.appThemeTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cA7AEC1,
|
||||
),
|
||||
),
|
||||
suffixIcon: widget.obscureText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
@@ -101,8 +101,9 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
|
||||
});
|
||||
},
|
||||
icon: SvgPicture.asset(
|
||||
visibility ? AppIcons.icVisibility : AppIcons.icVisibilityOff,
|
||||
color: AppColors.c000000,
|
||||
visibility
|
||||
? AppIcons.icVisibility
|
||||
: AppIcons.icVisibilityOff,
|
||||
),
|
||||
)
|
||||
: widget.suffixIcon,
|
||||
|
||||
@@ -6,7 +6,9 @@ class WBackButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
context.pop();
|
||||
},
|
||||
borderRadius: AppUtils.kBorderRadius22,
|
||||
child: Ink(
|
||||
height: 44,
|
||||
@@ -19,7 +21,7 @@ class WBackButton extends StatelessWidget {
|
||||
color: AppColors.cA7AEC1.newWithOpacity(.3),
|
||||
offset: const Offset(0, 4),
|
||||
blurRadius: 80,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
|
||||
Reference in New Issue
Block a user