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
50970cd7
Unverified
Commit
50970cd7
authored
Nov 02, 2020
by
Yash Johri
Committed by
GitHub
Nov 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RadioListTile] Adds shape, tileColor and selectedTileColor to RadioListTile (#69399)
parent
734d2a22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
1 deletion
+79
-1
radio_list_tile.dart
packages/flutter/lib/src/material/radio_list_tile.dart
+16
-1
radio_list_tile_test.dart
packages/flutter/test/material/radio_list_tile_test.dart
+63
-0
No files found.
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
50970cd7
...
...
@@ -320,7 +320,9 @@ class RadioListTile<T> extends StatelessWidget {
this
.
controlAffinity
=
ListTileControlAffinity
.
platform
,
this
.
autofocus
=
false
,
this
.
contentPadding
,
this
.
shape
,
this
.
tileColor
,
this
.
selectedTileColor
,
})
:
assert
(
toggleable
!=
null
),
assert
(
isThreeLine
!=
null
),
assert
(!
isThreeLine
||
subtitle
!=
null
),
...
...
@@ -483,6 +485,16 @@ class RadioListTile<T> extends StatelessWidget {
/// To control this value, set [value] and [groupValue] appropriately.
bool
get
checked
=>
value
==
groupValue
;
/// If specified, [shape] defines the shape of the [RadioListTile]'s [InkWell] border.
final
ShapeBorder
?
shape
;
/// If specified, defines the background color for `RadioListTile` when
/// [RadioListTile.selected] is false.
final
Color
?
tileColor
;
/// If non-null, defines the background color when [RadioListTile.selected] is true.
final
Color
?
selectedTileColor
;
@override
Widget
build
(
BuildContext
context
)
{
final
Widget
control
=
Radio
<
T
>(
...
...
@@ -517,6 +529,9 @@ class RadioListTile<T> extends StatelessWidget {
isThreeLine:
isThreeLine
,
dense:
dense
,
enabled:
onChanged
!=
null
,
shape:
shape
,
tileColor:
tileColor
,
selectedTileColor:
selectedTileColor
,
onTap:
onChanged
!=
null
?
()
{
if
(
toggleable
&&
checked
)
{
onChanged
!(
null
);
...
...
packages/flutter/test/material/radio_list_tile_test.dart
View file @
50970cd7
...
...
@@ -646,4 +646,67 @@ void main() {
expect
(
paddingRect
.
left
,
radioRect
.
left
-
8
);
//left padding
expect
(
paddingRect
.
right
,
titleRect
.
right
+
15
);
//right padding
});
testWidgets
(
'RadioListTile respects shape'
,
(
WidgetTester
tester
)
async
{
const
ShapeBorder
shapeBorder
=
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
horizontal
(
right:
Radius
.
circular
(
100
)),
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
RadioListTile
<
bool
>(
value:
true
,
groupValue:
true
,
onChanged:
null
,
title:
Text
(
'Title'
),
shape:
shapeBorder
,
),
),
));
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
});
testWidgets
(
'RadioListTile respects tileColor'
,
(
WidgetTester
tester
)
async
{
const
Color
tileColor
=
Colors
.
red
;
await
tester
.
pumpWidget
(
wrap
(
child:
const
Center
(
child:
RadioListTile
<
bool
>(
value:
false
,
groupValue:
true
,
onChanged:
null
,
title:
Text
(
'Title'
),
tileColor:
tileColor
,
),
),
),
);
final
ColoredBox
coloredBox
=
tester
.
firstWidget
(
find
.
byType
(
ColoredBox
));
expect
(
coloredBox
.
color
,
tileColor
);
});
testWidgets
(
'RadioListTile respects selectedTileColor'
,
(
WidgetTester
tester
)
async
{
const
Color
selectedTileColor
=
Colors
.
black
;
await
tester
.
pumpWidget
(
wrap
(
child:
const
Center
(
child:
RadioListTile
<
bool
>(
value:
false
,
groupValue:
true
,
onChanged:
null
,
title:
Text
(
'Title'
),
selected:
true
,
selectedTileColor:
selectedTileColor
,
),
),
),
);
final
ColoredBox
coloredBox
=
tester
.
firstWidget
(
find
.
byType
(
ColoredBox
));
expect
(
coloredBox
.
color
,
equals
(
selectedTileColor
));
});
}
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