send cancel on widget dispose
This commit is contained in:
parent
b8f0bb2140
commit
15490444a9
|
@ -167,7 +167,8 @@ class _LoginOnOtherDeviceState extends State<LoginOnOtherDevice> {
|
|||
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<LoginOnOtherDevice> {
|
|||
data: jsonEncode({'_': 'cancel', 'hash': hash}));
|
||||
}
|
||||
|
||||
Navigator.pop(context);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -237,12 +238,14 @@ class _LoginOnOtherDeviceState extends State<LoginOnOtherDevice> {
|
|||
]),
|
||||
),
|
||||
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))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue