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
2b33dae9
Unverified
Commit
2b33dae9
authored
Nov 08, 2021
by
Hans Muller
Committed by
GitHub
Nov 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Border customization to CheckboxListTile (reprise) (#93271)
parent
aaf1003a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
checkbox.dart
packages/flutter/lib/src/material/checkbox.dart
+3
-2
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+11
-0
checkbox_list_tile_test.dart
packages/flutter/test/material/checkbox_list_tile_test.dart
+39
-0
No files found.
packages/flutter/lib/src/material/checkbox.dart
View file @
2b33dae9
...
...
@@ -301,8 +301,9 @@ class Checkbox extends StatefulWidget {
/// compatibility.
/// {@endtemplate}
///
/// If this property is null then [CheckboxThemeData.side] of [ThemeData.checkboxTheme]
/// is used. If that's null then the side will be width 2.
/// If this property is null, then [CheckboxThemeData.side] of
/// [ThemeData.checkboxTheme] is used. If that is also null, then the side
/// will be width 2.
final
BorderSide
?
side
;
/// The width of a checkbox widget.
...
...
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
2b33dae9
...
...
@@ -138,6 +138,7 @@ class CheckboxListTile extends StatelessWidget {
this
.
tristate
=
false
,
this
.
shape
,
this
.
selectedTileColor
,
this
.
side
,
this
.
visualDensity
,
this
.
focusNode
,
this
.
enableFeedback
,
...
...
@@ -258,6 +259,15 @@ class CheckboxListTile extends StatelessWidget {
/// If non-null, defines the background color when [CheckboxListTile.selected] is true.
final
Color
?
selectedTileColor
;
/// {@macro flutter.material.checkbox.side}
///
/// The given value is passed directly to [Checkbox.side].
///
/// If this property is null, then [CheckboxThemeData.side] of
/// [ThemeData.checkboxTheme] is used. If that is also null, then the side
/// will be width 2.
final
BorderSide
?
side
;
/// Defines how compact the list tile's layout will be.
///
/// {@macro flutter.material.themedata.visualDensity}
...
...
@@ -298,6 +308,7 @@ class CheckboxListTile extends StatelessWidget {
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
autofocus:
autofocus
,
tristate:
tristate
,
side:
side
,
);
Widget
?
leading
,
trailing
;
switch
(
controlAffinity
)
{
...
...
packages/flutter/test/material/checkbox_list_tile_test.dart
View file @
2b33dae9
...
...
@@ -321,6 +321,45 @@ void main() {
expect
(
textColor
(
'title'
),
activeColor
);
});
testWidgets
(
'CheckboxListTile respects checkbox side'
,
(
WidgetTester
tester
)
async
{
Widget
buildApp
(
BorderSide
side
)
{
return
MaterialApp
(
home:
Material
(
child:
Center
(
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
CheckboxListTile
(
value:
false
,
onChanged:
(
bool
?
newValue
)
{},
side:
side
,
);
}),
),
),
);
}
const
BorderSide
side1
=
BorderSide
(
color:
Color
(
0xfff44336
),
);
await
tester
.
pumpWidget
(
buildApp
(
side1
));
expect
(
tester
.
widget
<
CheckboxListTile
>(
find
.
byType
(
CheckboxListTile
)).
side
,
side1
);
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
side
,
side1
);
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Checkbox
))),
paints
..
drrect
(
color:
const
Color
(
0xfff44336
)),
);
const
BorderSide
side2
=
BorderSide
(
color:
Color
(
0xff424242
),
);
await
tester
.
pumpWidget
(
buildApp
(
side2
));
expect
(
tester
.
widget
<
Checkbox
>(
find
.
byType
(
Checkbox
)).
side
,
side2
);
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Checkbox
))),
paints
..
drrect
(
color:
const
Color
(
0xff424242
)),
);
});
testWidgets
(
'CheckboxListTile respects visualDensity'
,
(
WidgetTester
tester
)
async
{
const
Key
key
=
Key
(
'test'
);
Future
<
void
>
buildTest
(
VisualDensity
visualDensity
)
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