Skip to content

Commit 373cd75

Browse files
committed
dialog [nfc]: inline _materialDialogActionTest in _adaptiveAction
As was suggested in a comment of the pull request #1017 (comment).
1 parent 52d3e71 commit 373cd75

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

lib/widgets/dialog.dart

+7-15
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,20 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';
44
import 'package:flutter/foundation.dart';
55

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

0 commit comments

Comments
 (0)