Skip to content

Commit 991a4fe

Browse files
committed
dialog [nfc]: Inline _materialDialogActionText in _adaptiveAction
As suggested at: #1017 (comment)
1 parent dfc0821 commit 991a4fe

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
@@ -4,28 +4,24 @@ import 'package:flutter/material.dart';
44

55
import '../generated/l10n/zulip_localizations.dart';
66

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

0 commit comments

Comments
 (0)