Skip to content

Commit ec1baee

Browse files
u7088495gnprice
authored andcommitted
dialog [nfc]: Inline _materialDialogActionText in _adaptiveAction
As suggested at: #1017 (comment)
1 parent bd112c2 commit ec1baee

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

lib/widgets/dialog.dart

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,25 @@ import 'app.dart';
99
import 'content.dart';
1010
import 'store.dart';
1111

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

0 commit comments

Comments
 (0)