Fix some deprecations.

This commit is contained in:
Dain Nilsson 2023-11-23 15:37:58 +01:00
parent c8007213bd
commit a74c8556ac
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
2 changed files with 19 additions and 15 deletions

View File

@ -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,
),

View File

@ -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();
return PopScope(
canPop: onCancel != null,
onPopInvoked: (didPop) {
if (didPop) {
wasPopped = true;
return true;
} else {
return false;
if (!completed && onCancel != null) {
onCancel();
}
}
},
child: _UserInteractionDialog(
controller: controller,
),
);
));
});
return controller;