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
f873252c
Unverified
Commit
f873252c
authored
Mar 06, 2023
by
J-P Nurmi
Committed by
GitHub
Mar 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing properties to `ListTileTheme.merge` (#121975)
Add missing properties to `ListTileTheme.merge`
parent
acc840e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
list_tile_theme.dart
packages/flutter/lib/src/material/list_tile_theme.dart
+10
-0
list_tile_theme_test.dart
packages/flutter/test/material/list_tile_theme_test.dart
+82
-0
No files found.
packages/flutter/lib/src/material/list_tile_theme.dart
View file @
f873252c
...
...
@@ -480,6 +480,9 @@ class ListTileTheme extends InheritedTheme {
Color
?
selectedColor
,
Color
?
iconColor
,
Color
?
textColor
,
TextStyle
?
titleTextStyle
,
TextStyle
?
subtitleTextStyle
,
TextStyle
?
leadingAndTrailingTextStyle
,
EdgeInsetsGeometry
?
contentPadding
,
Color
?
tileColor
,
Color
?
selectedTileColor
,
...
...
@@ -488,6 +491,8 @@ class ListTileTheme extends InheritedTheme {
double
?
minVerticalPadding
,
double
?
minLeadingWidth
,
ListTileTitleAlignment
?
titleAlignment
,
MaterialStateProperty
<
MouseCursor
?>?
mouseCursor
,
VisualDensity
?
visualDensity
,
required
Widget
child
,
})
{
return
Builder
(
...
...
@@ -502,6 +507,9 @@ class ListTileTheme extends InheritedTheme {
selectedColor:
selectedColor
??
parent
.
selectedColor
,
iconColor:
iconColor
??
parent
.
iconColor
,
textColor:
textColor
??
parent
.
textColor
,
titleTextStyle:
titleTextStyle
??
parent
.
titleTextStyle
,
subtitleTextStyle:
subtitleTextStyle
??
parent
.
subtitleTextStyle
,
leadingAndTrailingTextStyle:
leadingAndTrailingTextStyle
??
parent
.
leadingAndTrailingTextStyle
,
contentPadding:
contentPadding
??
parent
.
contentPadding
,
tileColor:
tileColor
??
parent
.
tileColor
,
selectedTileColor:
selectedTileColor
??
parent
.
selectedTileColor
,
...
...
@@ -510,6 +518,8 @@ class ListTileTheme extends InheritedTheme {
minVerticalPadding:
minVerticalPadding
??
parent
.
minVerticalPadding
,
minLeadingWidth:
minLeadingWidth
??
parent
.
minLeadingWidth
,
titleAlignment:
titleAlignment
??
parent
.
titleAlignment
,
mouseCursor:
mouseCursor
??
parent
.
mouseCursor
,
visualDensity:
visualDensity
??
parent
.
visualDensity
,
),
child:
child
,
);
...
...
packages/flutter/test/material/list_tile_theme_test.dart
View file @
f873252c
...
...
@@ -816,6 +816,88 @@ void main() {
expect
(
leadingOffset
.
dy
-
tileOffset
.
dy
,
8.0
);
expect
(
trailingOffset
.
dy
-
tileOffset
.
dy
,
8.0
);
});
testWidgets
(
'ListTileTheme.merge supports all properties'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
()
{
return
MaterialApp
(
theme:
ThemeData
(
listTileTheme:
const
ListTileThemeData
(
dense:
true
,
shape:
StadiumBorder
(),
style:
ListTileStyle
.
drawer
,
selectedColor:
Color
(
0x00000001
),
iconColor:
Color
(
0x00000002
),
textColor:
Color
(
0x00000003
),
titleTextStyle:
TextStyle
(
color:
Color
(
0x00000004
)),
subtitleTextStyle:
TextStyle
(
color:
Color
(
0x00000005
)),
leadingAndTrailingTextStyle:
TextStyle
(
color:
Color
(
0x00000006
)),
contentPadding:
EdgeInsets
.
all
(
100
),
tileColor:
Color
(
0x00000007
),
selectedTileColor:
Color
(
0x00000008
),
horizontalTitleGap:
200
,
minVerticalPadding:
300
,
minLeadingWidth:
400
,
enableFeedback:
true
,
titleAlignment:
ListTileTitleAlignment
.
bottom
,
mouseCursor:
MaterialStateMouseCursor
.
textable
,
visualDensity:
VisualDensity
.
comfortable
,
),
),
home:
Material
(
child:
Center
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
ListTileTheme
.
merge
(
dense:
false
,
shape:
const
RoundedRectangleBorder
(),
style:
ListTileStyle
.
list
,
selectedColor:
const
Color
(
0x00000009
),
iconColor:
const
Color
(
0x0000000A
),
textColor:
const
Color
(
0x0000000B
),
titleTextStyle:
const
TextStyle
(
color:
Color
(
0x0000000C
)),
subtitleTextStyle:
const
TextStyle
(
color:
Color
(
0x0000000D
)),
leadingAndTrailingTextStyle:
const
TextStyle
(
color:
Color
(
0x0000000E
)),
contentPadding:
const
EdgeInsets
.
all
(
500
),
tileColor:
const
Color
(
0x0000000F
),
selectedTileColor:
const
Color
(
0x00000010
),
horizontalTitleGap:
600
,
minVerticalPadding:
700
,
minLeadingWidth:
800
,
enableFeedback:
false
,
titleAlignment:
ListTileTitleAlignment
.
top
,
mouseCursor:
MaterialStateMouseCursor
.
clickable
,
visualDensity:
VisualDensity
.
compact
,
child:
const
ListTile
(),
);
}
),
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
());
final
ListTileThemeData
theme
=
ListTileTheme
.
of
(
tester
.
element
(
find
.
byType
(
ListTile
)));
expect
(
theme
.
dense
,
false
);
expect
(
theme
.
shape
,
const
RoundedRectangleBorder
());
expect
(
theme
.
style
,
ListTileStyle
.
list
);
expect
(
theme
.
selectedColor
,
const
Color
(
0x00000009
));
expect
(
theme
.
iconColor
,
const
Color
(
0x0000000A
));
expect
(
theme
.
textColor
,
const
Color
(
0x0000000B
));
expect
(
theme
.
titleTextStyle
,
const
TextStyle
(
color:
Color
(
0x0000000C
)));
expect
(
theme
.
subtitleTextStyle
,
const
TextStyle
(
color:
Color
(
0x0000000D
)));
expect
(
theme
.
leadingAndTrailingTextStyle
,
const
TextStyle
(
color:
Color
(
0x0000000E
)));
expect
(
theme
.
contentPadding
,
const
EdgeInsets
.
all
(
500
));
expect
(
theme
.
tileColor
,
const
Color
(
0x0000000F
));
expect
(
theme
.
selectedTileColor
,
const
Color
(
0x00000010
));
expect
(
theme
.
horizontalTitleGap
,
600
);
expect
(
theme
.
minVerticalPadding
,
700
);
expect
(
theme
.
minLeadingWidth
,
800
);
expect
(
theme
.
enableFeedback
,
false
);
expect
(
theme
.
titleAlignment
,
ListTileTitleAlignment
.
top
);
expect
(
theme
.
mouseCursor
,
MaterialStateMouseCursor
.
clickable
);
expect
(
theme
.
visualDensity
,
VisualDensity
.
compact
);
});
}
RenderParagraph
_getTextRenderObject
(
WidgetTester
tester
,
String
text
)
{
...
...
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