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
6d9e3c3f
Unverified
Commit
6d9e3c3f
authored
Jan 26, 2021
by
Yurii Cherniavskyi
Committed by
GitHub
Jan 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose insetPadding and clipBehavior in SimpleDialog (#73571)
parent
f5c0a7b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+10
-0
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+17
-3
No files found.
packages/flutter/lib/src/material/dialog.dart
View file @
6d9e3c3f
...
...
@@ -736,6 +736,8 @@ class SimpleDialog extends StatelessWidget {
this
.
backgroundColor
,
this
.
elevation
,
this
.
semanticLabel
,
this
.
insetPadding
=
_defaultInsetPadding
,
this
.
clipBehavior
=
Clip
.
none
,
this
.
shape
,
})
:
assert
(
titlePadding
!=
null
),
assert
(
contentPadding
!=
null
),
...
...
@@ -804,6 +806,12 @@ class SimpleDialog extends StatelessWidget {
/// value is used.
final
String
?
semanticLabel
;
/// {@macro flutter.material.dialog.insetPadding}
final
EdgeInsets
insetPadding
;
/// {@macro flutter.material.dialog.clipBehavior}
final
Clip
clipBehavior
;
/// {@macro flutter.material.dialog.shape}
final
ShapeBorder
?
shape
;
...
...
@@ -890,6 +898,8 @@ class SimpleDialog extends StatelessWidget {
return
Dialog
(
backgroundColor:
backgroundColor
,
elevation:
elevation
,
insetPadding:
insetPadding
,
clipBehavior:
clipBehavior
,
shape:
shape
,
child:
dialogChild
,
);
...
...
packages/flutter/test/material/dialog_test.dart
View file @
6d9e3c3f
...
...
@@ -40,11 +40,11 @@ MaterialApp _buildAppWithDialog(Widget dialog, { ThemeData? theme, double textSc
}
Material
_getMaterialFromDialog
(
WidgetTester
tester
)
{
return
tester
.
widget
<
Material
>(
find
.
descendant
(
of:
find
.
byType
(
Alert
Dialog
),
matching:
find
.
byType
(
Material
)));
return
tester
.
widget
<
Material
>(
find
.
descendant
(
of:
find
.
byType
(
Dialog
),
matching:
find
.
byType
(
Material
)));
}
RenderParagraph
_getTextRenderObjectFromDialog
(
WidgetTester
tester
,
String
text
)
{
return
tester
.
element
<
StatelessElement
>(
find
.
descendant
(
of:
find
.
byType
(
Alert
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
;
}
const
ShapeBorder
_defaultDialogShape
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4.0
)));
...
...
@@ -158,7 +158,7 @@ void main() {
expect
(
content
.
text
.
style
,
contentTextStyle
);
});
testWidgets
(
'
C
ustom clipBehavior'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
AlertDialog c
ustom clipBehavior'
,
(
WidgetTester
tester
)
async
{
const
AlertDialog
dialog
=
AlertDialog
(
actions:
<
Widget
>[],
clipBehavior:
Clip
.
antiAlias
,
...
...
@@ -172,6 +172,20 @@ void main() {
expect
(
materialWidget
.
clipBehavior
,
Clip
.
antiAlias
);
});
testWidgets
(
'SimpleDialog custom clipBehavior'
,
(
WidgetTester
tester
)
async
{
const
SimpleDialog
dialog
=
SimpleDialog
(
children:
<
Widget
>[],
clipBehavior:
Clip
.
antiAlias
,
);
await
tester
.
pumpWidget
(
_buildAppWithDialog
(
dialog
));
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
();
final
Material
materialWidget
=
_getMaterialFromDialog
(
tester
);
expect
(
materialWidget
.
clipBehavior
,
Clip
.
antiAlias
);
});
testWidgets
(
'Custom dialog shape'
,
(
WidgetTester
tester
)
async
{
const
RoundedRectangleBorder
customBorder
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
16.0
)));
...
...
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