mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 18:22:39 +03:00
Fix some deprecations.
This commit is contained in:
parent
c8007213bd
commit
a74c8556ac
@ -58,7 +58,10 @@ PopupMenuItem _buildMenuItem(BuildContext context, ActionItem actionItem) {
|
||||
trailing: shortcut != null
|
||||
? Opacity(
|
||||
opacity: 0.5,
|
||||
child: Text(shortcut, textScaleFactor: 0.7),
|
||||
child: Text(
|
||||
shortcut,
|
||||
textScaler: const TextScaler.linear(0.7),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
|
@ -150,12 +150,14 @@ UserInteractionController _dialogUserInteraction(
|
||||
Widget? icon,
|
||||
void Function()? onCancel,
|
||||
}) {
|
||||
var completed = false;
|
||||
var wasPopped = false;
|
||||
final controller = _UserInteractionController(
|
||||
title: title,
|
||||
description: description,
|
||||
icon: icon,
|
||||
onClosed: () {
|
||||
completed = true;
|
||||
if (!wasPopped) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
@ -165,20 +167,19 @@ UserInteractionController _dialogUserInteraction(
|
||||
context: context,
|
||||
routeSettings: const RouteSettings(name: 'user_interaction_prompt'),
|
||||
builder: (context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (onCancel != null) {
|
||||
onCancel();
|
||||
wasPopped = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
child: _UserInteractionDialog(
|
||||
controller: controller,
|
||||
),
|
||||
);
|
||||
return PopScope(
|
||||
canPop: onCancel != null,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) {
|
||||
wasPopped = true;
|
||||
if (!completed && onCancel != null) {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: _UserInteractionDialog(
|
||||
controller: controller,
|
||||
));
|
||||
});
|
||||
|
||||
return controller;
|
||||
|
Loading…
Reference in New Issue
Block a user