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