1
1
import 'package:flutter/material.dart' ;
2
2
3
3
import '../generated/l10n/zulip_localizations.dart' ;
4
+ import 'actions.dart' ;
4
5
5
6
Widget _dialogActionText (String text) {
6
7
return Text (
@@ -27,7 +28,8 @@ class DialogStatus {
27
28
final Future <void > closed;
28
29
}
29
30
30
- /// Displays an [AlertDialog] with a dismiss button.
31
+ /// Displays an [AlertDialog] with a dismiss button
32
+ /// and optional "Learn more" button.
31
33
///
32
34
/// The [DialogStatus.closed] field of the return value can be used
33
35
/// for waiting for the dialog to be closed.
@@ -39,6 +41,7 @@ DialogStatus showErrorDialog({
39
41
required BuildContext context,
40
42
required String title,
41
43
String ? message,
44
+ Uri ? learnMoreButtonUrl,
42
45
}) {
43
46
final zulipLocalizations = ZulipLocalizations .of (context);
44
47
final future = showDialog <void >(
@@ -47,6 +50,10 @@ DialogStatus showErrorDialog({
47
50
title: Text (title),
48
51
content: message != null ? SingleChildScrollView (child: Text (message)) : null ,
49
52
actions: [
53
+ if (learnMoreButtonUrl != null )
54
+ TextButton (
55
+ onPressed: () => PlatformActions .launchUrl (context, learnMoreButtonUrl),
56
+ child: _dialogActionText (zulipLocalizations.errorDialogLearnMore)),
50
57
TextButton (
51
58
onPressed: () => Navigator .pop (context),
52
59
child: _dialogActionText (zulipLocalizations.errorDialogContinue)),
0 commit comments