1- import 'package:flutter/material.dart' ;
21import 'package:animated_login/animated_login.dart' ;
3-
42import 'package:async/async.dart' ;
3+ import 'package:flutter/material.dart' ;
54
65import 'dialog_builders.dart' ;
76import 'login_functions.dart' ;
@@ -91,11 +90,15 @@ class _LoginScreenState extends State<LoginScreen> {
9190 languageOptions: _languageOptions,
9291 selectedLanguage: language,
9392 initialMode: currentMode,
94- onAuthModeChange: (AuthMode newMode) => currentMode = newMode,
93+ onAuthModeChange: (AuthMode newMode) async {
94+ currentMode = newMode;
95+ await _operation? .cancel ();
96+ },
9597 );
9698 }
9799
98100 Future <String ?> _authOperation (Future <String ?> func) async {
101+ await _operation? .cancel ();
99102 _operation = CancelableOperation .fromFuture (func);
100103 final String ? res = await _operation? .valueOrCancellation ();
101104 if (_operation? .isCompleted == true && res == null ) {
@@ -134,6 +137,8 @@ class _LoginScreenState extends State<LoginScreen> {
134137 languageDialogTheme: LanguageDialogTheme (
135138 optionMargin: EdgeInsets .symmetric (horizontal: 80 )),
136139 ),
140+ loadingSocialButtonColor: Colors .blue,
141+ loadingButtonColor: Colors .white,
137142 );
138143
139144 /// You can adjust the colors, text styles, button styles, borders
@@ -147,6 +152,19 @@ class _LoginScreenState extends State<LoginScreen> {
147152 // actionButtonStyle: ButtonStyle(
148153 // foregroundColor: MaterialStateProperty.all(Colors.blue),
149154 // ),
155+ // animatedComponentOrder: const <AnimatedComponent>[
156+ // AnimatedComponent(component: LoginComponents.logo),
157+ // AnimatedComponent(component: LoginComponents.title),
158+ // AnimatedComponent(component: LoginComponents.description),
159+ // AnimatedComponent(component: LoginComponents.formTitle),
160+ // AnimatedComponent(component: LoginComponents.socialLogins),
161+ // AnimatedComponent(component: LoginComponents.useEmail),
162+ // AnimatedComponent(component: LoginComponents.form),
163+ // AnimatedComponent(component: LoginComponents.notHaveAnAccount),
164+ // AnimatedComponent(component: LoginComponents.forgotPassword),
165+ // AnimatedComponent(component: LoginComponents.changeActionButton),
166+ // AnimatedComponent(component: LoginComponents.actionButton),
167+ // ],
150168 );
151169
152170 LoginTexts get _loginTexts => LoginTexts (
@@ -179,6 +197,7 @@ class _LoginScreenState extends State<LoginScreen> {
179197 ];
180198
181199 Future <String ?> _socialCallback (String type) async {
200+ await _operation? .cancel ();
182201 _operation = CancelableOperation .fromFuture (
183202 LoginFunctions (context).socialLogin (type));
184203 final String ? res = await _operation? .valueOrCancellation ();
0 commit comments