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
35174124
Unverified
Commit
35174124
authored
Oct 07, 2020
by
Ayush Bherwani
Committed by
GitHub
Oct 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposes ListTile.shape for CheckboxListTile and SwitchListTile (#67419)
parent
b3f9944f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
0 deletions
+49
-0
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+5
-0
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+2
-0
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+6
-0
checkbox_list_tile_test.dart
packages/flutter/test/material/checkbox_list_tile_test.dart
+17
-0
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+19
-0
No files found.
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
35174124
...
...
@@ -272,6 +272,7 @@ class CheckboxListTile extends StatelessWidget {
this
.
autofocus
=
false
,
this
.
contentPadding
,
this
.
tristate
=
false
,
this
.
shape
,
})
:
assert
(
tristate
!=
null
),
assert
(
tristate
||
value
!=
null
),
assert
(
isThreeLine
!=
null
),
...
...
@@ -380,6 +381,9 @@ class CheckboxListTile extends StatelessWidget {
/// If tristate is false (the default), [value] must not be null.
final
bool
tristate
;
/// {@macro flutter.material.ListTile.shape}
final
ShapeBorder
?
shape
;
void
_handleValueChange
()
{
assert
(
onChanged
!=
null
);
switch
(
value
)
{
...
...
@@ -433,6 +437,7 @@ class CheckboxListTile extends StatelessWidget {
selected:
selected
,
autofocus:
autofocus
,
contentPadding:
contentPadding
,
shape:
shape
,
),
),
);
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
35174124
...
...
@@ -96,7 +96,9 @@ class ListTileTheme extends InheritedTheme {
/// If true then [ListTile]s will have the vertically dense layout.
final
bool
dense
;
/// {@template flutter.material.ListTile.shape}
/// If specified, [shape] defines the shape of the [ListTile]'s [InkWell] border.
/// {@endtemplate}
final
ShapeBorder
?
shape
;
/// If specified, [style] defines the font used for [ListTile] titles.
...
...
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
35174124
...
...
@@ -273,6 +273,7 @@ class SwitchListTile extends StatelessWidget {
this
.
selected
=
false
,
this
.
autofocus
=
false
,
this
.
controlAffinity
=
ListTileControlAffinity
.
platform
,
this
.
shape
,
})
:
_switchListTileType
=
_SwitchListTileType
.
material
,
assert
(
value
!=
null
),
assert
(
isThreeLine
!=
null
),
...
...
@@ -308,6 +309,7 @@ class SwitchListTile extends StatelessWidget {
this
.
selected
=
false
,
this
.
autofocus
=
false
,
this
.
controlAffinity
=
ListTileControlAffinity
.
platform
,
this
.
shape
,
})
:
_switchListTileType
=
_SwitchListTileType
.
adaptive
,
assert
(
value
!=
null
),
assert
(
isThreeLine
!=
null
),
...
...
@@ -435,6 +437,9 @@ class SwitchListTile extends StatelessWidget {
/// By default, the value of `controlAffinity` is [ListTileControlAffinity.platform].
final
ListTileControlAffinity
controlAffinity
;
/// {@macro flutter.material.ListTile.shape}
final
ShapeBorder
?
shape
;
@override
Widget
build
(
BuildContext
context
)
{
Widget
control
;
...
...
@@ -497,6 +502,7 @@ class SwitchListTile extends StatelessWidget {
onTap:
onChanged
!=
null
?
()
{
onChanged
!(!
value
);
}
:
null
,
selected:
selected
,
autofocus:
autofocus
,
shape:
shape
,
),
),
);
...
...
packages/flutter/test/material/checkbox_list_tile_test.dart
View file @
35174124
...
...
@@ -224,4 +224,21 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
_value
,
false
);
});
testWidgets
(
'CheckboxListTile respects shape'
,
(
WidgetTester
tester
)
async
{
const
ShapeBorder
shapeBorder
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
horizontal
(
right:
Radius
.
circular
(
100
))
);
await
tester
.
pumpWidget
(
wrap
(
child:
const
CheckboxListTile
(
value:
false
,
onChanged:
null
,
title:
Text
(
'Title'
),
shape:
shapeBorder
,
),
));
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
});
}
packages/flutter/test/material/switch_list_tile_test.dart
View file @
35174124
...
...
@@ -340,4 +340,23 @@ void main() {
expect
(
listTile
.
leading
.
runtimeType
,
Icon
);
expect
(
listTile
.
trailing
.
runtimeType
,
Switch
);
});
testWidgets
(
'SwitchListTile respects shape'
,
(
WidgetTester
tester
)
async
{
const
ShapeBorder
shapeBorder
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
horizontal
(
right:
Radius
.
circular
(
100
))
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
SwitchListTile
(
value:
true
,
onChanged:
null
,
title:
Text
(
'Title'
),
shape:
shapeBorder
,
),
),
));
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
});
}
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