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
94ff5202
Unverified
Commit
94ff5202
authored
Oct 12, 2021
by
Hans Muller
Committed by
GitHub
Oct 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored ListTileTheme: ListTileThemeData, ThemeData.listThemeData (#91449)
parent
4d25af34
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
648 additions
and
234 deletions
+648
-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
+519
-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
+99
-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 @
94ff5202
...
@@ -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 @
94ff5202
...
@@ -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 @
94ff5202
...
@@ -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 @
94ff5202
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
94ff5202
...
@@ -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 @
94ff5202
...
@@ -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 @
94ff5202
...
@@ -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 @
94ff5202
...
@@ -51,6 +51,80 @@ class TestTextState extends State<TestText> {
...
@@ -51,6 +51,80 @@ 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
(
'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 +365,13 @@ void main() {
...
@@ -291,11 +365,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 +1796,17 @@ void main() {
...
@@ -1720,15 +1796,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 +1844,10 @@ void main() {
...
@@ -1766,8 +1844,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 +1978,7 @@ void main() {
...
@@ -1898,7 +1978,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 +2002,7 @@ void main() {
...
@@ -1922,7 +2002,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 +2028,7 @@ void main() {
...
@@ -1948,7 +2028,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 +2161,7 @@ void main() {
...
@@ -2081,7 +2161,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 +2207,7 @@ void main() {
...
@@ -2127,7 +2207,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 +2321,10 @@ void main() {
...
@@ -2241,8 +2321,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 @
94ff5202
...
@@ -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