feat:verify your account page ui done
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class CreateNewPasswordPage extends StatelessWidget {
|
||||
const CreateNewPasswordPage({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(child: Scaffold());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class CreateNewPasswordBody extends StatelessWidget {
|
||||
const CreateNewPasswordBody({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(child: Scaffold());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/forgot_password_page/widgets/forgot_password_body.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class ForgotPasswordPage extends StatelessWidget {
|
||||
const ForgotPasswordPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ForgotPasswordBody();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
import 'package:food_delivery_client/core/helpers/formatters.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';
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class ForgotPasswordBody extends StatefulWidget {
|
||||
const ForgotPasswordBody({super.key});
|
||||
|
||||
@override
|
||||
State<ForgotPasswordBody> createState() => _ForgotPasswordBodyState();
|
||||
}
|
||||
|
||||
class _ForgotPasswordBodyState extends State<ForgotPasswordBody> {
|
||||
late final TextEditingController _phoneNumberController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isValid = false;
|
||||
|
||||
void _validateForm() {
|
||||
final isValid = _formKey.currentState?.validate() ?? false;
|
||||
|
||||
if (isValid != _isValid) {
|
||||
setState(() {
|
||||
_isValid = isValid;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_phoneNumberController = TextEditingController();
|
||||
_phoneNumberController.addListener(_validateForm);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_phoneNumberController.removeListener(_validateForm);
|
||||
_phoneNumberController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: WLayout(
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
body: SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
30.verticalSpace,
|
||||
WBackButton(),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.forgotPassword,
|
||||
style: context.appThemeTextStyles.size24Bold,
|
||||
),
|
||||
8.verticalSpace,
|
||||
Text(
|
||||
context.loc.forgotPasswordSubtitle,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cA7AEC1,
|
||||
height: 1.6,
|
||||
),
|
||||
).paddingOnly(right: 50),
|
||||
30.verticalSpace,
|
||||
Text(
|
||||
context.loc.phoneNumber,
|
||||
style: context.appThemeTextStyles.size16Medium,
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
controller: _phoneNumberController,
|
||||
keyBoardType: TextInputType.number,
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: context.appThemeTextStyles.size14Regular,
|
||||
),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
validator: (value) {
|
||||
return Validators.validatePhoneNumber(
|
||||
_phoneNumberController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
100.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.sendCode,
|
||||
isActive: _isValid,
|
||||
onPressed: () {
|
||||
context.push(
|
||||
Routes.verifyAccount,
|
||||
extra:
|
||||
"+998${_phoneNumberController.text.trim().replaceAll(" ", "")}",
|
||||
);
|
||||
if (_formKey.currentState?.validate() ?? false) {}
|
||||
},
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,12 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
prefixIcon: Text("+ 998"),
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: context
|
||||
.appThemeTextStyles
|
||||
.size14Regular,
|
||||
),
|
||||
controller: _phoneNumberController,
|
||||
hintText: context.loc.enter_email_or_phone,
|
||||
inputFormatters: [
|
||||
@@ -143,7 +148,9 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
context.push(Routes.forgotPassword);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.forgot_password,
|
||||
style: AppTextStyles.size14Regular
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/verify_account_page/widgets/verify_account_body.dart';
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class VerifyAccountPage extends StatelessWidget {
|
||||
const VerifyAccountPage({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return VerifyAccountBody(phoneNumber: phoneNumber);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
import 'package:food_delivery_client/core/helpers/string_helpers.dart';
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class VerifyAccountBody extends StatefulWidget {
|
||||
const VerifyAccountBody({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
State<VerifyAccountBody> createState() => _VerifyAccountBodyState();
|
||||
}
|
||||
|
||||
class _VerifyAccountBodyState extends State<VerifyAccountBody> {
|
||||
late TextEditingController _otpController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isValid = false;
|
||||
|
||||
void _formValidator() {
|
||||
final isValid = _formKey.currentState?.validate() ?? false;
|
||||
if (_isValid != isValid) {
|
||||
setState(() {
|
||||
_isValid = isValid;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_otpController = TextEditingController();
|
||||
_otpController.addListener(_formValidator);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_otpController.removeListener(_formValidator);
|
||||
_otpController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final defaultPinTheme = PinTheme(
|
||||
height: 56,
|
||||
width: 56,
|
||||
textStyle: context.appThemeTextStyles.size24SemiBold1,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: context.appThemeColors.borderColor,
|
||||
style: BorderStyle.solid,
|
||||
width: 1,
|
||||
),
|
||||
color: context.theme.scaffoldBackgroundColor,
|
||||
borderRadius: AppUtils.kBorderRadius12,
|
||||
),
|
||||
);
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: WLayout(
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
30.verticalSpace,
|
||||
WBackButton(),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.verifyYourAccount,
|
||||
style: context.appThemeTextStyles.size24Bold,
|
||||
),
|
||||
8.verticalSpace,
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: context.loc.verifyAccountSubtitle,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cA7AEC1,
|
||||
height: 1.6,
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: " "),
|
||||
TextSpan(
|
||||
text: StringHelpers.formatUzbekPhoneNumber(
|
||||
widget.phoneNumber,
|
||||
),
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cFF6F00,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
50.verticalSpace,
|
||||
Pinput(
|
||||
autofocus: true,
|
||||
enabled: true,
|
||||
length: 5,
|
||||
controller: _otpController,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
LengthLimitingTextInputFormatter(5),
|
||||
],
|
||||
defaultPinTheme: defaultPinTheme,
|
||||
focusedPinTheme: defaultPinTheme.copyWith(
|
||||
decoration: defaultPinTheme.decoration?.copyWith(
|
||||
border: Border.all(color: AppColors.cFF6F00),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
return Validators.validateOtpFields(
|
||||
_otpController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
90.verticalSpace,
|
||||
AppButton(
|
||||
isActive: _isValid,
|
||||
name: context.loc.verifyAccount,
|
||||
onPressed: () {},
|
||||
),
|
||||
20.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: context.loc.didNotReceiveCode,
|
||||
style: context.appThemeTextStyles.size14Regular1,
|
||||
children: [
|
||||
WidgetSpan(
|
||||
baseline: TextBaseline.alphabetic,
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
context.loc.resend,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cFF6F00,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user