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
acab6dcc
Unverified
Commit
acab6dcc
authored
Oct 14, 2021
by
Hans Muller
Committed by
GitHub
Oct 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland Refactored ListTileTheme: ListTileThemeData, ThemeData.listThemeData (#91840)
parent
ee2c72e8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
697 additions
and
234 deletions
+697
-234
about.dart
packages/flutter/lib/src/material/about.dart
+1
-1
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+2
-2
expansion_tile.dart
packages/flutter/lib/src/material/expansion_tile.dart
+5
-5
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+520
-206
radio_list_tile.dart
packages/flutter/lib/src/material/radio_list_tile.dart
+1
-1
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+2
-2
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+15
-0
list_tile_test.dart
packages/flutter/test/material/list_tile_test.dart
+147
-17
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+4
-0
No files found.
packages/flutter/lib/src/material/about.dart
View file @
acab6dcc
...
@@ -125,7 +125,7 @@ class AboutListTile extends StatelessWidget {
...
@@ -125,7 +125,7 @@ class AboutListTile extends StatelessWidget {
/// Whether this list tile is part of a vertically dense list.
/// Whether this list tile is part of a vertically dense list.
///
///
/// If this property is null, then its value is based on [ListTileTheme.dense].
/// If this property is null, then its value is based on [ListTileTheme
Data
.dense].
///
///
/// Dense list tiles default to a smaller height.
/// Dense list tiles default to a smaller height.
final
bool
?
dense
;
final
bool
?
dense
;
...
...
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
acab6dcc
...
@@ -214,7 +214,7 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -214,7 +214,7 @@ class CheckboxListTile extends StatelessWidget {
/// Whether this list tile is part of a vertically dense list.
/// Whether this list tile is part of a vertically dense list.
///
///
/// If this property is null then its value is based on [ListTileTheme.dense].
/// If this property is null then its value is based on [ListTileTheme
Data
.dense].
final
bool
?
dense
;
final
bool
?
dense
;
/// Whether to render icons and text in the [activeColor].
/// Whether to render icons and text in the [activeColor].
...
@@ -252,7 +252,7 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -252,7 +252,7 @@ class CheckboxListTile extends StatelessWidget {
/// If tristate is false (the default), [value] must not be null.
/// If tristate is false (the default), [value] must not be null.
final
bool
tristate
;
final
bool
tristate
;
/// {@macro flutter.material.ListTile
Theme
.shape}
/// {@macro flutter.material.ListTile.shape}
final
ShapeBorder
?
shape
;
final
ShapeBorder
?
shape
;
/// If non-null, defines the background color when [CheckboxListTile.selected] is true.
/// If non-null, defines the background color when [CheckboxListTile.selected] is true.
...
...
packages/flutter/lib/src/material/expansion_tile.dart
View file @
acab6dcc
...
@@ -21,7 +21,7 @@ const Duration _kExpand = Duration(milliseconds: 200);
...
@@ -21,7 +21,7 @@ const Duration _kExpand = Duration(milliseconds: 200);
/// [ExpansionTile] to save and restore its expanded state when it is scrolled
/// [ExpansionTile] to save and restore its expanded state when it is scrolled
/// in and out of view.
/// in and out of view.
///
///
/// This class overrides the [ListTileTheme
.iconColor] and [ListTileTheme
.textColor]
/// This class overrides the [ListTileTheme
Data.iconColor] and [ListTileThemeData
.textColor]
/// theme properties for its [ListTile]. These colors animate between values when
/// theme properties for its [ListTile]. These colors animate between values when
/// the tile is expanded and collapsed: between [iconColor], [collapsedIconColor] and
/// the tile is expanded and collapsed: between [iconColor], [collapsedIconColor] and
/// between [textColor] and [collapsedTextColor].
/// between [textColor] and [collapsedTextColor].
...
@@ -176,23 +176,23 @@ class ExpansionTile extends StatefulWidget {
...
@@ -176,23 +176,23 @@ class ExpansionTile extends StatefulWidget {
/// The icon color of tile's expansion arrow icon when the sublist is expanded.
/// The icon color of tile's expansion arrow icon when the sublist is expanded.
///
///
/// Used to override to the [ListTileTheme.iconColor].
/// Used to override to the [ListTileTheme
Data
.iconColor].
final
Color
?
iconColor
;
final
Color
?
iconColor
;
/// The icon color of tile's expansion arrow icon when the sublist is collapsed.
/// The icon color of tile's expansion arrow icon when the sublist is collapsed.
///
///
/// Used to override to the [ListTileTheme.iconColor].
/// Used to override to the [ListTileTheme
Data
.iconColor].
final
Color
?
collapsedIconColor
;
final
Color
?
collapsedIconColor
;
/// The color of the tile's titles when the sublist is expanded.
/// The color of the tile's titles when the sublist is expanded.
///
///
/// Used to override to the [ListTileTheme.textColor].
/// Used to override to the [ListTileTheme
Data
.textColor].
final
Color
?
textColor
;
final
Color
?
textColor
;
/// The color of the tile's titles when the sublist is collapsed.
/// The color of the tile's titles when the sublist is collapsed.
///
///
/// Used to override to the [ListTileTheme.textColor].
/// Used to override to the [ListTileTheme
Data
.textColor].
final
Color
?
collapsedTextColor
;
final
Color
?
collapsedTextColor
;
/// Typically used to force the expansion arrow icon to the tile's leading or trailing edge.
/// Typically used to force the expansion arrow icon to the tile's leading or trailing edge.
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
acab6dcc
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:ui'
show
lerpDouble
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -30,41 +32,247 @@ enum ListTileStyle {
...
@@ -30,41 +32,247 @@ enum ListTileStyle {
drawer
,
drawer
,
}
}
///
An inherited widget that defines color and style parameters for [ListTile]s
///
Where to place the control in widgets that use [ListTile] to position a
///
in this widget's subtree
.
///
control next to a label
.
///
///
/// Values specified here are used for [ListTile] properties that are not given
/// See also:
/// an explicit non-null value.
///
///
/// The [Drawer] widget specifies a tile theme for its children which sets
/// * [CheckboxListTile], which combines a [ListTile] with a [Checkbox].
/// [style] to [ListTileStyle.drawer].
/// * [RadioListTile], which combines a [ListTile] with a [Radio] button.
class
ListTileTheme
extends
InheritedTheme
{
/// * [SwitchListTile], which combines a [ListTile] with a [Switch].
/// Creates a list tile theme that controls the color and style parameters for
/// * [ExpansionTile], which combines a [ListTile] with a button that expands
/// [ListTile]s.
/// or collapses the tile to reveal or hide the children.
const
ListTileTheme
({
enum
ListTileControlAffinity
{
Key
?
key
,
/// Position the control on the leading edge, and the secondary widget, if
this
.
dense
=
false
,
/// any, on the trailing edge.
leading
,
/// Position the control on the trailing edge, and the secondary widget, if
/// any, on the leading edge.
trailing
,
/// Position the control relative to the text in the fashion that is typical
/// for the current platform, and place the secondary widget on the opposite
/// side.
platform
,
}
/// Used with [ListTileTheme] to define default property values for
/// descendant [ListTile] widgets, as well as classes that build
/// [ListTile]s, like [CheckboxListTile], [RadioListTile], and
/// [SwitchListTile].
///
/// Descendant widgets obtain the current [ListTileThemeData] object
/// using `ListTileTheme.of(context)`. Instances of
/// [ListTileThemeData] can be customized with
/// [ListTileThemeData.copyWith].
///
/// A [ListTileThemeData] is often specified as part of the
/// overall [Theme] with [ThemeData.listTileTheme].
///
/// All [ListTileThemeData] properties are `null` by default.
/// When a theme property is null, the [ListTile] will provide its own
/// default based on the overall [Theme]'s textTheme and
/// colorScheme. See the individual [ListTile] properties for details.
///
/// The [Drawer] widget specifies a list tile theme for its children that
/// defines [style] to be [ListTileStyle.drawer].
///
/// See also:
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
@immutable
class
ListTileThemeData
with
Diagnosticable
{
/// Creates a [ListTileThemeData].
const
ListTileThemeData
({
this
.
dense
,
this
.
shape
,
this
.
shape
,
this
.
style
=
ListTileStyle
.
list
,
this
.
style
,
this
.
selectedColor
,
this
.
selectedColor
,
this
.
iconColor
,
this
.
iconColor
,
this
.
textColor
,
this
.
textColor
,
this
.
contentPadding
,
this
.
contentPadding
,
this
.
tileColor
,
this
.
tileColor
,
this
.
selectedTileColor
,
this
.
selectedTileColor
,
this
.
enableFeedback
,
this
.
horizontalTitleGap
,
this
.
horizontalTitleGap
,
this
.
minVerticalPadding
,
this
.
minVerticalPadding
,
this
.
minLeadingWidth
,
this
.
minLeadingWidth
,
required
Widget
child
,
this
.
enableFeedback
,
})
:
super
(
key:
key
,
child:
child
)
;
});
/// Creates a list tile theme that controls the color and style parameters for
/// Overrides the default value of [ListTile.dense].
/// [ListTile]s, and merges in the current list tile theme, if any.
final
bool
?
dense
;
/// Overrides the default value of [ListTile.shape].
final
ShapeBorder
?
shape
;
/// Overrides the default value of [ListTile.style].
final
ListTileStyle
?
style
;
/// Overrides the default value of [ListTile.selectedColor].
final
Color
?
selectedColor
;
/// Overrides the default value of [ListTile.iconColor].
final
Color
?
iconColor
;
/// Overrides the default value of [ListTile.textColor].
final
Color
?
textColor
;
/// Overrides the default value of [ListTile.contentPadding].
final
EdgeInsetsGeometry
?
contentPadding
;
/// Overrides the default value of [ListTile.tileColor].
final
Color
?
tileColor
;
/// Overrides the default value of [ListTile.selectedTileColor].
final
Color
?
selectedTileColor
;
/// Overrides the default value of [ListTile.horizontalTitleGap].
final
double
?
horizontalTitleGap
;
/// Overrides the default value of [ListTile.minVerticalPadding].
final
double
?
minVerticalPadding
;
/// Overrides the default value of [ListTile.minLeadingWidth].
final
double
?
minLeadingWidth
;
/// Overrides the default value of [ListTile.enableFeedback].
final
bool
?
enableFeedback
;
/// Creates a copy of this object with the given fields replaced with the
/// new values.
ListTileThemeData
copyWith
({
bool
?
dense
,
ShapeBorder
?
shape
,
ListTileStyle
?
style
,
Color
?
selectedColor
,
Color
?
iconColor
,
Color
?
textColor
,
EdgeInsetsGeometry
?
contentPadding
,
Color
?
tileColor
,
Color
?
selectedTileColor
,
double
?
horizontalTitleGap
,
double
?
minVerticalPadding
,
double
?
minLeadingWidth
,
bool
?
enableFeedback
,
})
{
return
ListTileThemeData
(
dense:
dense
??
this
.
dense
,
shape:
shape
??
this
.
shape
,
style:
style
??
this
.
style
,
selectedColor:
selectedColor
??
this
.
selectedColor
,
iconColor:
iconColor
??
this
.
iconColor
,
textColor:
textColor
??
this
.
textColor
,
contentPadding:
contentPadding
??
this
.
contentPadding
,
tileColor:
tileColor
??
this
.
tileColor
,
selectedTileColor:
selectedTileColor
??
this
.
selectedTileColor
,
horizontalTitleGap:
horizontalTitleGap
??
this
.
horizontalTitleGap
,
minVerticalPadding:
minVerticalPadding
??
this
.
minVerticalPadding
,
minLeadingWidth:
minLeadingWidth
??
this
.
minLeadingWidth
,
enableFeedback:
enableFeedback
??
this
.
enableFeedback
,
);
}
/// Linearly interpolate between ListTileThemeData objects.
static
ListTileThemeData
?
lerp
(
ListTileThemeData
?
a
,
ListTileThemeData
?
b
,
double
t
)
{
assert
(
t
!=
null
);
if
(
a
==
null
&&
b
==
null
)
return
null
;
return
ListTileThemeData
(
dense:
t
<
0.5
?
a
?.
dense
:
b
?.
dense
,
shape:
ShapeBorder
.
lerp
(
a
?.
shape
,
b
?.
shape
,
t
),
style:
t
<
0.5
?
a
?.
style
:
b
?.
style
,
selectedColor:
Color
.
lerp
(
a
?.
selectedColor
,
b
?.
selectedColor
,
t
),
iconColor:
Color
.
lerp
(
a
?.
iconColor
,
b
?.
iconColor
,
t
),
textColor:
Color
.
lerp
(
a
?.
textColor
,
b
?.
textColor
,
t
),
contentPadding:
EdgeInsetsGeometry
.
lerp
(
a
?.
contentPadding
,
b
?.
contentPadding
,
t
),
tileColor:
Color
.
lerp
(
a
?.
tileColor
,
b
?.
tileColor
,
t
),
selectedTileColor:
Color
.
lerp
(
a
?.
selectedTileColor
,
b
?.
selectedTileColor
,
t
),
horizontalTitleGap:
lerpDouble
(
a
?.
horizontalTitleGap
,
b
?.
horizontalTitleGap
,
t
),
minVerticalPadding:
lerpDouble
(
a
?.
minVerticalPadding
,
b
?.
minVerticalPadding
,
t
),
minLeadingWidth:
lerpDouble
(
a
?.
minLeadingWidth
,
b
?.
minLeadingWidth
,
t
),
enableFeedback:
t
<
0.5
?
a
?.
enableFeedback
:
b
?.
enableFeedback
,
);
}
@override
int
get
hashCode
{
return
hashValues
(
dense
,
shape
,
style
,
selectedColor
,
iconColor
,
textColor
,
contentPadding
,
tileColor
,
selectedTileColor
,
horizontalTitleGap
,
minVerticalPadding
,
minLeadingWidth
,
enableFeedback
,
);
}
@override
bool
operator
==(
Object
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
return
other
is
ListTileThemeData
&&
other
.
dense
==
dense
&&
other
.
shape
==
shape
&&
other
.
style
==
style
&&
other
.
selectedColor
==
selectedColor
&&
other
.
iconColor
==
iconColor
&&
other
.
textColor
==
textColor
&&
other
.
contentPadding
==
contentPadding
&&
other
.
tileColor
==
tileColor
&&
other
.
selectedTileColor
==
selectedTileColor
&&
other
.
horizontalTitleGap
==
horizontalTitleGap
&&
other
.
minVerticalPadding
==
minVerticalPadding
&&
other
.
minLeadingWidth
==
minLeadingWidth
&&
other
.
enableFeedback
==
enableFeedback
;
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'dense'
,
dense
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ShapeBorder
>(
'shape'
,
shape
,
defaultValue:
null
));
properties
.
add
(
EnumProperty
<
ListTileStyle
>(
'style'
,
style
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'selectedColor'
,
selectedColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'iconColor'
,
iconColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'textColor'
,
textColor
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
EdgeInsetsGeometry
>(
'contentPadding'
,
contentPadding
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'tileColor'
,
tileColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'selectedTileColor'
,
selectedTileColor
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'horizontalTitleGap'
,
horizontalTitleGap
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'minVerticalPadding'
,
minVerticalPadding
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'minLeadingWidth'
,
minLeadingWidth
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'enableFeedback'
,
enableFeedback
,
defaultValue:
null
));
}
}
/// An inherited widget that defines color and style parameters for [ListTile]s
/// in this widget's subtree.
///
/// Values specified here are used for [ListTile] properties that are not given
/// an explicit non-null value.
///
/// The [Drawer] widget specifies a tile theme for its children which sets
/// [style] to [ListTileStyle.drawer].
class
ListTileTheme
extends
InheritedTheme
{
/// Creates a list tile theme that defines the color and style parameters for
/// descendant [ListTile]s.
///
///
/// The [child] argument must not be null.
/// Only the [data] parameter should be used. The other parameters are
static
Widget
merge
({
/// redundant (are now obsolete) and will be deprecated in a future update.
const
ListTileTheme
({
Key
?
key
,
Key
?
key
,
ListTileThemeData
?
data
,
bool
?
dense
,
bool
?
dense
,
ShapeBorder
?
shape
,
ShapeBorder
?
shape
,
ListTileStyle
?
style
,
ListTileStyle
?
style
,
...
@@ -79,163 +287,235 @@ class ListTileTheme extends InheritedTheme {
...
@@ -79,163 +287,235 @@ class ListTileTheme extends InheritedTheme {
double
?
minVerticalPadding
,
double
?
minVerticalPadding
,
double
?
minLeadingWidth
,
double
?
minLeadingWidth
,
required
Widget
child
,
required
Widget
child
,
})
{
})
:
assert
(
assert
(
child
!=
null
);
data
==
null
||
return
Builder
(
(
shape
??
builder:
(
BuildContext
context
)
{
selectedColor
??
final
ListTileTheme
parent
=
ListTileTheme
.
of
(
context
);
iconColor
??
return
ListTileTheme
(
textColor
??
key:
key
,
contentPadding
??
dense:
dense
??
parent
.
dense
,
tileColor
??
shape:
shape
??
parent
.
shape
,
selectedTileColor
??
style:
style
??
parent
.
style
,
enableFeedback
??
selectedColor:
selectedColor
??
parent
.
selectedColor
,
horizontalTitleGap
??
iconColor:
iconColor
??
parent
.
iconColor
,
minVerticalPadding
??
textColor:
textColor
??
parent
.
textColor
,
minLeadingWidth
)
==
null
),
contentPadding:
contentPadding
??
parent
.
contentPadding
,
_data
=
data
,
tileColor:
tileColor
??
parent
.
tileColor
,
_dense
=
dense
,
selectedTileColor:
selectedTileColor
??
parent
.
selectedTileColor
,
_shape
=
shape
,
enableFeedback:
enableFeedback
??
parent
.
enableFeedback
,
_style
=
style
,
horizontalTitleGap:
horizontalTitleGap
??
parent
.
horizontalTitleGap
,
_selectedColor
=
selectedColor
,
minVerticalPadding:
minVerticalPadding
??
parent
.
minVerticalPadding
,
_iconColor
=
iconColor
,
minLeadingWidth:
minLeadingWidth
??
parent
.
minLeadingWidth
,
_textColor
=
textColor
,
child:
child
,
_contentPadding
=
contentPadding
,
);
_tileColor
=
tileColor
,
},
_selectedTileColor
=
selectedTileColor
,
_enableFeedback
=
enableFeedback
,
_horizontalTitleGap
=
horizontalTitleGap
,
_minVerticalPadding
=
minVerticalPadding
,
_minLeadingWidth
=
minLeadingWidth
,
super
(
key:
key
,
child:
child
);
final
ListTileThemeData
?
_data
;
final
bool
?
_dense
;
final
ShapeBorder
?
_shape
;
final
ListTileStyle
?
_style
;
final
Color
?
_selectedColor
;
final
Color
?
_iconColor
;
final
Color
?
_textColor
;
final
EdgeInsetsGeometry
?
_contentPadding
;
final
Color
?
_tileColor
;
final
Color
?
_selectedTileColor
;
final
double
?
_horizontalTitleGap
;
final
double
?
_minVerticalPadding
;
final
double
?
_minLeadingWidth
;
final
bool
?
_enableFeedback
;
/// The configuration of this theme.
ListTileThemeData
get
data
{
return
_data
??
ListTileThemeData
(
dense:
_dense
,
shape:
_shape
,
style:
_style
,
selectedColor:
_selectedColor
,
iconColor:
_iconColor
,
textColor:
_textColor
,
contentPadding:
_contentPadding
,
tileColor:
_tileColor
,
selectedTileColor:
_selectedTileColor
,
enableFeedback:
_enableFeedback
,
horizontalTitleGap:
_horizontalTitleGap
,
minVerticalPadding:
_minVerticalPadding
,
minLeadingWidth:
_minLeadingWidth
,
);
);
}
}
/// If true then [ListTile]s will have the vertically dense layout.
/// Overrides the default value of [ListTile.dense].
final
bool
dense
;
///
/// This property is obsolete: please use the [data]
/// [ListTileThemeData.dense] property instead.
bool
?
get
dense
=>
_data
!=
null
?
_data
!.
dense
:
_dense
;
/// {@template flutter.material.ListTileTheme.shape}
/// Overrides the default value of [ListTile.shape].
/// If specified, [shape] defines the [ListTile]'s shape.
///
/// {@endtemplate}
/// This property is obsolete: please use the [data]
final
ShapeBorder
?
shape
;
/// [ListTileThemeData.shape] property instead.
ShapeBorder
?
get
shape
=>
_data
!=
null
?
_data
!.
shape
:
_shape
;
/// If specified, [style] defines the font used for [ListTile] titles.
/// Overrides the default value of [ListTile.style].
final
ListTileStyle
style
;
///
/// This property is obsolete: please use the [data]
/// [ListTileThemeData.style] property instead.
ListTileStyle
?
get
style
=>
_data
!=
null
?
_data
!.
style
:
_style
;
/// If specified, the color used for icons and text when a [ListTile] is selected.
/// Overrides the default value of [ListTile.selectedColor].
final
Color
?
selectedColor
;
///
/// This property is obsolete: please use the [data]
/// [ListTileThemeData.selectedColor] property instead.
Color
?
get
selectedColor
=>
_data
!=
null
?
_data
!.
selectedColor
:
_selectedColor
;
/// If specified, the icon color used for enabled [ListTile]s that are not selected.
/// Overrides the default value of [ListTile.iconColor].
final
Color
?
iconColor
;
///
/// This property is obsolete: please use the [data]
/// [ListTileThemeData.iconColor] property instead.
Color
?
get
iconColor
=>
_data
!=
null
?
_data
!.
iconColor
:
_iconColor
;
/// If specified, the text color used for enabled [ListTile]s that are not selected.
/// Overrides the default value of [ListTile.textColor].
final
Color
?
textColor
;
///
/// This property is obsolete: please use the [data]
/// [ListTileThemeData.textColor] property instead.
Color
?
get
textColor
=>
_data
!=
null
?
_data
!.
textColor
:
_textColor
;
///
The tile's internal padding
.
///
Overrides the default value of [ListTile.contentPadding]
.
///
///
///
Insets a [ListTile]'s contents: its [ListTile.leading], [ListTile.title],
///
This property is obsolete: please use the [data]
/// [ListTile
.subtitle], and [ListTile.trailing] widgets
.
/// [ListTile
ThemeData.contentPadding] property instead
.
final
EdgeInsetsGeometry
?
contentPadding
;
EdgeInsetsGeometry
?
get
contentPadding
=>
_data
!=
null
?
_data
!.
contentPadding
:
_
contentPadding
;
/// If specified, defines the background color for `ListTile` when
/// Overrides the default value of [ListTile.tileColor].
/// [ListTile.selected] is false.
///
///
/// If [ListTile.tileColor] is provided, [tileColor] is ignored.
/// This property is obsolete: please use the [data]
final
Color
?
tileColor
;
/// [ListTileThemeData.tileColor] property instead.
Color
?
get
tileColor
=>
_data
!=
null
?
_data
!.
tileColor
:
_tileColor
;
/// If specified, defines the background color for `ListTile` when
/// Overrides the default value of [ListTile.selectedTileColor].
/// [ListTile.selected] is true.
///
///
/// If [ListTile.selectedTileColor] is provided, [selectedTileColor] is ignored.
/// This property is obsolete: please use the [data]
final
Color
?
selectedTileColor
;
/// [ListTileThemeData.selectedTileColor] property instead.
Color
?
get
selectedTileColor
=>
_data
!=
null
?
_data
!.
selectedTileColor
:
_selectedTileColor
;
///
The horizontal gap between the titles and the leading/trailing widgets
.
///
Overrides the default value of [ListTile.horizontalTitleGap]
.
///
///
/// If specified, overrides the default value of [ListTile.horizontalTitleGap].
/// This property is obsolete: please use the [data]
final
double
?
horizontalTitleGap
;
/// [ListTileThemeData.horizontalTitleGap] property instead.
double
?
get
horizontalTitleGap
=>
_data
!=
null
?
_data
!.
horizontalTitleGap
:
_horizontalTitleGap
;
///
The minimum padding on the top and bottom of the title and subtitle widgets
.
///
Overrides the default value of [ListTile.minVerticalPadding]
.
///
///
/// If specified, overrides the default value of [ListTile.minVerticalPadding].
/// This property is obsolete: please use the [data]
final
double
?
minVerticalPadding
;
/// [ListTileThemeData.minVerticalPadding] property instead.
double
?
get
minVerticalPadding
=>
_data
!=
null
?
_data
!.
minVerticalPadding
:
_minVerticalPadding
;
///
The minimum width allocated for the [ListTile.leading] widget
.
///
Overrides the default value of [ListTile.minLeadingWidth]
.
///
///
/// If specified, overrides the default value of [ListTile.minLeadingWidth].
/// This property is obsolete: please use the [data]
final
double
?
minLeadingWidth
;
/// [ListTileThemeData.minLeadingWidth] property instead.
double
?
get
minLeadingWidth
=>
_data
!=
null
?
_data
!.
minLeadingWidth
:
_minLeadingWidth
;
///
If specified, defines the feedback property for `ListTile`
.
///
Overrides the default value of [ListTile.enableFeedback]
.
///
///
/// If [ListTile.enableFeedback] is provided, [enableFeedback] is ignored.
/// This property is obsolete: please use the [data]
final
bool
?
enableFeedback
;
/// [ListTileThemeData.enableFeedback] property instead.
bool
?
get
enableFeedback
=>
_data
!=
null
?
_data
!.
enableFeedback
:
_enableFeedback
;
/// The closest instance of this class that encloses the given context.
/// The [data] property of the closest instance of this class that
/// encloses the given context.
///
/// If there is no enclosing [ListTileTheme] widget, then
/// [ThemeData.listTileTheme] is used (see [Theme.of]).
///
///
/// Typical usage is as follows:
/// Typical usage is as follows:
///
///
/// ```dart
/// ```dart
/// ListTileTheme theme = ListTileTheme.of(context);
/// ListTileTheme
Data
theme = ListTileTheme.of(context);
/// ```
/// ```
static
ListTileTheme
of
(
BuildContext
context
)
{
static
ListTileTheme
Data
of
(
BuildContext
context
)
{
final
ListTileTheme
?
result
=
context
.
dependOnInheritedWidgetOfExactType
<
ListTileTheme
>();
final
ListTileTheme
?
result
=
context
.
dependOnInheritedWidgetOfExactType
<
ListTileTheme
>();
return
result
??
const
ListTileTheme
(
child:
SizedBox
());
return
result
?.
data
??
Theme
.
of
(
context
).
listTileTheme
;
}
/// Creates a list tile theme that controls the color and style parameters for
/// [ListTile]s, and merges in the current list tile theme, if any.
///
/// The [child] argument must not be null.
static
Widget
merge
({
Key
?
key
,
bool
?
dense
,
ShapeBorder
?
shape
,
ListTileStyle
?
style
,
Color
?
selectedColor
,
Color
?
iconColor
,
Color
?
textColor
,
EdgeInsetsGeometry
?
contentPadding
,
Color
?
tileColor
,
Color
?
selectedTileColor
,
bool
?
enableFeedback
,
double
?
horizontalTitleGap
,
double
?
minVerticalPadding
,
double
?
minLeadingWidth
,
required
Widget
child
,
})
{
assert
(
child
!=
null
);
return
Builder
(
builder:
(
BuildContext
context
)
{
final
ListTileThemeData
parent
=
ListTileTheme
.
of
(
context
);
return
ListTileTheme
(
key:
key
,
data:
ListTileThemeData
(
dense:
dense
??
parent
.
dense
,
shape:
shape
??
parent
.
shape
,
style:
style
??
parent
.
style
,
selectedColor:
selectedColor
??
parent
.
selectedColor
,
iconColor:
iconColor
??
parent
.
iconColor
,
textColor:
textColor
??
parent
.
textColor
,
contentPadding:
contentPadding
??
parent
.
contentPadding
,
tileColor:
tileColor
??
parent
.
tileColor
,
selectedTileColor:
selectedTileColor
??
parent
.
selectedTileColor
,
enableFeedback:
enableFeedback
??
parent
.
enableFeedback
,
horizontalTitleGap:
horizontalTitleGap
??
parent
.
horizontalTitleGap
,
minVerticalPadding:
minVerticalPadding
??
parent
.
minVerticalPadding
,
minLeadingWidth:
minLeadingWidth
??
parent
.
minLeadingWidth
,
),
child:
child
,
);
},
);
}
}
@override
@override
Widget
wrap
(
BuildContext
context
,
Widget
child
)
{
Widget
wrap
(
BuildContext
context
,
Widget
child
)
{
return
ListTileTheme
(
return
ListTileTheme
(
dense:
dense
,
data:
ListTileThemeData
(
shape:
shape
,
dense:
dense
,
style:
style
,
shape:
shape
,
selectedColor:
selectedColor
,
style:
style
,
iconColor:
iconColor
,
selectedColor:
selectedColor
,
textColor:
textColor
,
iconColor:
iconColor
,
contentPadding:
contentPadding
,
textColor:
textColor
,
tileColor:
tileColor
,
contentPadding:
contentPadding
,
selectedTileColor:
selectedTileColor
,
tileColor:
tileColor
,
enableFeedback:
enableFeedback
,
selectedTileColor:
selectedTileColor
,
horizontalTitleGap:
horizontalTitleGap
,
enableFeedback:
enableFeedback
,
minVerticalPadding:
minVerticalPadding
,
horizontalTitleGap:
horizontalTitleGap
,
minLeadingWidth:
minLeadingWidth
,
minVerticalPadding:
minVerticalPadding
,
minLeadingWidth:
minLeadingWidth
,
),
child:
child
,
child:
child
,
);
);
}
}
@override
@override
bool
updateShouldNotify
(
ListTileTheme
oldWidget
)
{
bool
updateShouldNotify
(
ListTileTheme
oldWidget
)
=>
data
!=
oldWidget
.
data
;
return
dense
!=
oldWidget
.
dense
||
shape
!=
oldWidget
.
shape
||
style
!=
oldWidget
.
style
||
selectedColor
!=
oldWidget
.
selectedColor
||
iconColor
!=
oldWidget
.
iconColor
||
textColor
!=
oldWidget
.
textColor
||
contentPadding
!=
oldWidget
.
contentPadding
||
tileColor
!=
oldWidget
.
tileColor
||
selectedTileColor
!=
oldWidget
.
selectedTileColor
||
enableFeedback
!=
oldWidget
.
enableFeedback
||
horizontalTitleGap
!=
oldWidget
.
horizontalTitleGap
||
minVerticalPadding
!=
oldWidget
.
minVerticalPadding
||
minLeadingWidth
!=
oldWidget
.
minLeadingWidth
;
}
}
/// Where to place the control in widgets that use [ListTile] to position a
/// control next to a label.
///
/// See also:
///
/// * [CheckboxListTile], which combines a [ListTile] with a [Checkbox].
/// * [RadioListTile], which combines a [ListTile] with a [Radio] button.
/// * [SwitchListTile], which combines a [ListTile] with a [Switch].
/// * [ExpansionTile], which combines a [ListTile] with a button that expands
/// or collapses the tile to reveal or hide the children.
enum
ListTileControlAffinity
{
/// Position the control on the leading edge, and the secondary widget, if
/// any, on the trailing edge.
leading
,
/// Position the control on the trailing edge, and the secondary widget, if
/// any, on the leading edge.
trailing
,
/// Position the control relative to the text in the fashion that is typical
/// for the current platform, and place the secondary widget on the opposite
/// side.
platform
,
}
}
/// A single fixed-height row that typically contains some text as well as
/// A single fixed-height row that typically contains some text as well as
...
@@ -489,6 +769,10 @@ class ListTile extends StatelessWidget {
...
@@ -489,6 +769,10 @@ class ListTile extends StatelessWidget {
this
.
dense
,
this
.
dense
,
this
.
visualDensity
,
this
.
visualDensity
,
this
.
shape
,
this
.
shape
,
this
.
style
,
this
.
selectedColor
,
this
.
iconColor
,
this
.
textColor
,
this
.
contentPadding
,
this
.
contentPadding
,
this
.
enabled
=
true
,
this
.
enabled
=
true
,
this
.
onTap
,
this
.
onTap
,
...
@@ -586,14 +870,62 @@ class ListTile extends StatelessWidget {
...
@@ -586,14 +870,62 @@ class ListTile extends StatelessWidget {
/// widgets within a [Theme].
/// widgets within a [Theme].
final
VisualDensity
?
visualDensity
;
final
VisualDensity
?
visualDensity
;
/// The tile's shape.
/// {@template flutter.material.ListTile.shape}
///
/// Defines the tile's [InkWell.customBorder] and [Ink.decoration] shape.
/// Defines the tile's [InkWell.customBorder] and [Ink.decoration] shape.
/// {@endtemplate}
///
/// If this property is null then [ListTileThemeData.shape] is used. If that
/// is also null then a rectangular [Border] will be used.
///
///
/// If this property is null then [ListTileTheme.shape] is used.
/// See also:
/// If that's null then a rectangular [Border] will be used.
///
/// * [ListTileTheme.of], which returns the nearest [ListTileTheme]'s
/// [ListTileThemeData].
final
ShapeBorder
?
shape
;
final
ShapeBorder
?
shape
;
/// Defines the color used for icons and text when the list tile is selected.
///
/// If this property is null then [ListTileThemeData.selectedColor]
/// is used. If that is also null then [ColorScheme.primary] is used.
///
/// See also:
///
/// * [ListTileTheme.of], which returns the nearest [ListTileTheme]'s
/// [ListTileThemeData].
final
Color
?
selectedColor
;
/// Defines the default color for [leading] and [trailing] icons.
///
/// If this property is null then [ListTileThemeData.iconColor] is used.
///
/// See also:
///
/// * [ListTileTheme.of], which returns the nearest [ListTileTheme]'s
/// [ListTileThemeData].
final
Color
?
iconColor
;
/// Defines the default color for the [title] and [subtitle].
///
/// If this property is null then [ListTileThemeData.textColor] is used. If that
/// is also null then [ColorScheme.primary] is used.
///
/// See also:
///
/// * [ListTileTheme.of], which returns the nearest [ListTileTheme]'s
/// [ListTileThemeData].
final
Color
?
textColor
;
/// Defines the font used for the [title].
///
/// If this property is null then [ListTileThemeData.style] is used. If that
/// is also null then [ListTileStyle.list] is used.
///
/// See also:
///
/// * [ListTileTheme.of], which returns the nearest [ListTileTheme]'s
/// [ListTileThemeData].
final
ListTileStyle
?
style
;
/// The tile's internal padding.
/// The tile's internal padding.
///
///
/// Insets a [ListTile]'s contents: its [leading], [title], [subtitle],
/// Insets a [ListTile]'s contents: its [leading], [title], [subtitle],
...
@@ -738,103 +1070,85 @@ class ListTile extends StatelessWidget {
...
@@ -738,103 +1070,85 @@ class ListTile extends StatelessWidget {
yield
tile
;
yield
tile
;
}
}
Color
?
_iconColor
(
ThemeData
theme
,
ListTileTheme
?
tileTheme
)
{
Color
?
_iconColor
(
ThemeData
theme
,
ListTileTheme
Data
tileTheme
)
{
if
(!
enabled
)
if
(!
enabled
)
return
theme
.
disabledColor
;
return
theme
.
disabledColor
;
if
(
selected
&&
tileTheme
?.
selectedColor
!=
null
)
if
(
selected
)
{
return
tileTheme
!.
selectedColor
;
return
selectedColor
??
tileTheme
.
selectedColor
??
theme
.
listTileTheme
.
selectedColor
??
theme
.
colorScheme
.
primary
;
}
if
(!
selected
&&
tileTheme
?.
iconColor
!=
null
)
final
Color
?
color
=
iconColor
??
tileTheme
.
iconColor
??
theme
.
listTileTheme
.
iconColor
;
return
tileTheme
!.
iconColor
;
if
(
color
!=
null
)
return
color
;
switch
(
theme
.
brightness
)
{
switch
(
theme
.
brightness
)
{
case
Brightness
.
light
:
case
Brightness
.
light
:
// For the sake of backwards compatibility, the default for unselected
// For the sake of backwards compatibility, the default for unselected
// tiles is Colors.black45 rather than colorScheme.onSurface.withAlpha(0x73).
// tiles is Colors.black45 rather than colorScheme.onSurface.withAlpha(0x73).
return
selected
?
theme
.
colorScheme
.
primary
:
Colors
.
black45
;
return
Colors
.
black45
;
case
Brightness
.
dark
:
case
Brightness
.
dark
:
return
selected
?
theme
.
colorScheme
.
primary
:
null
;
// null - use current icon theme color
return
null
;
// null - use current icon theme color
}
}
}
}
Color
?
_textColor
(
ThemeData
theme
,
ListTileTheme
?
tileTheme
,
Color
?
defaultColor
)
{
Color
?
_textColor
(
ThemeData
theme
,
ListTileTheme
Data
tileTheme
,
Color
?
defaultColor
)
{
if
(!
enabled
)
if
(!
enabled
)
return
theme
.
disabledColor
;
return
theme
.
disabledColor
;
if
(
selected
&&
tileTheme
?.
selectedColor
!=
null
)
if
(
selected
)
{
return
tileTheme
!.
selectedColor
;
return
selectedColor
??
tileTheme
.
selectedColor
??
theme
.
listTileTheme
.
selectedColor
??
theme
.
colorScheme
.
primary
;
}
if
(!
selected
&&
tileTheme
?.
textColor
!=
null
)
return
tileTheme
!.
textColor
;
if
(
selected
)
return
theme
.
colorScheme
.
primary
;
return
defaultColor
;
return
textColor
??
tileTheme
.
textColor
??
theme
.
listTileTheme
.
textColor
??
defaultColor
;
}
}
bool
_isDenseLayout
(
ListTileTheme
?
tileTheme
)
{
bool
_isDenseLayout
(
ThemeData
theme
,
ListTileThemeData
tileTheme
)
{
return
dense
??
tileTheme
?
.
dense
??
false
;
return
dense
??
tileTheme
.
dense
??
theme
.
listTileTheme
.
dense
??
false
;
}
}
TextStyle
_titleTextStyle
(
ThemeData
theme
,
ListTileTheme
?
tileTheme
)
{
TextStyle
_titleTextStyle
(
ThemeData
theme
,
ListTileThemeData
tileTheme
)
{
final
TextStyle
style
;
final
TextStyle
textStyle
;
if
(
tileTheme
!=
null
)
{
switch
(
style
??
tileTheme
.
style
??
theme
.
listTileTheme
.
style
??
ListTileStyle
.
list
)
{
switch
(
tileTheme
.
style
)
{
case
ListTileStyle
.
drawer
:
case
ListTileStyle
.
drawer
:
textStyle
=
theme
.
textTheme
.
bodyText1
!;
style
=
theme
.
textTheme
.
bodyText1
!;
break
;
break
;
case
ListTileStyle
.
list
:
case
ListTileStyle
.
list
:
textStyle
=
theme
.
textTheme
.
subtitle1
!;
style
=
theme
.
textTheme
.
subtitle1
!;
break
;
break
;
}
}
else
{
style
=
theme
.
textTheme
.
subtitle1
!;
}
}
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
s
tyle
.
color
);
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
textS
tyle
.
color
);
return
_isDenseLayout
(
tileTheme
)
return
_isDenseLayout
(
t
heme
,
t
ileTheme
)
?
s
tyle
.
copyWith
(
fontSize:
13.0
,
color:
color
)
?
textS
tyle
.
copyWith
(
fontSize:
13.0
,
color:
color
)
:
s
tyle
.
copyWith
(
color:
color
);
:
textS
tyle
.
copyWith
(
color:
color
);
}
}
TextStyle
_subtitleTextStyle
(
ThemeData
theme
,
ListTileTheme
?
tileTheme
)
{
TextStyle
_subtitleTextStyle
(
ThemeData
theme
,
ListTileTheme
Data
tileTheme
)
{
final
TextStyle
s
tyle
=
theme
.
textTheme
.
bodyText2
!;
final
TextStyle
textS
tyle
=
theme
.
textTheme
.
bodyText2
!;
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
theme
.
textTheme
.
caption
!.
color
);
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
theme
.
textTheme
.
caption
!.
color
);
return
_isDenseLayout
(
tileTheme
)
return
_isDenseLayout
(
t
heme
,
t
ileTheme
)
?
s
tyle
.
copyWith
(
color:
color
,
fontSize:
12.0
)
?
textS
tyle
.
copyWith
(
color:
color
,
fontSize:
12.0
)
:
s
tyle
.
copyWith
(
color:
color
);
:
textS
tyle
.
copyWith
(
color:
color
);
}
}
TextStyle
_trailingAndLeadingTextStyle
(
ThemeData
theme
,
ListTileTheme
?
tileTheme
)
{
TextStyle
_trailingAndLeadingTextStyle
(
ThemeData
theme
,
ListTileTheme
Data
tileTheme
)
{
final
TextStyle
s
tyle
=
theme
.
textTheme
.
bodyText2
!;
final
TextStyle
textS
tyle
=
theme
.
textTheme
.
bodyText2
!;
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
s
tyle
.
color
);
final
Color
?
color
=
_textColor
(
theme
,
tileTheme
,
textS
tyle
.
color
);
return
s
tyle
.
copyWith
(
color:
color
);
return
textS
tyle
.
copyWith
(
color:
color
);
}
}
Color
_tileBackgroundColor
(
ListTileTheme
?
tileTheme
)
{
Color
_tileBackgroundColor
(
ThemeData
theme
,
ListTileThemeData
tileTheme
)
{
if
(!
selected
)
{
final
Color
?
color
=
selected
if
(
tileColor
!=
null
)
?
selectedTileColor
??
tileTheme
.
selectedTileColor
??
theme
.
listTileTheme
.
selectedTileColor
return
tileColor
!;
:
tileColor
??
tileTheme
.
tileColor
??
theme
.
listTileTheme
.
tileColor
;
if
(
tileTheme
?.
tileColor
!=
null
)
return
color
??
Colors
.
transparent
;
return
tileTheme
!.
tileColor
!;
}
if
(
selected
)
{
if
(
selectedTileColor
!=
null
)
return
selectedTileColor
!;
if
(
tileTheme
?.
selectedTileColor
!=
null
)
return
tileTheme
!.
selectedTileColor
!;
}
return
Colors
.
transparent
;
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
assert
(
debugCheckHasMaterial
(
context
));
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ListTileTheme
tileTheme
=
ListTileTheme
.
of
(
context
);
final
ListTileTheme
Data
tileTheme
=
ListTileTheme
.
of
(
context
);
IconThemeData
?
iconThemeData
;
IconThemeData
?
iconThemeData
;
TextStyle
?
leadingAndTrailingTextStyle
;
TextStyle
?
leadingAndTrailingTextStyle
;
...
@@ -916,7 +1230,7 @@ class ListTile extends StatelessWidget {
...
@@ -916,7 +1230,7 @@ class ListTile extends StatelessWidget {
child:
Ink
(
child:
Ink
(
decoration:
ShapeDecoration
(
decoration:
ShapeDecoration
(
shape:
shape
??
tileTheme
.
shape
??
const
Border
(),
shape:
shape
??
tileTheme
.
shape
??
const
Border
(),
color:
_tileBackgroundColor
(
tileTheme
),
color:
_tileBackgroundColor
(
t
heme
,
t
ileTheme
),
),
),
child:
SafeArea
(
child:
SafeArea
(
top:
false
,
top:
false
,
...
@@ -927,7 +1241,7 @@ class ListTile extends StatelessWidget {
...
@@ -927,7 +1241,7 @@ class ListTile extends StatelessWidget {
title:
titleText
,
title:
titleText
,
subtitle:
subtitleText
,
subtitle:
subtitleText
,
trailing:
trailingIcon
,
trailing:
trailingIcon
,
isDense:
_isDenseLayout
(
tileTheme
),
isDense:
_isDenseLayout
(
t
heme
,
t
ileTheme
),
visualDensity:
visualDensity
??
theme
.
visualDensity
,
visualDensity:
visualDensity
??
theme
.
visualDensity
,
isThreeLine:
isThreeLine
,
isThreeLine:
isThreeLine
,
textDirection:
textDirection
,
textDirection:
textDirection
,
...
...
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
acab6dcc
...
@@ -236,7 +236,7 @@ class RadioListTile<T> extends StatelessWidget {
...
@@ -236,7 +236,7 @@ class RadioListTile<T> extends StatelessWidget {
/// Whether this list tile is part of a vertically dense list.
/// Whether this list tile is part of a vertically dense list.
///
///
/// If this property is null then its value is based on [ListTileTheme.dense].
/// If this property is null then its value is based on [ListTileTheme
Data
.dense].
final
bool
?
dense
;
final
bool
?
dense
;
/// Whether to render icons and text in the [activeColor].
/// Whether to render icons and text in the [activeColor].
...
...
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
acab6dcc
...
@@ -291,7 +291,7 @@ class SwitchListTile extends StatelessWidget {
...
@@ -291,7 +291,7 @@ class SwitchListTile extends StatelessWidget {
/// Whether this list tile is part of a vertically dense list.
/// Whether this list tile is part of a vertically dense list.
///
///
/// If this property is null then its value is based on [ListTileTheme.dense].
/// If this property is null then its value is based on [ListTileTheme
Data
.dense].
final
bool
?
dense
;
final
bool
?
dense
;
/// The tile's internal padding.
/// The tile's internal padding.
...
@@ -323,7 +323,7 @@ class SwitchListTile extends StatelessWidget {
...
@@ -323,7 +323,7 @@ class SwitchListTile extends StatelessWidget {
/// By default, the value of `controlAffinity` is [ListTileControlAffinity.platform].
/// By default, the value of `controlAffinity` is [ListTileControlAffinity.platform].
final
ListTileControlAffinity
controlAffinity
;
final
ListTileControlAffinity
controlAffinity
;
/// {@macro flutter.material.ListTile
Theme
.shape}
/// {@macro flutter.material.ListTile.shape}
final
ShapeBorder
?
shape
;
final
ShapeBorder
?
shape
;
/// If non-null, defines the background color when [SwitchListTile.selected] is true.
/// If non-null, defines the background color when [SwitchListTile.selected] is true.
...
...
packages/flutter/lib/src/material/theme_data.dart
View file @
acab6dcc
...
@@ -28,6 +28,7 @@ import 'floating_action_button_theme.dart';
...
@@ -28,6 +28,7 @@ import 'floating_action_button_theme.dart';
import
'ink_splash.dart'
;
import
'ink_splash.dart'
;
import
'ink_well.dart'
show
InteractiveInkFeatureFactory
;
import
'ink_well.dart'
show
InteractiveInkFeatureFactory
;
import
'input_decorator.dart'
;
import
'input_decorator.dart'
;
import
'list_tile.dart'
;
import
'navigation_bar_theme.dart'
;
import
'navigation_bar_theme.dart'
;
import
'navigation_rail_theme.dart'
;
import
'navigation_rail_theme.dart'
;
import
'outlined_button_theme.dart'
;
import
'outlined_button_theme.dart'
;
...
@@ -340,6 +341,7 @@ class ThemeData with Diagnosticable {
...
@@ -340,6 +341,7 @@ class ThemeData with Diagnosticable {
SwitchThemeData
?
switchTheme
,
SwitchThemeData
?
switchTheme
,
ProgressIndicatorThemeData
?
progressIndicatorTheme
,
ProgressIndicatorThemeData
?
progressIndicatorTheme
,
DrawerThemeData
?
drawerTheme
,
DrawerThemeData
?
drawerTheme
,
ListTileThemeData
?
listTileTheme
,
@Deprecated
(
@Deprecated
(
'This "fix" is now enabled by default. '
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.'
,
'This feature was deprecated after v2.5.0-1.0.pre.'
,
...
@@ -485,6 +487,7 @@ class ThemeData with Diagnosticable {
...
@@ -485,6 +487,7 @@ class ThemeData with Diagnosticable {
switchTheme
??=
const
SwitchThemeData
();
switchTheme
??=
const
SwitchThemeData
();
progressIndicatorTheme
??=
const
ProgressIndicatorThemeData
();
progressIndicatorTheme
??=
const
ProgressIndicatorThemeData
();
drawerTheme
??=
const
DrawerThemeData
();
drawerTheme
??=
const
DrawerThemeData
();
listTileTheme
??=
const
ListTileThemeData
();
fixTextFieldOutlineLabel
??=
true
;
fixTextFieldOutlineLabel
??=
true
;
useTextSelectionTheme
??=
true
;
useTextSelectionTheme
??=
true
;
...
@@ -568,6 +571,7 @@ class ThemeData with Diagnosticable {
...
@@ -568,6 +571,7 @@ class ThemeData with Diagnosticable {
switchTheme:
switchTheme
,
switchTheme:
switchTheme
,
progressIndicatorTheme:
progressIndicatorTheme
,
progressIndicatorTheme:
progressIndicatorTheme
,
drawerTheme:
drawerTheme
,
drawerTheme:
drawerTheme
,
listTileTheme:
listTileTheme
,
fixTextFieldOutlineLabel:
fixTextFieldOutlineLabel
,
fixTextFieldOutlineLabel:
fixTextFieldOutlineLabel
,
useTextSelectionTheme:
useTextSelectionTheme
,
useTextSelectionTheme:
useTextSelectionTheme
,
androidOverscrollIndicator:
androidOverscrollIndicator
,
androidOverscrollIndicator:
androidOverscrollIndicator
,
...
@@ -703,6 +707,7 @@ class ThemeData with Diagnosticable {
...
@@ -703,6 +707,7 @@ class ThemeData with Diagnosticable {
required
this
.
switchTheme
,
required
this
.
switchTheme
,
required
this
.
progressIndicatorTheme
,
required
this
.
progressIndicatorTheme
,
required
this
.
drawerTheme
,
required
this
.
drawerTheme
,
required
this
.
listTileTheme
,
@Deprecated
(
@Deprecated
(
'This "fix" is now enabled by default. '
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.'
,
'This feature was deprecated after v2.5.0-1.0.pre.'
,
...
@@ -789,6 +794,7 @@ class ThemeData with Diagnosticable {
...
@@ -789,6 +794,7 @@ class ThemeData with Diagnosticable {
assert
(
switchTheme
!=
null
),
assert
(
switchTheme
!=
null
),
assert
(
progressIndicatorTheme
!=
null
),
assert
(
progressIndicatorTheme
!=
null
),
assert
(
drawerTheme
!=
null
),
assert
(
drawerTheme
!=
null
),
assert
(
listTileTheme
!=
null
),
assert
(
fixTextFieldOutlineLabel
!=
null
),
assert
(
fixTextFieldOutlineLabel
!=
null
),
assert
(
useTextSelectionTheme
!=
null
);
assert
(
useTextSelectionTheme
!=
null
);
...
@@ -1356,6 +1362,9 @@ class ThemeData with Diagnosticable {
...
@@ -1356,6 +1362,9 @@ class ThemeData with Diagnosticable {
/// A theme for customizing the appearance and layout of [Drawer] widgets.
/// A theme for customizing the appearance and layout of [Drawer] widgets.
final
DrawerThemeData
drawerTheme
;
final
DrawerThemeData
drawerTheme
;
/// A theme for customizing the appearance of [ListTile] widgets.
final
ListTileThemeData
listTileTheme
;
/// An obsolete flag to allow apps to opt-out of a
/// An obsolete flag to allow apps to opt-out of a
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
...
@@ -1517,6 +1526,7 @@ class ThemeData with Diagnosticable {
...
@@ -1517,6 +1526,7 @@ class ThemeData with Diagnosticable {
SwitchThemeData
?
switchTheme
,
SwitchThemeData
?
switchTheme
,
ProgressIndicatorThemeData
?
progressIndicatorTheme
,
ProgressIndicatorThemeData
?
progressIndicatorTheme
,
DrawerThemeData
?
drawerTheme
,
DrawerThemeData
?
drawerTheme
,
ListTileThemeData
?
listTileTheme
,
@Deprecated
(
@Deprecated
(
'This "fix" is now enabled by default. '
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.'
,
'This feature was deprecated after v2.5.0-1.0.pre.'
,
...
@@ -1609,6 +1619,7 @@ class ThemeData with Diagnosticable {
...
@@ -1609,6 +1619,7 @@ class ThemeData with Diagnosticable {
switchTheme:
switchTheme
??
this
.
switchTheme
,
switchTheme:
switchTheme
??
this
.
switchTheme
,
progressIndicatorTheme:
progressIndicatorTheme
??
this
.
progressIndicatorTheme
,
progressIndicatorTheme:
progressIndicatorTheme
??
this
.
progressIndicatorTheme
,
drawerTheme:
drawerTheme
??
this
.
drawerTheme
,
drawerTheme:
drawerTheme
??
this
.
drawerTheme
,
listTileTheme:
listTileTheme
??
this
.
listTileTheme
,
fixTextFieldOutlineLabel:
fixTextFieldOutlineLabel
??
this
.
fixTextFieldOutlineLabel
,
fixTextFieldOutlineLabel:
fixTextFieldOutlineLabel
??
this
.
fixTextFieldOutlineLabel
,
useTextSelectionTheme:
useTextSelectionTheme
??
this
.
useTextSelectionTheme
,
useTextSelectionTheme:
useTextSelectionTheme
??
this
.
useTextSelectionTheme
,
androidOverscrollIndicator:
androidOverscrollIndicator
??
this
.
androidOverscrollIndicator
,
androidOverscrollIndicator:
androidOverscrollIndicator
??
this
.
androidOverscrollIndicator
,
...
@@ -1771,6 +1782,7 @@ class ThemeData with Diagnosticable {
...
@@ -1771,6 +1782,7 @@ class ThemeData with Diagnosticable {
switchTheme:
SwitchThemeData
.
lerp
(
a
.
switchTheme
,
b
.
switchTheme
,
t
),
switchTheme:
SwitchThemeData
.
lerp
(
a
.
switchTheme
,
b
.
switchTheme
,
t
),
progressIndicatorTheme:
ProgressIndicatorThemeData
.
lerp
(
a
.
progressIndicatorTheme
,
b
.
progressIndicatorTheme
,
t
)!,
progressIndicatorTheme:
ProgressIndicatorThemeData
.
lerp
(
a
.
progressIndicatorTheme
,
b
.
progressIndicatorTheme
,
t
)!,
drawerTheme:
DrawerThemeData
.
lerp
(
a
.
drawerTheme
,
b
.
drawerTheme
,
t
)!,
drawerTheme:
DrawerThemeData
.
lerp
(
a
.
drawerTheme
,
b
.
drawerTheme
,
t
)!,
listTileTheme:
ListTileThemeData
.
lerp
(
a
.
listTileTheme
,
b
.
listTileTheme
,
t
)!,
fixTextFieldOutlineLabel:
t
<
0.5
?
a
.
fixTextFieldOutlineLabel
:
b
.
fixTextFieldOutlineLabel
,
fixTextFieldOutlineLabel:
t
<
0.5
?
a
.
fixTextFieldOutlineLabel
:
b
.
fixTextFieldOutlineLabel
,
useTextSelectionTheme:
t
<
0.5
?
a
.
useTextSelectionTheme
:
b
.
useTextSelectionTheme
,
useTextSelectionTheme:
t
<
0.5
?
a
.
useTextSelectionTheme
:
b
.
useTextSelectionTheme
,
androidOverscrollIndicator:
t
<
0.5
?
a
.
androidOverscrollIndicator
:
b
.
androidOverscrollIndicator
,
androidOverscrollIndicator:
t
<
0.5
?
a
.
androidOverscrollIndicator
:
b
.
androidOverscrollIndicator
,
...
@@ -1861,6 +1873,7 @@ class ThemeData with Diagnosticable {
...
@@ -1861,6 +1873,7 @@ class ThemeData with Diagnosticable {
&&
other
.
switchTheme
==
switchTheme
&&
other
.
switchTheme
==
switchTheme
&&
other
.
progressIndicatorTheme
==
progressIndicatorTheme
&&
other
.
progressIndicatorTheme
==
progressIndicatorTheme
&&
other
.
drawerTheme
==
drawerTheme
&&
other
.
drawerTheme
==
drawerTheme
&&
other
.
listTileTheme
==
listTileTheme
&&
other
.
fixTextFieldOutlineLabel
==
fixTextFieldOutlineLabel
&&
other
.
fixTextFieldOutlineLabel
==
fixTextFieldOutlineLabel
&&
other
.
useTextSelectionTheme
==
useTextSelectionTheme
&&
other
.
useTextSelectionTheme
==
useTextSelectionTheme
&&
other
.
androidOverscrollIndicator
==
androidOverscrollIndicator
;
&&
other
.
androidOverscrollIndicator
==
androidOverscrollIndicator
;
...
@@ -1950,6 +1963,7 @@ class ThemeData with Diagnosticable {
...
@@ -1950,6 +1963,7 @@ class ThemeData with Diagnosticable {
switchTheme
,
switchTheme
,
progressIndicatorTheme
,
progressIndicatorTheme
,
drawerTheme
,
drawerTheme
,
listTileTheme
,
fixTextFieldOutlineLabel
,
fixTextFieldOutlineLabel
,
useTextSelectionTheme
,
useTextSelectionTheme
,
androidOverscrollIndicator
,
androidOverscrollIndicator
,
...
@@ -2037,6 +2051,7 @@ class ThemeData with Diagnosticable {
...
@@ -2037,6 +2051,7 @@ class ThemeData with Diagnosticable {
properties
.
add
(
DiagnosticsProperty
<
SwitchThemeData
>(
'switchTheme'
,
switchTheme
,
defaultValue:
defaultData
.
switchTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
SwitchThemeData
>(
'switchTheme'
,
switchTheme
,
defaultValue:
defaultData
.
switchTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
ProgressIndicatorThemeData
>(
'progressIndicatorTheme'
,
progressIndicatorTheme
,
defaultValue:
defaultData
.
progressIndicatorTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
ProgressIndicatorThemeData
>(
'progressIndicatorTheme'
,
progressIndicatorTheme
,
defaultValue:
defaultData
.
progressIndicatorTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
DrawerThemeData
>(
'drawerTheme'
,
drawerTheme
,
defaultValue:
defaultData
.
drawerTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
DrawerThemeData
>(
'drawerTheme'
,
drawerTheme
,
defaultValue:
defaultData
.
drawerTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
ListTileThemeData
>(
'listTileTheme'
,
listTileTheme
,
defaultValue:
defaultData
.
listTileTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
EnumProperty
<
AndroidOverscrollIndicator
>(
'androidOverscrollIndicator'
,
androidOverscrollIndicator
,
defaultValue:
null
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
EnumProperty
<
AndroidOverscrollIndicator
>(
'androidOverscrollIndicator'
,
androidOverscrollIndicator
,
defaultValue:
null
,
level:
DiagnosticLevel
.
debug
));
}
}
}
}
...
...
packages/flutter/test/material/list_tile_test.dart
View file @
acab6dcc
...
@@ -51,6 +51,128 @@ class TestTextState extends State<TestText> {
...
@@ -51,6 +51,128 @@ class TestTextState extends State<TestText> {
}
}
void
main
(
)
{
void
main
(
)
{
test
(
'ListTileThemeData copyWith, ==, hashCode basics'
,
()
{
expect
(
const
ListTileThemeData
(),
const
ListTileThemeData
().
copyWith
());
expect
(
const
ListTileThemeData
().
hashCode
,
const
ListTileThemeData
().
copyWith
().
hashCode
);
});
test
(
'ListTileThemeData defaults'
,
()
{
const
ListTileThemeData
themeData
=
ListTileThemeData
();
expect
(
themeData
.
dense
,
null
);
expect
(
themeData
.
shape
,
null
);
expect
(
themeData
.
style
,
null
);
expect
(
themeData
.
selectedColor
,
null
);
expect
(
themeData
.
iconColor
,
null
);
expect
(
themeData
.
textColor
,
null
);
expect
(
themeData
.
contentPadding
,
null
);
expect
(
themeData
.
tileColor
,
null
);
expect
(
themeData
.
selectedTileColor
,
null
);
expect
(
themeData
.
horizontalTitleGap
,
null
);
expect
(
themeData
.
minVerticalPadding
,
null
);
expect
(
themeData
.
minLeadingWidth
,
null
);
expect
(
themeData
.
enableFeedback
,
null
);
});
testWidgets
(
'Default ListTileThemeData debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
ListTileThemeData
().
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
expect
(
description
,
<
String
>[]);
});
testWidgets
(
'ListTileThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
ListTileThemeData
(
dense:
true
,
shape:
StadiumBorder
(),
style:
ListTileStyle
.
drawer
,
selectedColor:
Color
(
0x00000001
),
iconColor:
Color
(
0x00000002
),
textColor:
Color
(
0x00000003
),
contentPadding:
EdgeInsets
.
all
(
100
),
tileColor:
Color
(
0x00000004
),
selectedTileColor:
Color
(
0x00000005
),
horizontalTitleGap:
200
,
minVerticalPadding:
300
,
minLeadingWidth:
400
,
enableFeedback:
true
,
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
expect
(
description
,
<
String
>[
'dense: true'
,
'shape: StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none))'
,
'style: drawer'
,
'selectedColor: Color(0x00000001)'
,
'iconColor: Color(0x00000002)'
,
'textColor: Color(0x00000003)'
,
'contentPadding: EdgeInsets.all(100.0)'
,
'tileColor: Color(0x00000004)'
,
'selectedTileColor: Color(0x00000005)'
,
'horizontalTitleGap: 200.0'
,
'minVerticalPadding: 300.0'
,
'minLeadingWidth: 400.0'
,
'enableFeedback: true'
]);
});
testWidgets
(
'ListTileTheme backwards compatibility constructor'
,
(
WidgetTester
tester
)
async
{
late
ListTileThemeData
theme
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
ListTileTheme
(
dense:
true
,
shape:
const
StadiumBorder
(),
style:
ListTileStyle
.
drawer
,
selectedColor:
const
Color
(
0x00000001
),
iconColor:
const
Color
(
0x00000002
),
textColor:
const
Color
(
0x00000003
),
contentPadding:
const
EdgeInsets
.
all
(
100
),
tileColor:
const
Color
(
0x00000004
),
selectedTileColor:
const
Color
(
0x00000005
),
horizontalTitleGap:
200
,
minVerticalPadding:
300
,
minLeadingWidth:
400
,
enableFeedback:
true
,
child:
Center
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
theme
=
ListTileTheme
.
of
(
context
);
return
const
Placeholder
();
},
),
),
),
),
),
);
expect
(
theme
.
dense
,
true
);
expect
(
theme
.
shape
,
const
StadiumBorder
());
expect
(
theme
.
style
,
ListTileStyle
.
drawer
);
expect
(
theme
.
selectedColor
,
const
Color
(
0x00000001
));
expect
(
theme
.
iconColor
,
const
Color
(
0x00000002
));
expect
(
theme
.
textColor
,
const
Color
(
0x00000003
));
expect
(
theme
.
contentPadding
,
const
EdgeInsets
.
all
(
100
));
expect
(
theme
.
tileColor
,
const
Color
(
0x00000004
));
expect
(
theme
.
selectedTileColor
,
const
Color
(
0x00000005
));
expect
(
theme
.
horizontalTitleGap
,
200
);
expect
(
theme
.
minVerticalPadding
,
300
);
expect
(
theme
.
minLeadingWidth
,
400
);
expect
(
theme
.
enableFeedback
,
true
);
});
testWidgets
(
'ListTile geometry (LTR)'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ListTile geometry (LTR)'
,
(
WidgetTester
tester
)
async
{
// See https://material.io/go/design-lists
// See https://material.io/go/design-lists
...
@@ -291,11 +413,13 @@ void main() {
...
@@ -291,11 +413,13 @@ void main() {
home:
Material
(
home:
Material
(
child:
Center
(
child:
Center
(
child:
ListTileTheme
(
child:
ListTileTheme
(
dense:
dense
,
data:
ListTileThemeData
(
shape:
shape
,
dense:
dense
,
selectedColor:
selectedColor
,
shape:
shape
,
iconColor:
iconColor
,
selectedColor:
selectedColor
,
textColor:
textColor
,
iconColor:
iconColor
,
textColor:
textColor
,
),
child:
Builder
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
theme
=
Theme
.
of
(
context
);
theme
=
Theme
.
of
(
context
);
...
@@ -1720,15 +1844,17 @@ void main() {
...
@@ -1720,15 +1844,17 @@ void main() {
});
});
testWidgets
(
"ListTile respects ListTileTheme's tileColor & selectedTileColor"
,
(
WidgetTester
tester
)
async
{
testWidgets
(
"ListTile respects ListTileTheme's tileColor & selectedTileColor"
,
(
WidgetTester
tester
)
async
{
late
ListTileTheme
theme
;
late
ListTileTheme
Data
theme
;
bool
isSelected
=
false
;
bool
isSelected
=
false
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
tileColor:
Colors
.
green
.
shade500
,
data:
ListTileThemeData
(
selectedTileColor:
Colors
.
red
.
shade500
,
tileColor:
Colors
.
green
.
shade500
,
selectedTileColor:
Colors
.
red
.
shade500
,
),
child:
Center
(
child:
Center
(
child:
StatefulBuilder
(
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
...
@@ -1766,8 +1892,10 @@ void main() {
...
@@ -1766,8 +1892,10 @@ void main() {
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
selectedTileColor:
Colors
.
green
,
data:
const
ListTileThemeData
(
tileColor:
Colors
.
red
,
selectedTileColor:
Colors
.
green
,
tileColor:
Colors
.
red
,
),
child:
Center
(
child:
Center
(
child:
StatefulBuilder
(
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
...
@@ -1898,7 +2026,7 @@ void main() {
...
@@ -1898,7 +2026,7 @@ void main() {
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
enableFeedback:
enableFeedbackTheme
,
data:
const
ListTileThemeData
(
enableFeedback:
enableFeedbackTheme
)
,
child:
ListTile
(
child:
ListTile
(
title:
const
Text
(
'Title'
),
title:
const
Text
(
'Title'
),
onTap:
()
{},
onTap:
()
{},
...
@@ -1922,7 +2050,7 @@ void main() {
...
@@ -1922,7 +2050,7 @@ void main() {
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
enableFeedback:
enableFeedbackTheme
,
data:
const
ListTileThemeData
(
enableFeedback:
enableFeedbackTheme
)
,
child:
ListTile
(
child:
ListTile
(
enableFeedback:
enableFeedback
,
enableFeedback:
enableFeedback
,
title:
const
Text
(
'Title'
),
title:
const
Text
(
'Title'
),
...
@@ -1948,7 +2076,7 @@ void main() {
...
@@ -1948,7 +2076,7 @@ void main() {
textDirection:
textDirection
,
textDirection:
textDirection
,
child:
Material
(
child:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
horizontalTitleGap:
themeHorizontalTitleGap
,
data:
ListTileThemeData
(
horizontalTitleGap:
themeHorizontalTitleGap
)
,
child:
Container
(
child:
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
child:
ListTile
(
child:
ListTile
(
...
@@ -2081,7 +2209,7 @@ void main() {
...
@@ -2081,7 +2209,7 @@ void main() {
textDirection:
textDirection
,
textDirection:
textDirection
,
child:
Material
(
child:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
minVerticalPadding:
themeMinVerticalPadding
,
data:
ListTileThemeData
(
minVerticalPadding:
themeMinVerticalPadding
)
,
child:
Container
(
child:
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
child:
ListTile
(
child:
ListTile
(
...
@@ -2127,7 +2255,7 @@ void main() {
...
@@ -2127,7 +2255,7 @@ void main() {
textDirection:
textDirection
,
textDirection:
textDirection
,
child:
Material
(
child:
Material
(
child:
ListTileTheme
(
child:
ListTileTheme
(
minLeadingWidth:
themeMinLeadingWidth
,
data:
ListTileThemeData
(
minLeadingWidth:
themeMinLeadingWidth
)
,
child:
Container
(
child:
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
child:
ListTile
(
child:
ListTile
(
...
@@ -2241,8 +2369,10 @@ void main() {
...
@@ -2241,8 +2369,10 @@ void main() {
home:
Material
(
home:
Material
(
child:
Center
(
child:
Center
(
child:
ListTileTheme
(
child:
ListTileTheme
(
selectedColor:
selectedColor
,
data:
const
ListTileThemeData
(
textColor:
defaultColor
,
selectedColor:
selectedColor
,
textColor:
defaultColor
,
),
child:
Builder
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
theme
=
Theme
.
of
(
context
);
theme
=
Theme
.
of
(
context
);
...
...
packages/flutter/test/material/theme_data_test.dart
View file @
acab6dcc
...
@@ -346,6 +346,7 @@ void main() {
...
@@ -346,6 +346,7 @@ void main() {
switchTheme:
const
SwitchThemeData
(),
switchTheme:
const
SwitchThemeData
(),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
drawerTheme:
const
DrawerThemeData
(),
drawerTheme:
const
DrawerThemeData
(),
listTileTheme:
const
ListTileThemeData
(),
fixTextFieldOutlineLabel:
false
,
fixTextFieldOutlineLabel:
false
,
useTextSelectionTheme:
false
,
useTextSelectionTheme:
false
,
androidOverscrollIndicator:
null
,
androidOverscrollIndicator:
null
,
...
@@ -443,6 +444,7 @@ void main() {
...
@@ -443,6 +444,7 @@ void main() {
switchTheme:
const
SwitchThemeData
(),
switchTheme:
const
SwitchThemeData
(),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
drawerTheme:
const
DrawerThemeData
(),
drawerTheme:
const
DrawerThemeData
(),
listTileTheme:
const
ListTileThemeData
(),
fixTextFieldOutlineLabel:
true
,
fixTextFieldOutlineLabel:
true
,
useTextSelectionTheme:
true
,
useTextSelectionTheme:
true
,
androidOverscrollIndicator:
AndroidOverscrollIndicator
.
stretch
,
androidOverscrollIndicator:
AndroidOverscrollIndicator
.
stretch
,
...
@@ -521,6 +523,7 @@ void main() {
...
@@ -521,6 +523,7 @@ void main() {
switchTheme:
otherTheme
.
switchTheme
,
switchTheme:
otherTheme
.
switchTheme
,
progressIndicatorTheme:
otherTheme
.
progressIndicatorTheme
,
progressIndicatorTheme:
otherTheme
.
progressIndicatorTheme
,
drawerTheme:
otherTheme
.
drawerTheme
,
drawerTheme:
otherTheme
.
drawerTheme
,
listTileTheme:
otherTheme
.
listTileTheme
,
fixTextFieldOutlineLabel:
otherTheme
.
fixTextFieldOutlineLabel
,
fixTextFieldOutlineLabel:
otherTheme
.
fixTextFieldOutlineLabel
,
);
);
...
@@ -596,6 +599,7 @@ void main() {
...
@@ -596,6 +599,7 @@ void main() {
expect
(
themeDataCopy
.
switchTheme
,
equals
(
otherTheme
.
switchTheme
));
expect
(
themeDataCopy
.
switchTheme
,
equals
(
otherTheme
.
switchTheme
));
expect
(
themeDataCopy
.
progressIndicatorTheme
,
equals
(
otherTheme
.
progressIndicatorTheme
));
expect
(
themeDataCopy
.
progressIndicatorTheme
,
equals
(
otherTheme
.
progressIndicatorTheme
));
expect
(
themeDataCopy
.
drawerTheme
,
equals
(
otherTheme
.
drawerTheme
));
expect
(
themeDataCopy
.
drawerTheme
,
equals
(
otherTheme
.
drawerTheme
));
expect
(
themeDataCopy
.
listTileTheme
,
equals
(
otherTheme
.
listTileTheme
));
expect
(
themeDataCopy
.
fixTextFieldOutlineLabel
,
equals
(
otherTheme
.
fixTextFieldOutlineLabel
));
expect
(
themeDataCopy
.
fixTextFieldOutlineLabel
,
equals
(
otherTheme
.
fixTextFieldOutlineLabel
));
});
});
...
...
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