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
fe0ceeb8
Unverified
Commit
fe0ceeb8
authored
Feb 17, 2021
by
Hans Muller
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland: Removed ButtonBar from AlertDialog #75676 (#76167)
parent
733e3890
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
24 deletions
+32
-24
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+12
-11
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+20
-13
No files found.
packages/flutter/lib/src/material/dialog.dart
View file @
fe0ceeb8
...
@@ -424,13 +424,8 @@ class AlertDialog extends StatelessWidget {
...
@@ -424,13 +424,8 @@ class AlertDialog extends StatelessWidget {
/// This is different from [actionsPadding], which defines the padding
/// This is different from [actionsPadding], which defines the padding
/// between the entire button bar and the edges of the dialog.
/// between the entire button bar and the edges of the dialog.
///
///
/// If this property is null, then it will use the surrounding
/// If this property is null, then it will default to
/// [ButtonBarThemeData.buttonPadding]. If that is null, it will default to
/// 8.0 logical pixels on the left and right.
/// 8.0 logical pixels on the left and right.
///
/// See also:
///
/// * [ButtonBar], which [actions] configures to lay itself out.
final
EdgeInsetsGeometry
?
buttonPadding
;
final
EdgeInsetsGeometry
?
buttonPadding
;
/// {@macro flutter.material.dialog.backgroundColor}
/// {@macro flutter.material.dialog.backgroundColor}
...
@@ -538,13 +533,19 @@ class AlertDialog extends StatelessWidget {
...
@@ -538,13 +533,19 @@ class AlertDialog extends StatelessWidget {
if
(
actions
!=
null
)
{
if
(
actions
!=
null
)
{
final
double
spacing
=
(
buttonPadding
?.
horizontal
??
16
)
/
2
;
actionsWidget
=
Padding
(
actionsWidget
=
Padding
(
padding:
actionsPadding
,
padding:
actionsPadding
,
child:
ButtonBar
(
child:
Container
(
buttonPadding:
buttonPadding
,
alignment:
AlignmentDirectional
.
centerEnd
,
overflowDirection:
actionsOverflowDirection
,
padding:
EdgeInsets
.
all
(
spacing
),
overflowButtonSpacing:
actionsOverflowButtonSpacing
,
child:
OverflowBar
(
children:
actions
!,
spacing:
spacing
,
overflowAlignment:
OverflowBarAlignment
.
end
,
overflowDirection:
actionsOverflowDirection
??
VerticalDirection
.
down
,
overflowSpacing:
actionsOverflowButtonSpacing
??
0
,
children:
actions
!,
),
),
),
);
);
}
}
...
...
packages/flutter/test/material/dialog_test.dart
View file @
fe0ceeb8
...
@@ -46,6 +46,13 @@ RenderParagraph _getTextRenderObjectFromDialog(WidgetTester tester, String text)
...
@@ -46,6 +46,13 @@ RenderParagraph _getTextRenderObjectFromDialog(WidgetTester tester, String text)
return
tester
.
element
<
StatelessElement
>(
find
.
descendant
(
of:
find
.
byType
(
Dialog
),
matching:
find
.
text
(
text
))).
renderObject
!
as
RenderParagraph
;
return
tester
.
element
<
StatelessElement
>(
find
.
descendant
(
of:
find
.
byType
(
Dialog
),
matching:
find
.
text
(
text
))).
renderObject
!
as
RenderParagraph
;
}
}
// What was the AlertDialog's ButtonBar when many of these tests were written,
// is now a Container with an OverflowBar child. The Container's size and location
// match the original ButtonBar's size and location.
Finder
_findButtonBar
(
)
{
return
find
.
ancestor
(
of:
find
.
byType
(
OverflowBar
),
matching:
find
.
byType
(
Container
)).
first
;
}
const
ShapeBorder
_defaultDialogShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4.0
)));
const
ShapeBorder
_defaultDialogShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4.0
)));
void
main
(
)
{
void
main
(
)
{
...
@@ -495,7 +502,7 @@ void main() {
...
@@ -495,7 +502,7 @@ void main() {
matching:
find
.
byType
(
Material
),
matching:
find
.
byType
(
Material
),
).
first
,
).
first
,
);
);
final
Size
actionsSize
=
tester
.
getSize
(
find
.
byType
(
ButtonBar
));
final
Size
actionsSize
=
tester
.
getSize
(
_findButtonBar
(
));
expect
(
actionsSize
.
width
,
dialogSize
.
width
);
expect
(
actionsSize
.
width
,
dialogSize
.
width
);
});
});
...
@@ -529,7 +536,7 @@ void main() {
...
@@ -529,7 +536,7 @@ void main() {
matching:
find
.
byType
(
Material
),
matching:
find
.
byType
(
Material
),
).
first
,
).
first
,
);
);
final
Size
actionsSize
=
tester
.
getSize
(
find
.
byType
(
ButtonBar
));
final
Size
actionsSize
=
tester
.
getSize
(
_findButtonBar
(
));
expect
(
actionsSize
.
width
,
dialogSize
.
width
-
(
30.0
*
2
));
expect
(
actionsSize
.
width
,
dialogSize
.
width
-
(
30.0
*
2
));
});
});
...
@@ -572,25 +579,25 @@ void main() {
...
@@ -572,25 +579,25 @@ void main() {
// First button
// First button
expect
(
expect
(
tester
.
getTopRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getTopRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getTopRight
(
find
.
byType
(
ButtonBar
)).
dy
+
8.0
,
tester
.
getTopRight
(
_findButtonBar
(
)).
dy
+
8.0
,
);
// top
);
// top
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getBottomRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dy
-
8.0
,
tester
.
getBottomRight
(
_findButtonBar
(
)).
dy
-
8.0
,
);
// bottom
);
// bottom
// Second button
// Second button
expect
(
expect
(
tester
.
getTopRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getTopRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getTopRight
(
find
.
byType
(
ButtonBar
)).
dy
+
8.0
,
tester
.
getTopRight
(
_findButtonBar
(
)).
dy
+
8.0
,
);
// top
);
// top
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dy
-
8.0
,
tester
.
getBottomRight
(
_findButtonBar
(
)).
dy
-
8.0
,
);
// bottom
);
// bottom
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dx
,
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dx
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dx
-
8.0
,
tester
.
getBottomRight
(
_findButtonBar
(
)).
dx
-
8.0
,
);
// right
);
// right
});
});
...
@@ -636,25 +643,25 @@ void main() {
...
@@ -636,25 +643,25 @@ void main() {
// First button
// First button
expect
(
expect
(
tester
.
getTopRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getTopRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getTopRight
(
find
.
byType
(
ButtonBar
)).
dy
+
((
10.0
+
20.0
)
/
2
),
tester
.
getTopRight
(
_findButtonBar
(
)).
dy
+
((
10.0
+
20.0
)
/
2
),
);
// top
);
// top
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getBottomRight
(
find
.
byKey
(
key1
)).
dy
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dy
-
((
10.0
+
20.0
)
/
2
),
tester
.
getBottomRight
(
_findButtonBar
(
)).
dy
-
((
10.0
+
20.0
)
/
2
),
);
// bottom
);
// bottom
// Second button
// Second button
expect
(
expect
(
tester
.
getTopRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getTopRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getTopRight
(
find
.
byType
(
ButtonBar
)).
dy
+
((
10.0
+
20.0
)
/
2
),
tester
.
getTopRight
(
_findButtonBar
(
)).
dy
+
((
10.0
+
20.0
)
/
2
),
);
// top
);
// top
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dy
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dy
-
((
10.0
+
20.0
)
/
2
),
tester
.
getBottomRight
(
_findButtonBar
(
)).
dy
-
((
10.0
+
20.0
)
/
2
),
);
// bottom
);
// bottom
expect
(
expect
(
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dx
,
tester
.
getBottomRight
(
find
.
byKey
(
key2
)).
dx
,
tester
.
getBottomRight
(
find
.
byType
(
ButtonBar
)).
dx
-
((
10.0
+
20.0
)
/
2
),
tester
.
getBottomRight
(
_findButtonBar
(
)).
dx
-
((
10.0
+
20.0
)
/
2
),
);
// right
);
// right
});
});
...
@@ -675,7 +682,7 @@ void main() {
...
@@ -675,7 +682,7 @@ void main() {
final
Finder
dialogFinder
=
find
.
descendant
(
of:
find
.
byType
(
Dialog
),
matching:
find
.
byType
(
Material
)).
first
;
final
Finder
dialogFinder
=
find
.
descendant
(
of:
find
.
byType
(
Dialog
),
matching:
find
.
byType
(
Material
)).
first
;
final
Finder
titleFinder
=
find
.
byKey
(
titleKey
);
final
Finder
titleFinder
=
find
.
byKey
(
titleKey
);
final
Finder
contentFinder
=
find
.
byKey
(
contentKey
);
final
Finder
contentFinder
=
find
.
byKey
(
contentKey
);
final
Finder
actionsFinder
=
find
.
byType
(
ButtonBar
);
final
Finder
actionsFinder
=
_findButtonBar
(
);
final
Finder
childrenFinder
=
find
.
byKey
(
childrenKey
);
final
Finder
childrenFinder
=
find
.
byKey
(
childrenKey
);
Future
<
void
>
openDialog
(
WidgetTester
tester
,
Widget
dialog
,
double
textScaleFactor
)
async
{
Future
<
void
>
openDialog
(
WidgetTester
tester
,
Widget
dialog
,
double
textScaleFactor
)
async
{
...
...
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