feat:login page done
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class ForgotPasswordPage extends StatelessWidget {
|
||||
const ForgotPasswordPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(
|
||||
child: Scaffold(body: Column(children: [Text('Forgot password')])),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class LoginPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<LoginBloc>(),
|
||||
child: WLayout(
|
||||
child: WLayout(
|
||||
child: Scaffold(
|
||||
body: WLoginBody(),
|
||||
),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/core/helpers/formatters.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/login_usecase.dart';
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
import '../../../blocs/login_bloc/login_bloc.dart';
|
||||
|
||||
@@ -38,86 +36,127 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
45.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Text("Let's go", style: AppTextStyles.size24Bold),
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
'Phone number',
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
height: 50,
|
||||
hintText: "Enter phone number",
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: AppTextStyles.size16Regular.copyWith(fontSize: 16),
|
||||
),
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _phoneController,
|
||||
keyBoardType: TextInputType.number,
|
||||
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
'Password',
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
height: 50,
|
||||
hintText: "Enter password",
|
||||
keyBoardType: TextInputType.text,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _passwordController,
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
child: Text('Forgot password'),
|
||||
),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
AppButton(
|
||||
name: "Continue",
|
||||
isLoading: state.status.isLoading(),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<LoginBloc>().add(
|
||||
LoginEvent.login(
|
||||
LoginParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneController.text.trim().replaceAll(" ", "")}",
|
||||
password: _passwordController.text.trim(),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
45.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Text(context.loc.login, style: AppTextStyles.size24Bold),
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.phone_number,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
height: 50,
|
||||
hintText: context.loc.enter_phone_number,
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: AppTextStyles.size16Regular.copyWith(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
backgroundColor: AppColors.c34A853,
|
||||
),
|
||||
20.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _phoneController,
|
||||
keyBoardType: TextInputType.number,
|
||||
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
height: 50,
|
||||
obscureText: true,
|
||||
hintText: context.loc.enter_password,
|
||||
keyBoardType: TextInputType.text,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _passwordController,
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
context.push(Routes.forgotPassword);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.forgot_password,
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.c34A853,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
AppButton(
|
||||
name: context.loc.Continue,
|
||||
isLoading: state.status.isLoading(),
|
||||
trailing: SvgPicture.asset(
|
||||
AppIcons.icArrowRightLight,
|
||||
).paddingOnly(left: 10),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<LoginBloc>().add(
|
||||
LoginEvent.login(
|
||||
LoginParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneController.text.trim().replaceAll(" ", "")}",
|
||||
password: _passwordController.text.trim(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
backgroundColor: AppColors.c34A853,
|
||||
),
|
||||
20.verticalSpace,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.dont_have_account,
|
||||
style: AppTextStyles.size14Medium,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pushReplacement(Routes.register);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.sign_up,
|
||||
style: AppTextStyles.size15Bold.copyWith(
|
||||
color: AppColors.c34A853,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
20.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class RegisterPage extends StatelessWidget {
|
||||
const RegisterPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(
|
||||
child: Scaffold(body: Column(children: [Text("register")])),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user