diff --git a/lib/ui/login_on_other_device.dart b/lib/ui/login_on_other_device.dart index 321c409..7440540 100644 --- a/lib/ui/login_on_other_device.dart +++ b/lib/ui/login_on_other_device.dart @@ -167,7 +167,8 @@ class _LoginOnOtherDeviceState extends State { ScaffoldMessenger.of(context).snack('Logged in successfully!'.i18n); } - void _cancel() async { + @override + void dispose() async { if (_step2) { final hash = Hmac(sha512, key.bytes).convert(utf8.encode(_code)).toString(); @@ -175,7 +176,7 @@ class _LoginOnOtherDeviceState extends State { data: jsonEncode({'_': 'cancel', 'hash': hash})); } - Navigator.pop(context); + super.dispose(); } @override @@ -237,12 +238,14 @@ class _LoginOnOtherDeviceState extends State { ]), ), actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('Cancel'.i18n)), if (!_step2) TextButton( onPressed: _loading ? null : _doHandshake, child: Text('Login'.i18n), ), - TextButton(onPressed: _cancel, child: Text('Cancel'.i18n)) ], ); }