login loading
This commit is contained in:
parent
4c78c8fbc0
commit
6081fd134f
@ -20,6 +20,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
List<BiometricType>? _availableBiometrics;
|
List<BiometricType>? _availableBiometrics;
|
||||||
String _authorized = "Not Authorized";
|
String _authorized = "Not Authorized";
|
||||||
bool _isAuthenticating = false;
|
bool _isAuthenticating = false;
|
||||||
|
bool _isSigningIn = false;
|
||||||
_SupportState _supportState = _SupportState.unknown;
|
_SupportState _supportState = _SupportState.unknown;
|
||||||
|
|
||||||
var _obscurePassword = true;
|
var _obscurePassword = true;
|
||||||
@ -43,10 +44,18 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _submit() {
|
Future<void> _submit() async {
|
||||||
final form = _formKey.currentState;
|
final form = _formKey.currentState;
|
||||||
if (form == null || !form.validate()) return;
|
if (form == null || !form.validate()) return;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_isSigningIn = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
await Future<void>.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
Navigator.of(context).pushReplacement(
|
Navigator.of(context).pushReplacement(
|
||||||
MaterialPageRoute(builder: (_) => const MainShell()),
|
MaterialPageRoute(builder: (_) => const MainShell()),
|
||||||
);
|
);
|
||||||
@ -245,7 +254,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: FilledButton(
|
child: FilledButton(
|
||||||
onPressed: _submit,
|
onPressed: _isSigningIn ? null : _submit,
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
backgroundColor: colorScheme.primary,
|
backgroundColor: colorScheme.primary,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -254,7 +263,18 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
borderRadius: BorderRadius.circular(18),
|
borderRadius: BorderRadius.circular(18),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: _isSigningIn
|
||||||
|
? const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2.4,
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const Text(
|
||||||
'Sign In',
|
'Sign In',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user