refactor(auth): update example with new listeners
This commit is contained in:
parent
38480d84f4
commit
762b9bcd11
@ -3,12 +3,11 @@
|
||||
// -----
|
||||
// File: sign_in_form.dart
|
||||
// Created Date: 19/08/2022 15:24:37
|
||||
// Last Modified: Thu Nov 10 2022
|
||||
// Last Modified: Fri Nov 11 2022
|
||||
// -----
|
||||
// Copyright (c) 2022
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
@ -73,16 +72,12 @@ class SignInForm extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<SignInCubit<int>, SignInState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isSubmissionFailure) {
|
||||
ScaffoldMessenger.of(context)
|
||||
return SignInListener(
|
||||
onError: (context, status, errorMessage) => ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(
|
||||
SnackBar(content: Text(state.errorMessage ?? 'Sign In Failure')),
|
||||
);
|
||||
}
|
||||
},
|
||||
SnackBar(content: Text(errorMessage ?? 'Sign In Failure')),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -3,13 +3,12 @@
|
||||
// -----
|
||||
// File: sign_up_form.dart
|
||||
// Created Date: 19/08/2022 14:41:08
|
||||
// Last Modified: Thu Nov 10 2022
|
||||
// Last Modified: Fri Nov 11 2022
|
||||
// -----
|
||||
// Copyright (c) 2022
|
||||
|
||||
import 'package:example_router/core/constants/form_field.dart';
|
||||
import 'package:flutter/material.dart' hide FormField;
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
@ -110,16 +109,13 @@ class SignUpForm extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<SignUpCubit<int>, SignUpState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isSubmissionFailure) {
|
||||
return SignUpListener(
|
||||
onError: (context, status, errorMessage) =>
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(
|
||||
SnackBar(content: Text(state.errorMessage ?? 'Sign Up Failure')),
|
||||
);
|
||||
}
|
||||
},
|
||||
SnackBar(content: Text(errorMessage ?? 'Sign Up Failure')),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
@ -132,7 +128,6 @@ class SignUpForm extends StatelessWidget {
|
||||
_SignUpButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user