forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialog.dart
More file actions
41 lines (38 loc) · 1.23 KB
/
Copy pathdialog.dart
File metadata and controls
41 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:omi/utils/l10n_extensions.dart';
import 'package:omi/utils/platform/platform_service.dart';
getDialog(
BuildContext context,
Function onCancel,
Function onConfirm,
String title,
String content, {
bool singleButton = false,
String? okButtonText,
String? cancelButtonText,
}) {
final okText = okButtonText ?? context.l10n.ok;
final cancelText = cancelButtonText ?? context.l10n.cancel;
var actions = singleButton
? [
TextButton(
onPressed: () => onCancel(),
child: Text(okText, style: const TextStyle(color: Colors.white)),
),
]
: [
TextButton(
onPressed: () => onCancel(),
child: Text(cancelText, style: const TextStyle(color: Colors.white)),
),
TextButton(
onPressed: () => onConfirm(),
child: Text(okText, style: const TextStyle(color: Colors.white)),
),
];
if (PlatformService.isApple) {
return CupertinoAlertDialog(title: Text(title), content: Text(content), actions: actions);
}
return AlertDialog(title: Text(title), content: Text(content), actions: actions);
}