feat:auth datasource done
This commit is contained in:
@@ -33,7 +33,12 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<LoginBloc, LoginState>(
|
||||
return BlocConsumer<LoginBloc, LoginState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.go(Routes.main);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
@@ -105,7 +110,7 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
context.push(Routes.verifyPhoneNumber, extra: false);
|
||||
// context.push(Routes.verifyPhoneNumber, extra: false);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.forgot_password,
|
||||
@@ -124,15 +129,16 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
).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(),
|
||||
),
|
||||
),
|
||||
);
|
||||
context.go(Routes.main);
|
||||
// context.read<LoginBloc>().add(
|
||||
// LoginEvent.login(
|
||||
// LoginParams(
|
||||
// phoneNumber:
|
||||
// "+998${_phoneController.text.trim().replaceAll(" ", "")}",
|
||||
// password: _passwordController.text.trim(),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
@@ -148,10 +154,7 @@ class _WLoginBodyState extends State<WLoginBody> {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.push(
|
||||
Routes.verifyPhoneNumber,
|
||||
extra: true,
|
||||
);
|
||||
// context.push(Routes.verifyPhoneNumber, extra: true);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.sign_up,
|
||||
|
||||
Reference in New Issue
Block a user