chore: Follow up new dialogs
This commit is contained in:
parent
a1694847b6
commit
21be49c5c0
4 changed files with 15 additions and 3 deletions
|
|
@ -35,7 +35,6 @@ Future<T?> showAdaptiveBottomSheet<T>({
|
||||||
maxWidth: FluffyThemes.columnWidth * 1.25,
|
maxWidth: FluffyThemes.columnWidth * 1.25,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
showDragHandle: !dialogMode,
|
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AdaptiveDialogAction extends StatelessWidget {
|
class AdaptiveDialogAction extends StatelessWidget {
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
final bool autofocus;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
const AdaptiveDialogAction({
|
const AdaptiveDialogAction({
|
||||||
super.key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.child,
|
required this.child,
|
||||||
|
this.autofocus = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -19,10 +21,18 @@ class AdaptiveDialogAction extends StatelessWidget {
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia:
|
||||||
case TargetPlatform.linux:
|
case TargetPlatform.linux:
|
||||||
case TargetPlatform.windows:
|
case TargetPlatform.windows:
|
||||||
return TextButton(onPressed: onPressed, child: child);
|
return TextButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
autofocus: autofocus,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
case TargetPlatform.macOS:
|
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(
|
AdaptiveDialogAction(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
||||||
|
autofocus: true,
|
||||||
child: Text(
|
child: Text(
|
||||||
okLabel ?? L10n.of(context).ok,
|
okLabel ?? L10n.of(context).ok,
|
||||||
style: isDestructive
|
style: isDestructive
|
||||||
|
|
@ -70,6 +71,7 @@ Future<OkCancelResult?> showOkAlertDialog({
|
||||||
AdaptiveDialogAction(
|
AdaptiveDialogAction(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
||||||
|
autofocus: true,
|
||||||
child: Text(okLabel ?? L10n.of(context).close),
|
child: Text(okLabel ?? L10n.of(context).close),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ Future<String?> showTextInputDialog({
|
||||||
}
|
}
|
||||||
Navigator.of(context).pop<String>(input);
|
Navigator.of(context).pop<String>(input);
|
||||||
},
|
},
|
||||||
|
autofocus: true,
|
||||||
child: Text(
|
child: Text(
|
||||||
okLabel ?? L10n.of(context).ok,
|
okLabel ?? L10n.of(context).ok,
|
||||||
style: isDestructive
|
style: isDestructive
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue