Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a1a5c149
Unverified
Commit
a1a5c149
authored
Feb 23, 2022
by
Bencze Balázs
Committed by
GitHub
Feb 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add actionsOverflowAlignment parameter to dialog (#95995)
parent
f4fc2c87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+17
-1
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+34
-0
No files found.
packages/flutter/lib/src/material/dialog.dart
View file @
a1a5c149
...
...
@@ -261,6 +261,7 @@ class AlertDialog extends StatelessWidget {
this
.
actions
,
this
.
actionsPadding
=
EdgeInsets
.
zero
,
this
.
actionsAlignment
,
this
.
actionsOverflowAlignment
,
this
.
actionsOverflowDirection
,
this
.
actionsOverflowButtonSpacing
,
this
.
buttonPadding
,
...
...
@@ -375,6 +376,21 @@ class AlertDialog extends StatelessWidget {
/// is used.
final
MainAxisAlignment
?
actionsAlignment
;
/// The horizontal alignment of [actions] within the vertical
/// "overflow" layout.
///
/// If the dialog's [actions] do not fit into a single row, then they
/// are arranged in a column. This parameter controls the horizontal
/// alignment of widgets in the case of an overflow.
///
/// If this parameter is null (the default) then [OverflowBarAlignment.end]
/// is used.
///
/// See also:
///
/// * [OverflowBar], which [actions] configures to lay itself out.
final
OverflowBarAlignment
?
actionsOverflowAlignment
;
/// The vertical direction of [actions] if the children overflow
/// horizontally.
///
...
...
@@ -535,7 +551,7 @@ class AlertDialog extends StatelessWidget {
child:
OverflowBar
(
alignment:
actionsAlignment
??
MainAxisAlignment
.
end
,
spacing:
spacing
,
overflowAlignment:
OverflowBarAlignment
.
end
,
overflowAlignment:
actionsOverflowAlignment
??
OverflowBarAlignment
.
end
,
overflowDirection:
actionsOverflowDirection
??
VerticalDirection
.
down
,
overflowSpacing:
actionsOverflowButtonSpacing
??
0
,
children:
actions
!,
...
...
packages/flutter/test/material/dialog_test.dart
View file @
a1a5c149
...
...
@@ -1184,6 +1184,40 @@ void main() {
expect
(
buttonOneRect
.
bottom
,
buttonTwoRect
.
top
-
10.0
);
});
testWidgets
(
'Dialogs can set the alignment of the OverflowBar'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
key1
=
GlobalKey
();
final
GlobalKey
key2
=
GlobalKey
();
final
AlertDialog
dialog
=
AlertDialog
(
title:
const
Text
(
'title'
),
content:
const
Text
(
'content'
),
actions:
<
Widget
>[
ElevatedButton
(
key:
key1
,
onPressed:
()
{},
child:
const
Text
(
'Loooooooooog button 1'
),
),
ElevatedButton
(
key:
key2
,
onPressed:
()
{},
child:
const
Text
(
'Loooooooooooooonger button 2'
),
),
],
actionsOverflowAlignment:
OverflowBarAlignment
.
center
,
);
await
tester
.
pumpWidget
(
_buildAppWithDialog
(
dialog
),
);
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
();
final
Rect
buttonOneRect
=
tester
.
getRect
(
find
.
byKey
(
key1
));
final
Rect
buttonTwoRect
=
tester
.
getRect
(
find
.
byKey
(
key2
));
expect
(
buttonOneRect
.
center
.
dx
,
buttonTwoRect
.
center
.
dx
);
});
testWidgets
(
'Dialogs removes MediaQuery padding and view insets'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
outerContext
;
late
BuildContext
routeContext
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment