Skip to content

Commit 39a6ffe

Browse files
committed
dialog [nfc]: Inline _materialDialogActionText in _adaptiveAction
As suggested at: #1017 (comment)
1 parent 049a972 commit 39a6ffe

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

lib/widgets/dialog.dart

+11-15
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,24 @@ import 'package:flutter/material.dart';
55
import '../generated/l10n/zulip_localizations.dart';
66
import 'actions.dart';
77

8-
Widget _materialDialogActionText(String text) {
9-
return Text(
10-
text,
11-
12-
// As suggested by
13-
// https://api.flutter.dev/flutter/material/AlertDialog/actions.html :
14-
// > It is recommended to set the Text.textAlign to TextAlign.end
15-
// > for the Text within the TextButton, so that buttons whose
16-
// > labels wrap to an extra line align with the overall
17-
// > OverflowBar's alignment within the dialog.
18-
textAlign: TextAlign.end,
19-
);
20-
}
21-
228
/// A platform-appropriate action for [AlertDialog.adaptive]'s [actions] param.
239
Widget _adaptiveAction({required VoidCallback onPressed, required String text}) {
2410
switch (defaultTargetPlatform) {
2511
case TargetPlatform.android:
2612
case TargetPlatform.fuchsia:
2713
case TargetPlatform.linux:
2814
case TargetPlatform.windows:
29-
return TextButton(onPressed: onPressed, child: _materialDialogActionText(text));
15+
return TextButton(
16+
onPressed: onPressed,
17+
child: Text(
18+
text,
19+
// As suggested by
20+
// https://api.flutter.dev/flutter/material/AlertDialog/actions.html :
21+
// > It is recommended to set the Text.textAlign to TextAlign.end
22+
// > for the Text within the TextButton, so that buttons whose
23+
// > labels wrap to an extra line align with the overall
24+
// > OverflowBar's alignment within the dialog.
25+
textAlign: TextAlign.end));
3026
case TargetPlatform.iOS:
3127
case TargetPlatform.macOS:
3228
return CupertinoDialogAction(onPressed: onPressed, child: Text(text));

0 commit comments

Comments
 (0)