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
0978b96e
Unverified
Commit
0978b96e
authored
Jan 24, 2022
by
Viren Khatri
Committed by
GitHub
Jan 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds `CheckboxListTile.checkboxShape` (#95714)
parent
fd6547e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+9
-0
checkbox_list_tile_test.dart
packages/flutter/test/material/checkbox_list_tile_test.dart
+21
-6
No files found.
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
0978b96e
...
...
@@ -137,6 +137,7 @@ class CheckboxListTile extends StatelessWidget {
this
.
contentPadding
,
this
.
tristate
=
false
,
this
.
shape
,
this
.
checkboxShape
,
this
.
selectedTileColor
,
this
.
side
,
this
.
visualDensity
,
...
...
@@ -256,6 +257,13 @@ class CheckboxListTile extends StatelessWidget {
/// {@macro flutter.material.ListTile.shape}
final
ShapeBorder
?
shape
;
/// {@macro flutter.material.checkbox.shape}
///
/// If this property is null then [CheckboxThemeData.shape] of [ThemeData.checkboxTheme]
/// is used. If that's null then the shape will be a [RoundedRectangleBorder]
/// with a circular corner radius of 1.0.
final
OutlinedBorder
?
checkboxShape
;
/// If non-null, defines the background color when [CheckboxListTile.selected] is true.
final
Color
?
selectedTileColor
;
...
...
@@ -308,6 +316,7 @@ class CheckboxListTile extends StatelessWidget {
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
autofocus:
autofocus
,
tristate:
tristate
,
shape:
checkboxShape
,
side:
side
,
);
Widget
?
leading
,
trailing
;
...
...
packages/flutter/test/material/checkbox_list_tile_test.dart
View file @
0978b96e
...
...
@@ -321,8 +321,8 @@ void main() {
expect
(
textColor
(
'title'
),
activeColor
);
});
testWidgets
(
'CheckboxListTile respects checkbox side'
,
(
WidgetTester
tester
)
async
{
Widget
buildApp
(
BorderSide
side
)
{
testWidgets
(
'CheckboxListTile respects checkbox s
hape and s
ide'
,
(
WidgetTester
tester
)
async
{
Widget
buildApp
(
BorderSide
side
,
OutlinedBorder
shape
)
{
return
MaterialApp
(
home:
Material
(
child:
Center
(
...
...
@@ -331,32 +331,47 @@ void main() {
value:
false
,
onChanged:
(
bool
?
newValue
)
{},
side:
side
,
checkboxShape:
shape
,
);
}),
),
),
);
}
const
RoundedRectangleBorder
border1
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
5
)));
const
BorderSide
side1
=
BorderSide
(
color:
Color
(
0xfff44336
),
);
await
tester
.
pumpWidget
(
buildApp
(
side1
));
await
tester
.
pumpWidget
(
buildApp
(
side1
,
border1
));
expect
(
tester
.
widget
<
CheckboxListTile
>(
find
.
byType
(
CheckboxListTile
)).
side
,
side1
);
expect
(
tester
.
widget
<
CheckboxListTile
>(
find
.
byType
(
CheckboxListTile
)).
checkboxShape
,
border1
);
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
side
,
side1
);
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
shape
,
border1
);
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Checkbox
))),
paints
..
drrect
(
color:
const
Color
(
0xfff44336
)),
..
drrect
(
color:
const
Color
(
0xfff44336
),
outer:
RRect
.
fromLTRBR
(
11.0
,
11.0
,
29.0
,
29.0
,
const
Radius
.
circular
(
5
)),
inner:
RRect
.
fromLTRBR
(
12.0
,
12.0
,
28.0
,
28.0
,
const
Radius
.
circular
(
4
)),
),
);
const
RoundedRectangleBorder
border2
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
5
)));
const
BorderSide
side2
=
BorderSide
(
width:
4.0
,
color:
Color
(
0xff424242
),
);
await
tester
.
pumpWidget
(
buildApp
(
side2
));
await
tester
.
pumpWidget
(
buildApp
(
side2
,
border2
));
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
side
,
side2
);
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
shape
,
border2
);
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Checkbox
))),
paints
..
drrect
(
color:
const
Color
(
0xff424242
)),
..
drrect
(
color:
const
Color
(
0xff424242
),
outer:
RRect
.
fromLTRBR
(
11.0
,
11.0
,
29.0
,
29.0
,
const
Radius
.
circular
(
5
)),
inner:
RRect
.
fromLTRBR
(
15.0
,
15.0
,
25.0
,
25.0
,
const
Radius
.
circular
(
1
)),
),
);
});
...
...
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