chore: Follow up new dialogs

pull/1519/head
krille-chan 11 months ago
parent a1694847b6
commit 21be49c5c0
No known key found for this signature in database

@ -35,7 +35,6 @@ Future<T?> showAdaptiveBottomSheet<T>({
maxWidth: FluffyThemes.columnWidth * 1.25,
),
backgroundColor: Colors.transparent,
showDragHandle: !dialogMode,
clipBehavior: Clip.hardEdge,
);
}

@ -3,12 +3,14 @@ import 'package:flutter/material.dart';
class AdaptiveDialogAction extends StatelessWidget {
final VoidCallback? onPressed;
final bool autofocus;
final Widget child;
const AdaptiveDialogAction({
super.key,
required this.onPressed,
required this.child,
this.autofocus = false,
});
@override
@ -19,10 +21,18 @@ class AdaptiveDialogAction extends StatelessWidget {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return TextButton(onPressed: onPressed, child: child);
return TextButton(
onPressed: onPressed,
autofocus: autofocus,
child: child,
);
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return CupertinoDialogAction(onPressed: onPressed, child: child);
return CupertinoDialogAction(
onPressed: onPressed,
isDefaultAction: autofocus,
child: child,
);
}
}
}

@ -36,6 +36,7 @@ Future<OkCancelResult?> showOkCancelAlertDialog({
AdaptiveDialogAction(
onPressed: () =>
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
autofocus: true,
child: Text(
okLabel ?? L10n.of(context).ok,
style: isDestructive
@ -70,6 +71,7 @@ Future<OkCancelResult?> showOkAlertDialog({
AdaptiveDialogAction(
onPressed: () =>
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
autofocus: true,
child: Text(okLabel ?? L10n.of(context).close),
),
],

@ -87,6 +87,7 @@ Future<String?> showTextInputDialog({
}
Navigator.of(context).pop<String>(input);
},
autofocus: true,
child: Text(
okLabel ?? L10n.of(context).ok,
style: isDestructive

Loading…
Cancel
Save