💄 Alert max width
This commit is contained in:
@@ -218,6 +218,8 @@ Future<T?> showOverlayDialog<T>({
|
|||||||
return completer.future;
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const kDialogMaxWidth = 480.0;
|
||||||
|
|
||||||
void showErrorAlert(dynamic err) {
|
void showErrorAlert(dynamic err) {
|
||||||
if (err is Error) {
|
if (err is Error) {
|
||||||
talker.error('Something went wrong...', err, err.stackTrace);
|
talker.error('Something went wrong...', err, err.stackTrace);
|
||||||
@@ -231,15 +233,18 @@ void showErrorAlert(dynamic err) {
|
|||||||
|
|
||||||
showOverlayDialog<void>(
|
showOverlayDialog<void>(
|
||||||
builder:
|
builder:
|
||||||
(context, close) => AlertDialog(
|
(context, close) => ConstrainedBox(
|
||||||
title: Text('somethingWentWrong'.tr()),
|
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
|
||||||
content: Text(text),
|
child: AlertDialog(
|
||||||
actions: [
|
title: Text('somethingWentWrong'.tr()),
|
||||||
TextButton(
|
content: Text(text),
|
||||||
onPressed: () => close(null),
|
actions: [
|
||||||
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
TextButton(
|
||||||
),
|
onPressed: () => close(null),
|
||||||
],
|
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -247,15 +252,18 @@ void showErrorAlert(dynamic err) {
|
|||||||
void showInfoAlert(String message, String title) {
|
void showInfoAlert(String message, String title) {
|
||||||
showOverlayDialog<void>(
|
showOverlayDialog<void>(
|
||||||
builder:
|
builder:
|
||||||
(context, close) => AlertDialog(
|
(context, close) => ConstrainedBox(
|
||||||
title: Text(title),
|
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
|
||||||
content: Text(message),
|
child: AlertDialog(
|
||||||
actions: [
|
title: Text(title),
|
||||||
TextButton(
|
content: Text(message),
|
||||||
onPressed: () => close(null),
|
actions: [
|
||||||
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
TextButton(
|
||||||
),
|
onPressed: () => close(null),
|
||||||
],
|
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -263,19 +271,24 @@ void showInfoAlert(String message, String title) {
|
|||||||
Future<bool> showConfirmAlert(String message, String title) async {
|
Future<bool> showConfirmAlert(String message, String title) async {
|
||||||
final result = await showOverlayDialog<bool>(
|
final result = await showOverlayDialog<bool>(
|
||||||
builder:
|
builder:
|
||||||
(context, close) => AlertDialog(
|
(context, close) => ConstrainedBox(
|
||||||
title: Text(title),
|
constraints: const BoxConstraints(maxWidth: kDialogMaxWidth),
|
||||||
content: Text(message),
|
child: AlertDialog(
|
||||||
actions: [
|
title: Text(title),
|
||||||
TextButton(
|
content: Text(message),
|
||||||
onPressed: () => close(false),
|
actions: [
|
||||||
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
|
TextButton(
|
||||||
),
|
onPressed: () => close(false),
|
||||||
TextButton(
|
child: Text(
|
||||||
onPressed: () => close(true),
|
MaterialLocalizations.of(context).cancelButtonLabel,
|
||||||
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
),
|
||||||
),
|
),
|
||||||
],
|
TextButton(
|
||||||
|
onPressed: () => close(true),
|
||||||
|
child: Text(MaterialLocalizations.of(context).okButtonLabel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return result ?? false;
|
return result ?? false;
|
||||||
|
|||||||
Reference in New Issue
Block a user