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
17e2fce1
Unverified
Commit
17e2fce1
authored
May 19, 2022
by
Darren Austin
Committed by
GitHub
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add const `MaterialStatePropertyAll` class. (#104127)
parent
b1f10ceb
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
190 additions
and
166 deletions
+190
-166
button_template.dart
dev/tools/gen_defaults/lib/button_template.dart
+1
-1
navigation_bar.0.dart
...les/api/lib/material/navigation_bar/navigation_bar.0.dart
+1
-1
actions.0.dart
examples/api/lib/widgets/actions/actions.0.dart
+1
-1
button_style.dart
packages/flutter/lib/src/material/button_style.dart
+1
-1
button_style_button.dart
packages/flutter/lib/src/material/button_style_button.dart
+2
-2
elevated_button.dart
packages/flutter/lib/src/material/elevated_button.dart
+3
-3
material_state.dart
packages/flutter/lib/src/material/material_state.dart
+16
-4
navigation_bar.dart
packages/flutter/lib/src/material/navigation_bar.dart
+2
-2
outlined_button.dart
packages/flutter/lib/src/material/outlined_button.dart
+1
-1
stepper.dart
packages/flutter/lib/src/material/stepper.dart
+2
-2
text_button.dart
packages/flutter/lib/src/material/text_button.dart
+2
-2
toggle_buttons.dart
packages/flutter/lib/src/material/toggle_buttons.dart
+9
-9
button_style_test.dart
packages/flutter/test/material/button_style_test.dart
+45
-45
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+1
-1
checkbox_theme_test.dart
packages/flutter/test/material/checkbox_theme_test.dart
+18
-18
data_table_test.dart
packages/flutter/test/material/data_table_test.dart
+3
-3
data_table_theme_test.dart
packages/flutter/test/material/data_table_theme_test.dart
+14
-14
elevated_button_test.dart
packages/flutter/test/material/elevated_button_test.dart
+7
-7
material_state_property_test.dart
...s/flutter/test/material/material_state_property_test.dart
+12
-0
navigation_bar_theme_test.dart
...ages/flutter/test/material/navigation_bar_theme_test.dart
+8
-8
outlined_button_test.dart
packages/flutter/test/material/outlined_button_test.dart
+6
-6
radio_test.dart
packages/flutter/test/material/radio_test.dart
+1
-1
radio_theme_test.dart
packages/flutter/test/material/radio_theme_test.dart
+13
-13
slider_theme_test.dart
packages/flutter/test/material/slider_theme_test.dart
+1
-1
switch_test.dart
packages/flutter/test/material/switch_test.dart
+1
-1
switch_theme_test.dart
packages/flutter/test/material/switch_theme_test.dart
+17
-17
text_button_test.dart
packages/flutter/test/material/text_button_test.dart
+2
-2
No files found.
dev/tools/gen_defaults/lib/button_template.dart
View file @
17e2fce1
...
@@ -64,7 +64,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
...
@@ -64,7 +64,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
@override
@override
MaterialStateProperty<TextStyle?> get textStyle =>
MaterialStateProperty<TextStyle?> get textStyle =>
MaterialStateProperty
.a
ll<TextStyle?>(
${textStyle("$tokenGroup.label-text")}
);
MaterialStateProperty
A
ll<TextStyle?>(
${textStyle("$tokenGroup.label-text")}
);
@override
@override
MaterialStateProperty<Color?>? get backgroundColor =>
${_backgroundColor()}
;
MaterialStateProperty<Color?>? get backgroundColor =>
${_backgroundColor()}
;
...
...
examples/api/lib/material/navigation_bar/navigation_bar.0.dart
View file @
17e2fce1
...
@@ -143,7 +143,7 @@ class ListPage extends StatelessWidget {
...
@@ -143,7 +143,7 @@ class ListPage extends StatelessWidget {
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4
,
horizontal:
8
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4
,
horizontal:
8
),
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
buttonStyle
.
copyWith
(
style:
buttonStyle
.
copyWith
(
backgroundColor:
MaterialStateProperty
.
a
ll
<
Color
>(
backgroundColor:
MaterialStateProperty
A
ll
<
Color
>(
Color
.
lerp
(
destination
.
color
[
100
],
Colors
.
white
,
index
/
itemCount
)!
Color
.
lerp
(
destination
.
color
[
100
],
Colors
.
white
,
index
/
itemCount
)!
),
),
),
),
...
...
examples/api/lib/widgets/actions/actions.0.dart
View file @
17e2fce1
...
@@ -101,7 +101,7 @@ class _SaveButtonState extends State<SaveButton> {
...
@@ -101,7 +101,7 @@ class _SaveButtonState extends State<SaveButton> {
icon:
const
Icon
(
Icons
.
save
),
icon:
const
Icon
(
Icons
.
save
),
label:
Text
(
'
$savedValue
'
),
label:
Text
(
'
$savedValue
'
),
style:
ButtonStyle
(
style:
ButtonStyle
(
foregroundColor:
MaterialStateProperty
.
a
ll
<
Color
>(
foregroundColor:
MaterialStateProperty
A
ll
<
Color
>(
widget
.
valueNotifier
.
value
?
Colors
.
red
:
Colors
.
green
,
widget
.
valueNotifier
.
value
?
Colors
.
red
:
Colors
.
green
,
),
),
),
),
...
...
packages/flutter/lib/src/material/button_style.dart
View file @
17e2fce1
...
@@ -53,7 +53,7 @@ import 'theme_data.dart';
...
@@ -53,7 +53,7 @@ import 'theme_data.dart';
/// ```dart
/// ```dart
/// ElevatedButton(
/// ElevatedButton(
/// style: ButtonStyle(
/// style: ButtonStyle(
/// backgroundColor: MaterialStateProperty
.a
ll<Color>(Colors.green),
/// backgroundColor: MaterialStateProperty
A
ll<Color>(Colors.green),
/// ),
/// ),
/// )
/// )
/// ```
/// ```
...
...
packages/flutter/lib/src/material/button_style_button.dart
View file @
17e2fce1
...
@@ -148,10 +148,10 @@ abstract class ButtonStyleButton extends StatefulWidget {
...
@@ -148,10 +148,10 @@ abstract class ButtonStyleButton extends StatefulWidget {
properties
.
add
(
DiagnosticsProperty
<
FocusNode
>(
'focusNode'
,
focusNode
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
FocusNode
>(
'focusNode'
,
focusNode
,
defaultValue:
null
));
}
}
/// Returns null if [value] is null, otherwise `MaterialStateProperty
.a
ll<T>(value)`.
/// Returns null if [value] is null, otherwise `MaterialStateProperty
A
ll<T>(value)`.
///
///
/// A convenience method for subclasses.
/// A convenience method for subclasses.
static
MaterialStateProperty
<
T
>?
allOrNull
<
T
>(
T
?
value
)
=>
value
==
null
?
null
:
MaterialStateProperty
.
a
ll
<
T
>(
value
);
static
MaterialStateProperty
<
T
>?
allOrNull
<
T
>(
T
?
value
)
=>
value
==
null
?
null
:
MaterialStateProperty
A
ll
<
T
>(
value
);
/// Returns an interpolated value based on the [textScaleFactor] parameter:
/// Returns an interpolated value based on the [textScaleFactor] parameter:
///
///
...
...
packages/flutter/lib/src/material/elevated_button.dart
View file @
17e2fce1
...
@@ -172,7 +172,7 @@ class ElevatedButton extends ButtonStyleButton {
...
@@ -172,7 +172,7 @@ class ElevatedButton extends ButtonStyleButton {
:
_ElevatedButtonDefaultMouseCursor
(
enabledMouseCursor
,
disabledMouseCursor
);
:
_ElevatedButtonDefaultMouseCursor
(
enabledMouseCursor
,
disabledMouseCursor
);
return
ButtonStyle
(
return
ButtonStyle
(
textStyle:
MaterialStateProperty
.
a
ll
<
TextStyle
?>(
textStyle
),
textStyle:
MaterialStateProperty
A
ll
<
TextStyle
?>(
textStyle
),
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
foregroundColor:
foregroundColor
,
foregroundColor:
foregroundColor
,
overlayColor:
overlayColor
,
overlayColor:
overlayColor
,
...
@@ -468,7 +468,7 @@ class _ElevatedButtonWithIcon extends ElevatedButton {
...
@@ -468,7 +468,7 @@ class _ElevatedButtonWithIcon extends ElevatedButton {
MediaQuery
.
maybeOf
(
context
)?.
textScaleFactor
??
1
,
MediaQuery
.
maybeOf
(
context
)?.
textScaleFactor
??
1
,
);
);
return
super
.
defaultStyleOf
(
context
).
copyWith
(
return
super
.
defaultStyleOf
(
context
).
copyWith
(
padding:
MaterialStateProperty
.
a
ll
<
EdgeInsetsGeometry
>(
scaledPadding
),
padding:
MaterialStateProperty
A
ll
<
EdgeInsetsGeometry
>(
scaledPadding
),
);
);
}
}
}
}
...
@@ -510,7 +510,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
...
@@ -510,7 +510,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
@override
@override
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
.
a
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
MaterialStateProperty
A
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
@override
@override
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
...
...
packages/flutter/lib/src/material/material_state.dart
View file @
17e2fce1
...
@@ -651,7 +651,13 @@ abstract class MaterialStateProperty<T> {
...
@@ -651,7 +651,13 @@ abstract class MaterialStateProperty<T> {
/// Convenience method for creating a [MaterialStateProperty] that resolves
/// Convenience method for creating a [MaterialStateProperty] that resolves
/// to a single value for all states.
/// to a single value for all states.
static
MaterialStateProperty
<
T
>
all
<
T
>(
T
value
)
=>
_MaterialStatePropertyAll
<
T
>(
value
);
///
/// If you need a const value, use [MaterialStatePropertyAll] directly.
///
// TODO(darrenaustin): Deprecate this when we have the ability to create
// a dart fix that will replace this with MaterialStatePropertyAll:
// https://github.com/dart-lang/sdk/issues/49056.
static
MaterialStateProperty
<
T
>
all
<
T
>(
T
value
)
=>
MaterialStatePropertyAll
<
T
>(
value
);
}
}
class
_MaterialStatePropertyWith
<
T
>
implements
MaterialStateProperty
<
T
>
{
class
_MaterialStatePropertyWith
<
T
>
implements
MaterialStateProperty
<
T
>
{
...
@@ -663,14 +669,20 @@ class _MaterialStatePropertyWith<T> implements MaterialStateProperty<T> {
...
@@ -663,14 +669,20 @@ class _MaterialStatePropertyWith<T> implements MaterialStateProperty<T> {
T
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
T
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
}
}
class
_MaterialStatePropertyAll
<
T
>
implements
MaterialStateProperty
<
T
>
{
/// Convenience class for creating a [MaterialStateProperty] that
_MaterialStatePropertyAll
(
this
.
value
);
/// resolves to the given value for all states.
class
MaterialStatePropertyAll
<
T
>
implements
MaterialStateProperty
<
T
>
{
/// Constructs a [MaterialStateProperty] that always resolves to the given
/// value.
const
MaterialStatePropertyAll
(
this
.
value
);
/// The value of the property that will be used for all states.
final
T
value
;
final
T
value
;
@override
@override
T
resolve
(
Set
<
MaterialState
>
states
)
=>
value
;
T
resolve
(
Set
<
MaterialState
>
states
)
=>
value
;
@override
@override
String
toString
()
=>
'MaterialStateProperty
.a
ll(
$value
)'
;
String
toString
()
=>
'MaterialStateProperty
A
ll(
$value
)'
;
}
}
packages/flutter/lib/src/material/navigation_bar.dart
View file @
17e2fce1
...
@@ -1194,7 +1194,7 @@ class _Defaults extends NavigationBarThemeData {
...
@@ -1194,7 +1194,7 @@ class _Defaults extends NavigationBarThemeData {
@override
Color
?
get
backgroundColor
=>
ElevationOverlay
.
colorWithOverlay
(
_colors
.
surface
,
_colors
.
onSurface
,
3.0
);
@override
Color
?
get
backgroundColor
=>
ElevationOverlay
.
colorWithOverlay
(
_colors
.
surface
,
_colors
.
onSurface
,
3.0
);
@override
MaterialStateProperty
<
IconThemeData
?>?
get
iconTheme
{
@override
MaterialStateProperty
<
IconThemeData
?>?
get
iconTheme
{
return
MaterialStateProperty
.
all
(
IconThemeData
(
return
MaterialStateProperty
All
<
IconThemeData
>
(
IconThemeData
(
size:
24
,
size:
24
,
color:
_colors
.
onSurface
,
color:
_colors
.
onSurface
,
));
));
...
@@ -1202,7 +1202,7 @@ class _Defaults extends NavigationBarThemeData {
...
@@ -1202,7 +1202,7 @@ class _Defaults extends NavigationBarThemeData {
@override
Color
?
get
indicatorColor
=>
_colors
.
secondary
.
withOpacity
(
0.24
);
@override
Color
?
get
indicatorColor
=>
_colors
.
secondary
.
withOpacity
(
0.24
);
@override
MaterialStateProperty
<
TextStyle
?>?
get
labelTextStyle
=>
MaterialStateProperty
.
all
(
_theme
.
textTheme
.
overline
!.
copyWith
(
color:
_colors
.
onSurface
));
@override
MaterialStateProperty
<
TextStyle
?>?
get
labelTextStyle
=>
MaterialStateProperty
All
<
TextStyle
?>
(
_theme
.
textTheme
.
overline
!.
copyWith
(
color:
_colors
.
onSurface
));
}
}
// BEGIN GENERATED TOKEN PROPERTIES
// BEGIN GENERATED TOKEN PROPERTIES
...
...
packages/flutter/lib/src/material/outlined_button.dart
View file @
17e2fce1
...
@@ -433,7 +433,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
...
@@ -433,7 +433,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
@override
@override
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
.
a
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
MaterialStateProperty
A
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
@override
@override
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
...
...
packages/flutter/lib/src/material/stepper.dart
View file @
17e2fce1
...
@@ -504,8 +504,8 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
...
@@ -504,8 +504,8 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
backgroundColor:
MaterialStateProperty
.
resolveWith
<
Color
?>((
Set
<
MaterialState
>
states
)
{
backgroundColor:
MaterialStateProperty
.
resolveWith
<
Color
?>((
Set
<
MaterialState
>
states
)
{
return
_isDark
()
||
states
.
contains
(
MaterialState
.
disabled
)
?
null
:
colorScheme
.
primary
;
return
_isDark
()
||
states
.
contains
(
MaterialState
.
disabled
)
?
null
:
colorScheme
.
primary
;
}),
}),
padding:
MaterialStateProperty
.
a
ll
<
EdgeInsetsGeometry
>(
buttonPadding
),
padding:
const
MaterialStatePropertyA
ll
<
EdgeInsetsGeometry
>(
buttonPadding
),
shape:
MaterialStateProperty
.
a
ll
<
OutlinedBorder
>(
buttonShape
),
shape:
const
MaterialStatePropertyA
ll
<
OutlinedBorder
>(
buttonShape
),
),
),
child:
Text
(
localizations
.
continueButtonLabel
),
child:
Text
(
localizations
.
continueButtonLabel
),
),
),
...
...
packages/flutter/lib/src/material/text_button.dart
View file @
17e2fce1
...
@@ -426,7 +426,7 @@ class _TextButtonWithIcon extends TextButton {
...
@@ -426,7 +426,7 @@ class _TextButtonWithIcon extends TextButton {
MediaQuery
.
maybeOf
(
context
)?.
textScaleFactor
??
1
,
MediaQuery
.
maybeOf
(
context
)?.
textScaleFactor
??
1
,
);
);
return
super
.
defaultStyleOf
(
context
).
copyWith
(
return
super
.
defaultStyleOf
(
context
).
copyWith
(
padding:
MaterialStateProperty
.
a
ll
<
EdgeInsetsGeometry
>(
scaledPadding
),
padding:
MaterialStateProperty
A
ll
<
EdgeInsetsGeometry
>(
scaledPadding
),
);
);
}
}
}
}
...
@@ -471,7 +471,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
...
@@ -471,7 +471,7 @@ class _TokenDefaultsM3 extends ButtonStyle {
@override
@override
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
<
TextStyle
?>
get
textStyle
=>
MaterialStateProperty
.
a
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
MaterialStateProperty
A
ll
<
TextStyle
?>(
Theme
.
of
(
context
).
textTheme
.
labelLarge
);
@override
@override
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
MaterialStateProperty
<
Color
?>?
get
backgroundColor
=>
...
...
packages/flutter/lib/src/material/toggle_buttons.dart
View file @
17e2fce1
...
@@ -742,8 +742,8 @@ class ToggleButtons extends StatelessWidget {
...
@@ -742,8 +742,8 @@ class ToggleButtons extends StatelessWidget {
child:
TextButton
(
child:
TextButton
(
focusNode:
focusNodes
!=
null
?
focusNodes
![
index
]
:
null
,
focusNode:
focusNodes
!=
null
?
focusNodes
![
index
]
:
null
,
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
a
ll
<
Color
?>(
effectiveFillColor
),
backgroundColor:
MaterialStateProperty
A
ll
<
Color
?>(
effectiveFillColor
),
foregroundColor:
MaterialStateProperty
.
a
ll
<
Color
?>(
currentColor
),
foregroundColor:
MaterialStateProperty
A
ll
<
Color
?>(
currentColor
),
overlayColor:
_ToggleButtonDefaultOverlay
(
overlayColor:
_ToggleButtonDefaultOverlay
(
selected:
onPressed
!=
null
&&
isSelected
[
index
],
selected:
onPressed
!=
null
&&
isSelected
[
index
],
unselected:
onPressed
!=
null
&&
!
isSelected
[
index
],
unselected:
onPressed
!=
null
&&
!
isSelected
[
index
],
...
@@ -754,15 +754,15 @@ class ToggleButtons extends StatelessWidget {
...
@@ -754,15 +754,15 @@ class ToggleButtons extends StatelessWidget {
hoverColor:
hoverColor
??
toggleButtonsTheme
.
hoverColor
,
hoverColor:
hoverColor
??
toggleButtonsTheme
.
hoverColor
,
splashColor:
splashColor
??
toggleButtonsTheme
.
splashColor
,
splashColor:
splashColor
??
toggleButtonsTheme
.
splashColor
,
),
),
elevation:
MaterialStateProperty
.
a
ll
<
double
>(
0
),
elevation:
const
MaterialStatePropertyA
ll
<
double
>(
0
),
textStyle:
MaterialStateProperty
.
a
ll
<
TextStyle
?>(
currentTextStyle
.
copyWith
(
textStyle:
MaterialStateProperty
A
ll
<
TextStyle
?>(
currentTextStyle
.
copyWith
(
color:
currentColor
,
color:
currentColor
,
)),
)),
padding:
MaterialStateProperty
.
a
ll
<
EdgeInsetsGeometry
>(
EdgeInsets
.
zero
),
padding:
const
MaterialStatePropertyA
ll
<
EdgeInsetsGeometry
>(
EdgeInsets
.
zero
),
minimumSize:
MaterialStateProperty
.
a
ll
<
Size
?>(
minimumSize
),
minimumSize:
MaterialStateProperty
A
ll
<
Size
?>(
minimumSize
),
maximumSize:
MaterialStateProperty
.
a
ll
<
Size
?>(
maximumSize
),
maximumSize:
MaterialStateProperty
A
ll
<
Size
?>(
maximumSize
),
shape:
MaterialStateProperty
.
all
<
OutlinedBorder
>(
const
RoundedRectangleBorder
()),
shape:
const
MaterialStatePropertyAll
<
OutlinedBorder
>(
RoundedRectangleBorder
()),
mouseCursor:
MaterialStateProperty
.
a
ll
<
MouseCursor
?>(
mouseCursor
),
mouseCursor:
MaterialStateProperty
A
ll
<
MouseCursor
?>(
mouseCursor
),
visualDensity:
VisualDensity
.
standard
,
visualDensity:
VisualDensity
.
standard
,
tapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
tapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
animationDuration:
kThemeChangeDuration
,
animationDuration:
kThemeChangeDuration
,
...
...
packages/flutter/test/material/button_style_test.dart
View file @
17e2fce1
...
@@ -50,22 +50,22 @@ void main() {
...
@@ -50,22 +50,22 @@ void main() {
testWidgets
(
'ButtonStyle debugFillProperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ButtonStyle debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
ButtonStyle
(
const
ButtonStyle
(
textStyle:
MaterialStateProperty
.
all
<
TextStyle
>(
const
TextStyle
(
fontSize:
10.0
)),
textStyle:
MaterialStateProperty
All
<
TextStyle
>(
TextStyle
(
fontSize:
10.0
)),
backgroundColor:
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
)),
backgroundColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff1
)),
foregroundColor:
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff2
)),
foregroundColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff2
)),
overlayColor:
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff3
)),
overlayColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff3
)),
shadowColor:
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff4
)),
shadowColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff4
)),
surfaceTintColor:
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff5
)),
surfaceTintColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff5
)),
elevation:
MaterialStateProperty
.
a
ll
<
double
>(
1.5
),
elevation:
MaterialStateProperty
A
ll
<
double
>(
1.5
),
padding:
MaterialStateProperty
.
all
<
EdgeInsets
>(
const
EdgeInsets
.
all
(
1.0
)),
padding:
MaterialStateProperty
All
<
EdgeInsets
>(
EdgeInsets
.
all
(
1.0
)),
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
1.0
,
2.0
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
1.0
,
2.0
)),
side:
MaterialStateProperty
.
all
<
BorderSide
>(
const
BorderSide
(
width:
4.0
,
color:
Color
(
0xfffffff6
))),
side:
MaterialStateProperty
All
<
BorderSide
>(
BorderSide
(
width:
4.0
,
color:
Color
(
0xfffffff6
))),
maximumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
100.0
,
200.0
)),
maximumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
100.0
,
200.0
)),
shape:
MaterialStateProperty
.
all
<
OutlinedBorder
>(
const
StadiumBorder
()),
shape:
MaterialStateProperty
All
<
OutlinedBorder
>(
StadiumBorder
()),
mouseCursor:
MaterialStateProperty
.
a
ll
<
MouseCursor
>(
SystemMouseCursors
.
forbidden
),
mouseCursor:
MaterialStateProperty
A
ll
<
MouseCursor
>(
SystemMouseCursors
.
forbidden
),
tapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
tapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
animationDuration:
const
Duration
(
seconds:
1
),
animationDuration:
Duration
(
seconds:
1
),
enableFeedback:
true
,
enableFeedback:
true
,
).
debugFillProperties
(
builder
);
).
debugFillProperties
(
builder
);
...
@@ -75,19 +75,19 @@ void main() {
...
@@ -75,19 +75,19 @@ void main() {
.
toList
();
.
toList
();
expect
(
description
,
<
String
>[
expect
(
description
,
<
String
>[
'textStyle: MaterialStateProperty
.a
ll(TextStyle(inherit: true, size: 10.0))'
,
'textStyle: MaterialStateProperty
A
ll(TextStyle(inherit: true, size: 10.0))'
,
'backgroundColor: MaterialStateProperty
.a
ll(Color(0xfffffff1))'
,
'backgroundColor: MaterialStateProperty
A
ll(Color(0xfffffff1))'
,
'foregroundColor: MaterialStateProperty
.a
ll(Color(0xfffffff2))'
,
'foregroundColor: MaterialStateProperty
A
ll(Color(0xfffffff2))'
,
'overlayColor: MaterialStateProperty
.a
ll(Color(0xfffffff3))'
,
'overlayColor: MaterialStateProperty
A
ll(Color(0xfffffff3))'
,
'shadowColor: MaterialStateProperty
.a
ll(Color(0xfffffff4))'
,
'shadowColor: MaterialStateProperty
A
ll(Color(0xfffffff4))'
,
'surfaceTintColor: MaterialStateProperty
.a
ll(Color(0xfffffff5))'
,
'surfaceTintColor: MaterialStateProperty
A
ll(Color(0xfffffff5))'
,
'elevation: MaterialStateProperty
.a
ll(1.5)'
,
'elevation: MaterialStateProperty
A
ll(1.5)'
,
'padding: MaterialStateProperty
.a
ll(EdgeInsets.all(1.0))'
,
'padding: MaterialStateProperty
A
ll(EdgeInsets.all(1.0))'
,
'minimumSize: MaterialStateProperty
.a
ll(Size(1.0, 2.0))'
,
'minimumSize: MaterialStateProperty
A
ll(Size(1.0, 2.0))'
,
'maximumSize: MaterialStateProperty
.a
ll(Size(100.0, 200.0))'
,
'maximumSize: MaterialStateProperty
A
ll(Size(100.0, 200.0))'
,
'side: MaterialStateProperty
.a
ll(BorderSide(Color(0xfffffff6), 4.0, BorderStyle.solid))'
,
'side: MaterialStateProperty
A
ll(BorderSide(Color(0xfffffff6), 4.0, BorderStyle.solid))'
,
'shape: MaterialStateProperty
.a
ll(StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none)))'
,
'shape: MaterialStateProperty
A
ll(StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none)))'
,
'mouseCursor: MaterialStateProperty
.a
ll(SystemMouseCursor(forbidden))'
,
'mouseCursor: MaterialStateProperty
A
ll(SystemMouseCursor(forbidden))'
,
'tapTargetSize: shrinkWrap'
,
'tapTargetSize: shrinkWrap'
,
'animationDuration: 0:00:01.000000'
,
'animationDuration: 0:00:01.000000'
,
'enableFeedback: true'
,
'enableFeedback: true'
,
...
@@ -95,26 +95,26 @@ void main() {
...
@@ -95,26 +95,26 @@ void main() {
});
});
testWidgets
(
'ButtonStyle copyWith, merge'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ButtonStyle copyWith, merge'
,
(
WidgetTester
tester
)
async
{
final
MaterialStateProperty
<
TextStyle
>
textStyle
=
MaterialStateProperty
.
all
<
TextStyle
>(
const
TextStyle
(
fontSize:
10
));
const
MaterialStateProperty
<
TextStyle
>
textStyle
=
MaterialStatePropertyAll
<
TextStyle
>(
TextStyle
(
fontSize:
10
));
final
MaterialStateProperty
<
Color
>
backgroundColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
backgroundColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
final
MaterialStateProperty
<
Color
>
foregroundColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff2
));
const
MaterialStateProperty
<
Color
>
foregroundColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff2
));
final
MaterialStateProperty
<
Color
>
overlayColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff3
));
const
MaterialStateProperty
<
Color
>
overlayColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff3
));
final
MaterialStateProperty
<
Color
>
shadowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff4
));
const
MaterialStateProperty
<
Color
>
shadowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff4
));
final
MaterialStateProperty
<
Color
>
surfaceTintColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff5
));
const
MaterialStateProperty
<
Color
>
surfaceTintColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff5
));
final
MaterialStateProperty
<
double
>
elevation
=
MaterialStateProperty
.
a
ll
<
double
>(
1
);
const
MaterialStateProperty
<
double
>
elevation
=
MaterialStatePropertyA
ll
<
double
>(
1
);
final
MaterialStateProperty
<
EdgeInsets
>
padding
=
MaterialStateProperty
.
all
<
EdgeInsets
>(
const
EdgeInsets
.
all
(
1
));
const
MaterialStateProperty
<
EdgeInsets
>
padding
=
MaterialStatePropertyAll
<
EdgeInsets
>(
EdgeInsets
.
all
(
1
));
final
MaterialStateProperty
<
Size
>
minimumSize
=
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
1
,
2
));
const
MaterialStateProperty
<
Size
>
minimumSize
=
MaterialStatePropertyAll
<
Size
>(
Size
(
1
,
2
));
final
MaterialStateProperty
<
Size
>
fixedSize
=
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
3
,
4
));
const
MaterialStateProperty
<
Size
>
fixedSize
=
MaterialStatePropertyAll
<
Size
>(
Size
(
3
,
4
));
final
MaterialStateProperty
<
Size
>
maximumSize
=
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
5
,
6
));
const
MaterialStateProperty
<
Size
>
maximumSize
=
MaterialStatePropertyAll
<
Size
>(
Size
(
5
,
6
));
final
MaterialStateProperty
<
BorderSide
>
side
=
MaterialStateProperty
.
all
<
BorderSide
>(
const
BorderSide
());
const
MaterialStateProperty
<
BorderSide
>
side
=
MaterialStatePropertyAll
<
BorderSide
>(
BorderSide
());
final
MaterialStateProperty
<
OutlinedBorder
>
shape
=
MaterialStateProperty
.
all
<
OutlinedBorder
>(
const
StadiumBorder
());
const
MaterialStateProperty
<
OutlinedBorder
>
shape
=
MaterialStatePropertyAll
<
OutlinedBorder
>(
StadiumBorder
());
final
MaterialStateProperty
<
MouseCursor
>
mouseCursor
=
MaterialStateProperty
.
a
ll
<
MouseCursor
>(
SystemMouseCursors
.
forbidden
);
const
MaterialStateProperty
<
MouseCursor
>
mouseCursor
=
MaterialStatePropertyA
ll
<
MouseCursor
>(
SystemMouseCursors
.
forbidden
);
const
VisualDensity
visualDensity
=
VisualDensity
.
compact
;
const
VisualDensity
visualDensity
=
VisualDensity
.
compact
;
const
MaterialTapTargetSize
tapTargetSize
=
MaterialTapTargetSize
.
shrinkWrap
;
const
MaterialTapTargetSize
tapTargetSize
=
MaterialTapTargetSize
.
shrinkWrap
;
const
Duration
animationDuration
=
Duration
(
seconds:
1
);
const
Duration
animationDuration
=
Duration
(
seconds:
1
);
const
bool
enableFeedback
=
true
;
const
bool
enableFeedback
=
true
;
final
ButtonStyle
style
=
ButtonStyle
(
const
ButtonStyle
style
=
ButtonStyle
(
textStyle:
textStyle
,
textStyle:
textStyle
,
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
foregroundColor:
foregroundColor
,
foregroundColor:
foregroundColor
,
...
@@ -180,8 +180,8 @@ void main() {
...
@@ -180,8 +180,8 @@ void main() {
const
BorderSide
whiteSide
=
BorderSide
(
color:
Color
(
0xFFFFFFFF
));
const
BorderSide
whiteSide
=
BorderSide
(
color:
Color
(
0xFFFFFFFF
));
const
BorderSide
emptyBlackSide
=
BorderSide
(
width:
0
,
color:
Color
(
0x00000000
));
const
BorderSide
emptyBlackSide
=
BorderSide
(
width:
0
,
color:
Color
(
0x00000000
));
final
ButtonStyle
blackStyle
=
ButtonStyle
(
side:
MaterialStateProperty
.
a
ll
<
BorderSide
>(
blackSide
));
const
ButtonStyle
blackStyle
=
ButtonStyle
(
side:
MaterialStatePropertyA
ll
<
BorderSide
>(
blackSide
));
final
ButtonStyle
whiteStyle
=
ButtonStyle
(
side:
MaterialStateProperty
.
a
ll
<
BorderSide
>(
whiteSide
));
const
ButtonStyle
whiteStyle
=
ButtonStyle
(
side:
MaterialStatePropertyA
ll
<
BorderSide
>(
whiteSide
));
// MaterialState.all<Foo>(value) properties resolve to value
// MaterialState.all<Foo>(value) properties resolve to value
// for any set of MaterialStates.
// for any set of MaterialStates.
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
17e2fce1
...
@@ -968,7 +968,7 @@ void main() {
...
@@ -968,7 +968,7 @@ void main() {
autofocus:
focused
,
autofocus:
focused
,
value:
active
,
value:
active
,
onChanged:
(
_
)
{
},
onChanged:
(
_
)
{
},
fillColor:
MaterialStateProperty
.
all
(
fillColor
),
fillColor:
const
MaterialStatePropertyAll
<
Color
>
(
fillColor
),
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
hoverColor:
hoverColor
,
hoverColor:
hoverColor
,
focusColor:
focusColor
,
focusColor:
focusColor
,
...
...
packages/flutter/test/material/checkbox_theme_test.dart
View file @
17e2fce1
...
@@ -49,11 +49,11 @@ void main() {
...
@@ -49,11 +49,11 @@ void main() {
testWidgets
(
'CheckboxThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'CheckboxThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
CheckboxThemeData
(
const
CheckboxThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
SystemMouseCursors
.
click
),
mouseCursor:
MaterialStateProperty
All
<
MouseCursor
?>
(
SystemMouseCursors
.
click
),
fillColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff0
)),
fillColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff0
)),
checkColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff1
)),
checkColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff1
)),
overlayColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff2
)),
overlayColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff2
)),
splashRadius:
1.0
,
splashRadius:
1.0
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
visualDensity:
VisualDensity
.
standard
,
visualDensity:
VisualDensity
.
standard
,
...
@@ -64,10 +64,10 @@ void main() {
...
@@ -64,10 +64,10 @@ void main() {
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
.
toList
();
expect
(
description
[
0
],
'mouseCursor: MaterialStateProperty
.a
ll(SystemMouseCursor(click))'
);
expect
(
description
[
0
],
'mouseCursor: MaterialStateProperty
A
ll(SystemMouseCursor(click))'
);
expect
(
description
[
1
],
'fillColor: MaterialStateProperty
.a
ll(Color(0xfffffff0))'
);
expect
(
description
[
1
],
'fillColor: MaterialStateProperty
A
ll(Color(0xfffffff0))'
);
expect
(
description
[
2
],
'checkColor: MaterialStateProperty
.a
ll(Color(0xfffffff1))'
);
expect
(
description
[
2
],
'checkColor: MaterialStateProperty
A
ll(Color(0xfffffff1))'
);
expect
(
description
[
3
],
'overlayColor: MaterialStateProperty
.a
ll(Color(0xfffffff2))'
);
expect
(
description
[
3
],
'overlayColor: MaterialStateProperty
A
ll(Color(0xfffffff2))'
);
expect
(
description
[
4
],
'splashRadius: 1.0'
);
expect
(
description
[
4
],
'splashRadius: 1.0'
);
expect
(
description
[
5
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
5
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
6
],
equalsIgnoringHashCodes
(
'visualDensity: VisualDensity#00000(h: 0.0, v: 0.0)'
));
expect
(
description
[
6
],
equalsIgnoringHashCodes
(
'visualDensity: VisualDensity#00000(h: 0.0, v: 0.0)'
));
...
@@ -91,7 +91,7 @@ void main() {
...
@@ -91,7 +91,7 @@ void main() {
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
checkboxTheme:
CheckboxThemeData
(
checkboxTheme:
CheckboxThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
mouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
?>
(
mouseCursor
),
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
return
selectedFillColor
;
return
selectedFillColor
;
...
@@ -182,14 +182,14 @@ void main() {
...
@@ -182,14 +182,14 @@ void main() {
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
checkboxTheme:
CheckboxThemeData
(
checkboxTheme:
CheckboxThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
themeMouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
?>
(
themeMouseCursor
),
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
return
themeSelectedFillColor
;
return
themeSelectedFillColor
;
}
}
return
themeDefaultFillColor
;
return
themeDefaultFillColor
;
}),
}),
checkColor:
MaterialStateProperty
.
all
(
themeCheckColor
),
checkColor:
const
MaterialStatePropertyAll
<
Color
?>
(
themeCheckColor
),
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
return
themeFocusOverlayColor
;
return
themeFocusOverlayColor
;
...
@@ -361,16 +361,16 @@ void main() {
...
@@ -361,16 +361,16 @@ void main() {
Widget
buildCheckbox
({
required
bool
active
})
{
Widget
buildCheckbox
({
required
bool
active
})
{
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
checkboxTheme:
CheckboxThemeData
(
checkboxTheme:
const
CheckboxThemeData
(
checkColor:
MaterialStateProperty
.
a
ll
<
Color
>(
globalThemeCheckColor
),
checkColor:
MaterialStateProperty
A
ll
<
Color
>(
globalThemeCheckColor
),
fillColor:
MaterialStateProperty
.
a
ll
<
Color
>(
globalThemeFillColor
),
fillColor:
MaterialStateProperty
A
ll
<
Color
>(
globalThemeFillColor
),
),
),
),
),
home:
Scaffold
(
home:
Scaffold
(
body:
CheckboxTheme
(
body:
CheckboxTheme
(
data:
CheckboxThemeData
(
data:
const
CheckboxThemeData
(
fillColor:
MaterialStateProperty
.
a
ll
<
Color
>(
localThemeFillColor
),
fillColor:
MaterialStateProperty
A
ll
<
Color
>(
localThemeFillColor
),
checkColor:
MaterialStateProperty
.
a
ll
<
Color
>(
localThemeCheckColor
),
checkColor:
MaterialStateProperty
A
ll
<
Color
>(
localThemeCheckColor
),
),
),
child:
Checkbox
(
child:
Checkbox
(
value:
active
,
value:
active
,
...
...
packages/flutter/test/material/data_table_test.dart
View file @
17e2fce1
...
@@ -1412,9 +1412,9 @@ void main() {
...
@@ -1412,9 +1412,9 @@ void main() {
const
Color
checkColor
=
Color
(
0xFF0000FF
);
const
Color
checkColor
=
Color
(
0xFF0000FF
);
final
ThemeData
themeData
=
ThemeData
(
final
ThemeData
themeData
=
ThemeData
(
checkboxTheme:
CheckboxThemeData
(
checkboxTheme:
const
CheckboxThemeData
(
fillColor:
MaterialStateProperty
.
all
(
fillColor
),
fillColor:
MaterialStateProperty
All
<
Color
?>
(
fillColor
),
checkColor:
MaterialStateProperty
.
all
(
checkColor
),
checkColor:
MaterialStateProperty
All
<
Color
?>
(
checkColor
),
),
),
);
);
Widget
buildTable
()
{
Widget
buildTable
()
{
...
...
packages/flutter/test/material/data_table_theme_test.dart
View file @
17e2fce1
...
@@ -92,10 +92,10 @@ void main() {
...
@@ -92,10 +92,10 @@ void main() {
testWidgets
(
'DataTable is themeable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'DataTable is themeable'
,
(
WidgetTester
tester
)
async
{
const
BoxDecoration
decoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
const
BoxDecoration
decoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
final
MaterialStateProperty
<
Color
>
dataRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
dataRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
const
double
dataRowHeight
=
51.0
;
const
double
dataRowHeight
=
51.0
;
const
TextStyle
dataTextStyle
=
TextStyle
(
fontSize:
12.5
);
const
TextStyle
dataTextStyle
=
TextStyle
(
fontSize:
12.5
);
final
MaterialStateProperty
<
Color
>
headingRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff2
));
const
MaterialStateProperty
<
Color
>
headingRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff2
));
const
double
headingRowHeight
=
52.0
;
const
double
headingRowHeight
=
52.0
;
const
TextStyle
headingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
TextStyle
headingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
double
horizontalMargin
=
3.0
;
const
double
horizontalMargin
=
3.0
;
...
@@ -105,7 +105,7 @@ void main() {
...
@@ -105,7 +105,7 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
dataTableTheme:
DataTableThemeData
(
dataTableTheme:
const
DataTableThemeData
(
decoration:
decoration
,
decoration:
decoration
,
dataRowColor:
dataRowColor
,
dataRowColor:
dataRowColor
,
dataRowHeight:
dataRowHeight
,
dataRowHeight:
dataRowHeight
,
...
@@ -159,10 +159,10 @@ void main() {
...
@@ -159,10 +159,10 @@ void main() {
testWidgets
(
'DataTable properties are taken over the theme values'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'DataTable properties are taken over the theme values'
,
(
WidgetTester
tester
)
async
{
const
BoxDecoration
themeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff1
));
const
BoxDecoration
themeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff1
));
final
MaterialStateProperty
<
Color
>
themeDataRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff0
));
const
MaterialStateProperty
<
Color
>
themeDataRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff0
));
const
double
themeDataRowHeight
=
50.0
;
const
double
themeDataRowHeight
=
50.0
;
const
TextStyle
themeDataTextStyle
=
TextStyle
(
fontSize:
11.5
);
const
TextStyle
themeDataTextStyle
=
TextStyle
(
fontSize:
11.5
);
final
MaterialStateProperty
<
Color
>
themeHeadingRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
themeHeadingRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
const
double
themeHeadingRowHeight
=
51.0
;
const
double
themeHeadingRowHeight
=
51.0
;
const
TextStyle
themeHeadingTextStyle
=
TextStyle
(
fontSize:
13.5
);
const
TextStyle
themeHeadingTextStyle
=
TextStyle
(
fontSize:
13.5
);
const
double
themeHorizontalMargin
=
2.0
;
const
double
themeHorizontalMargin
=
2.0
;
...
@@ -170,10 +170,10 @@ void main() {
...
@@ -170,10 +170,10 @@ void main() {
const
double
themeDividerThickness
=
4.0
;
const
double
themeDividerThickness
=
4.0
;
const
BoxDecoration
decoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
const
BoxDecoration
decoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
final
MaterialStateProperty
<
Color
>
dataRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
dataRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
const
double
dataRowHeight
=
51.0
;
const
double
dataRowHeight
=
51.0
;
const
TextStyle
dataTextStyle
=
TextStyle
(
fontSize:
12.5
);
const
TextStyle
dataTextStyle
=
TextStyle
(
fontSize:
12.5
);
final
MaterialStateProperty
<
Color
>
headingRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff2
));
const
MaterialStateProperty
<
Color
>
headingRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff2
));
const
double
headingRowHeight
=
52.0
;
const
double
headingRowHeight
=
52.0
;
const
TextStyle
headingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
TextStyle
headingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
double
horizontalMargin
=
3.0
;
const
double
horizontalMargin
=
3.0
;
...
@@ -182,7 +182,7 @@ void main() {
...
@@ -182,7 +182,7 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
dataTableTheme:
DataTableThemeData
(
dataTableTheme:
const
DataTableThemeData
(
decoration:
themeDecoration
,
decoration:
themeDecoration
,
dataRowColor:
themeDataRowColor
,
dataRowColor:
themeDataRowColor
,
dataRowHeight:
themeDataRowHeight
,
dataRowHeight:
themeDataRowHeight
,
...
@@ -246,10 +246,10 @@ void main() {
...
@@ -246,10 +246,10 @@ void main() {
testWidgets
(
'Local DataTableTheme can override global DataTableTheme'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Local DataTableTheme can override global DataTableTheme'
,
(
WidgetTester
tester
)
async
{
const
BoxDecoration
globalThemeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff1
));
const
BoxDecoration
globalThemeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff1
));
final
MaterialStateProperty
<
Color
>
globalThemeDataRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff0
));
const
MaterialStateProperty
<
Color
>
globalThemeDataRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff0
));
const
double
globalThemeDataRowHeight
=
50.0
;
const
double
globalThemeDataRowHeight
=
50.0
;
const
TextStyle
globalThemeDataTextStyle
=
TextStyle
(
fontSize:
11.5
);
const
TextStyle
globalThemeDataTextStyle
=
TextStyle
(
fontSize:
11.5
);
final
MaterialStateProperty
<
Color
>
globalThemeHeadingRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
globalThemeHeadingRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
const
double
globalThemeHeadingRowHeight
=
51.0
;
const
double
globalThemeHeadingRowHeight
=
51.0
;
const
TextStyle
globalThemeHeadingTextStyle
=
TextStyle
(
fontSize:
13.5
);
const
TextStyle
globalThemeHeadingTextStyle
=
TextStyle
(
fontSize:
13.5
);
const
double
globalThemeHorizontalMargin
=
2.0
;
const
double
globalThemeHorizontalMargin
=
2.0
;
...
@@ -257,10 +257,10 @@ void main() {
...
@@ -257,10 +257,10 @@ void main() {
const
double
globalThemeDividerThickness
=
4.0
;
const
double
globalThemeDividerThickness
=
4.0
;
const
BoxDecoration
localThemeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
const
BoxDecoration
localThemeDecoration
=
BoxDecoration
(
color:
Color
(
0xfffffff0
));
final
MaterialStateProperty
<
Color
>
localThemeDataRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff1
));
const
MaterialStateProperty
<
Color
>
localThemeDataRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff1
));
const
double
localThemeDataRowHeight
=
51.0
;
const
double
localThemeDataRowHeight
=
51.0
;
const
TextStyle
localThemeDataTextStyle
=
TextStyle
(
fontSize:
12.5
);
const
TextStyle
localThemeDataTextStyle
=
TextStyle
(
fontSize:
12.5
);
final
MaterialStateProperty
<
Color
>
localThemeHeadingRowColor
=
MaterialStateProperty
.
all
<
Color
>(
const
Color
(
0xfffffff2
));
const
MaterialStateProperty
<
Color
>
localThemeHeadingRowColor
=
MaterialStatePropertyAll
<
Color
>(
Color
(
0xfffffff2
));
const
double
localThemeHeadingRowHeight
=
52.0
;
const
double
localThemeHeadingRowHeight
=
52.0
;
const
TextStyle
localThemeHeadingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
TextStyle
localThemeHeadingTextStyle
=
TextStyle
(
fontSize:
14.5
);
const
double
localThemeHorizontalMargin
=
3.0
;
const
double
localThemeHorizontalMargin
=
3.0
;
...
@@ -270,7 +270,7 @@ void main() {
...
@@ -270,7 +270,7 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
dataTableTheme:
DataTableThemeData
(
dataTableTheme:
const
DataTableThemeData
(
decoration:
globalThemeDecoration
,
decoration:
globalThemeDecoration
,
dataRowColor:
globalThemeDataRowColor
,
dataRowColor:
globalThemeDataRowColor
,
dataRowHeight:
globalThemeDataRowHeight
,
dataRowHeight:
globalThemeDataRowHeight
,
...
@@ -285,7 +285,7 @@ void main() {
...
@@ -285,7 +285,7 @@ void main() {
),
),
home:
Scaffold
(
home:
Scaffold
(
body:
DataTableTheme
(
body:
DataTableTheme
(
data:
DataTableThemeData
(
data:
const
DataTableThemeData
(
decoration:
localThemeDecoration
,
decoration:
localThemeDecoration
,
dataRowColor:
localThemeDataRowColor
,
dataRowColor:
localThemeDataRowColor
,
dataRowHeight:
localThemeDataRowHeight
,
dataRowHeight:
localThemeDataRowHeight
,
...
...
packages/flutter/test/material/elevated_button_test.dart
View file @
17e2fce1
...
@@ -689,11 +689,11 @@ void main() {
...
@@ -689,11 +689,11 @@ void main() {
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
ElevatedButton
(
child:
ElevatedButton
(
style:
ButtonStyle
(
style:
const
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the semantics tree's rect and transform
// RaisedButton so that the semantics tree's rect and transform
// match the original version of this test.
// match the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
),
),
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
...
@@ -728,11 +728,11 @@ void main() {
...
@@ -728,11 +728,11 @@ void main() {
});
});
testWidgets
(
'ElevatedButton size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ElevatedButton size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
final
ButtonStyle
style
=
ButtonStyle
(
const
ButtonStyle
style
=
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
);
);
Widget
buildFrame
(
MaterialTapTargetSize
tapTargetSize
,
Key
key
)
{
Widget
buildFrame
(
MaterialTapTargetSize
tapTargetSize
,
Key
key
)
{
...
@@ -797,7 +797,7 @@ void main() {
...
@@ -797,7 +797,7 @@ void main() {
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
const
MaterialStatePropertyAll
<
Size
>(
Size
(
88
,
36
)),
),
),
key:
key
,
key:
key
,
onPressed:
()
{},
onPressed:
()
{},
...
@@ -861,8 +861,8 @@ void main() {
...
@@ -861,8 +861,8 @@ void main() {
child:
Center
(
child:
Center
(
child:
ElevatedButton
.
icon
(
child:
ElevatedButton
.
icon
(
key:
buttonKey
,
key:
buttonKey
,
style:
ButtonStyle
(
style:
const
ButtonStyle
(
padding:
MaterialStateProperty
.
all
<
EdgeInsets
>(
const
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
)),
padding:
MaterialStateProperty
All
<
EdgeInsets
>(
EdgeInsets
.
fromLTRB
(
16
,
5
,
10
,
12
)),
),
),
onPressed:
()
{},
onPressed:
()
{},
icon:
const
Icon
(
Icons
.
add
),
icon:
const
Icon
(
Icons
.
add
),
...
...
packages/flutter/test/material/material_state_property_test.dart
View file @
17e2fce1
...
@@ -30,4 +30,16 @@ void main() {
...
@@ -30,4 +30,16 @@ void main() {
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
disabled
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
disabled
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
error
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
error
}),
123
);
});
});
test
(
'MaterialStatePropertyAll'
,
()
{
const
MaterialStatePropertyAll
<
int
>
value
=
MaterialStatePropertyAll
<
int
>(
123
);
expect
(
value
.
resolve
(<
MaterialState
>{}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
hovered
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
focused
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
pressed
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
dragged
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
selected
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
disabled
}),
123
);
expect
(
value
.
resolve
(<
MaterialState
>{
MaterialState
.
error
}),
123
);
});
}
}
packages/flutter/test/material/navigation_bar_theme_test.dart
View file @
17e2fce1
...
@@ -26,14 +26,14 @@ void main() {
...
@@ -26,14 +26,14 @@ void main() {
testWidgets
(
'Custom debugFillProperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Custom debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
NavigationBarThemeData
(
const
NavigationBarThemeData
(
height:
200.0
,
height:
200.0
,
backgroundColor:
const
Color
(
0x00000099
),
backgroundColor:
Color
(
0x00000099
),
elevation:
20.0
,
elevation:
20.0
,
indicatorColor:
const
Color
(
0x00000098
),
indicatorColor:
Color
(
0x00000098
),
indicatorShape:
const
CircleBorder
(),
indicatorShape:
CircleBorder
(),
labelTextStyle:
MaterialStateProperty
.
all
(
const
TextStyle
(
fontSize:
7.0
)),
labelTextStyle:
MaterialStateProperty
All
<
TextStyle
>(
TextStyle
(
fontSize:
7.0
)),
iconTheme:
MaterialStateProperty
.
all
(
const
IconThemeData
(
color:
Color
(
0x00000097
))),
iconTheme:
MaterialStateProperty
All
<
IconThemeData
>(
IconThemeData
(
color:
Color
(
0x00000097
))),
labelBehavior:
NavigationDestinationLabelBehavior
.
alwaysHide
,
labelBehavior:
NavigationDestinationLabelBehavior
.
alwaysHide
,
).
debugFillProperties
(
builder
);
).
debugFillProperties
(
builder
);
...
@@ -47,10 +47,10 @@ void main() {
...
@@ -47,10 +47,10 @@ void main() {
expect
(
description
[
2
],
'elevation: 20.0'
);
expect
(
description
[
2
],
'elevation: 20.0'
);
expect
(
description
[
3
],
'indicatorColor: Color(0x00000098)'
);
expect
(
description
[
3
],
'indicatorColor: Color(0x00000098)'
);
expect
(
description
[
4
],
'indicatorShape: CircleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none))'
);
expect
(
description
[
4
],
'indicatorShape: CircleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none))'
);
expect
(
description
[
5
],
'labelTextStyle: MaterialStateProperty
.a
ll(TextStyle(inherit: true, size: 7.0))'
);
expect
(
description
[
5
],
'labelTextStyle: MaterialStateProperty
A
ll(TextStyle(inherit: true, size: 7.0))'
);
// Ignore instance address for IconThemeData.
// Ignore instance address for IconThemeData.
expect
(
description
[
6
].
contains
(
'iconTheme: MaterialStateProperty
.a
ll(IconThemeData'
),
isTrue
);
expect
(
description
[
6
].
contains
(
'iconTheme: MaterialStateProperty
A
ll(IconThemeData'
),
isTrue
);
expect
(
description
[
6
].
contains
(
'(color: Color(0x00000097))'
),
isTrue
);
expect
(
description
[
6
].
contains
(
'(color: Color(0x00000097))'
),
isTrue
);
expect
(
description
[
7
],
'labelBehavior: NavigationDestinationLabelBehavior.alwaysHide'
);
expect
(
description
[
7
],
'labelBehavior: NavigationDestinationLabelBehavior.alwaysHide'
);
...
...
packages/flutter/test/material/outlined_button_test.dart
View file @
17e2fce1
...
@@ -922,11 +922,11 @@ void main() {
...
@@ -922,11 +922,11 @@ void main() {
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
const
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
),
),
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
...
@@ -971,11 +971,11 @@ void main() {
...
@@ -971,11 +971,11 @@ void main() {
data:
const
MediaQueryData
(),
data:
const
MediaQueryData
(),
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
const
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
),
),
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
...
@@ -1000,11 +1000,11 @@ void main() {
...
@@ -1000,11 +1000,11 @@ void main() {
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
data:
const
MediaQueryData
(
textScaleFactor:
1.3
),
child:
Center
(
child:
Center
(
child:
OutlinedButton
(
child:
OutlinedButton
(
style:
ButtonStyle
(
style:
const
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the corresponding button size matches
// RaisedButton so that the corresponding button size matches
// the original version of this test.
// the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
),
),
onPressed:
()
{},
onPressed:
()
{},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
...
...
packages/flutter/test/material/radio_test.dart
View file @
17e2fce1
...
@@ -997,7 +997,7 @@ void main() {
...
@@ -997,7 +997,7 @@ void main() {
value:
active
,
value:
active
,
groupValue:
true
,
groupValue:
true
,
onChanged:
(
_
)
{
},
onChanged:
(
_
)
{
},
fillColor:
MaterialStateProperty
.
all
(
fillColor
),
fillColor:
const
MaterialStatePropertyAll
<
Color
>
(
fillColor
),
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
hoverColor:
hoverColor
,
hoverColor:
hoverColor
,
focusColor:
focusColor
,
focusColor:
focusColor
,
...
...
packages/flutter/test/material/radio_theme_test.dart
View file @
17e2fce1
...
@@ -47,10 +47,10 @@ void main() {
...
@@ -47,10 +47,10 @@ void main() {
testWidgets
(
'RadioThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'RadioThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
RadioThemeData
(
const
RadioThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
SystemMouseCursors
.
click
),
mouseCursor:
MaterialStateProperty
All
<
MouseCursor
>
(
SystemMouseCursors
.
click
),
fillColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff0
)),
fillColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff0
)),
overlayColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff1
)),
overlayColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff1
)),
splashRadius:
1.0
,
splashRadius:
1.0
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
visualDensity:
VisualDensity
.
standard
,
visualDensity:
VisualDensity
.
standard
,
...
@@ -61,9 +61,9 @@ void main() {
...
@@ -61,9 +61,9 @@ void main() {
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
.
toList
();
expect
(
description
[
0
],
'mouseCursor: MaterialStateProperty
.a
ll(SystemMouseCursor(click))'
);
expect
(
description
[
0
],
'mouseCursor: MaterialStateProperty
A
ll(SystemMouseCursor(click))'
);
expect
(
description
[
1
],
'fillColor: MaterialStateProperty
.a
ll(Color(0xfffffff0))'
);
expect
(
description
[
1
],
'fillColor: MaterialStateProperty
A
ll(Color(0xfffffff0))'
);
expect
(
description
[
2
],
'overlayColor: MaterialStateProperty
.a
ll(Color(0xfffffff1))'
);
expect
(
description
[
2
],
'overlayColor: MaterialStateProperty
A
ll(Color(0xfffffff1))'
);
expect
(
description
[
3
],
'splashRadius: 1.0'
);
expect
(
description
[
3
],
'splashRadius: 1.0'
);
expect
(
description
[
4
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
4
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
5
],
equalsIgnoringHashCodes
(
'visualDensity: VisualDensity#00000(h: 0.0, v: 0.0)'
));
expect
(
description
[
5
],
equalsIgnoringHashCodes
(
'visualDensity: VisualDensity#00000(h: 0.0, v: 0.0)'
));
...
@@ -85,7 +85,7 @@ void main() {
...
@@ -85,7 +85,7 @@ void main() {
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
radioTheme:
RadioThemeData
(
radioTheme:
RadioThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
mouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
>
(
mouseCursor
),
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
return
selectedFillColor
;
return
selectedFillColor
;
...
@@ -167,7 +167,7 @@ void main() {
...
@@ -167,7 +167,7 @@ void main() {
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
radioTheme:
RadioThemeData
(
radioTheme:
RadioThemeData
(
mouseCursor:
MaterialStateProperty
.
all
(
themeMouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
>
(
themeMouseCursor
),
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
fillColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
if
(
states
.
contains
(
MaterialState
.
selected
))
{
return
themeSelectedFillColor
;
return
themeSelectedFillColor
;
...
@@ -346,14 +346,14 @@ void main() {
...
@@ -346,14 +346,14 @@ void main() {
Widget
buildRadio
({
required
bool
active
})
{
Widget
buildRadio
({
required
bool
active
})
{
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
radioTheme:
RadioThemeData
(
radioTheme:
const
RadioThemeData
(
fillColor:
MaterialStateProperty
.
a
ll
<
Color
>(
globalThemeFillColor
),
fillColor:
MaterialStateProperty
A
ll
<
Color
>(
globalThemeFillColor
),
),
),
),
),
home:
Scaffold
(
home:
Scaffold
(
body:
RadioTheme
(
body:
RadioTheme
(
data:
RadioThemeData
(
data:
const
RadioThemeData
(
fillColor:
MaterialStateProperty
.
a
ll
<
Color
>(
localThemeFillColor
),
fillColor:
MaterialStateProperty
A
ll
<
Color
>(
localThemeFillColor
),
),
),
child:
Radio
<
int
>(
child:
Radio
<
int
>(
value:
active
?
1
:
0
,
value:
active
?
1
:
0
,
...
...
packages/flutter/test/material/slider_theme_test.dart
View file @
17e2fce1
...
@@ -1248,7 +1248,7 @@ void main() {
...
@@ -1248,7 +1248,7 @@ void main() {
testWidgets
(
'The mouse cursor is themeable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'The mouse cursor is themeable'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_buildApp
(
await
tester
.
pumpWidget
(
_buildApp
(
ThemeData
().
sliderTheme
.
copyWith
(
ThemeData
().
sliderTheme
.
copyWith
(
mouseCursor:
MaterialStateProperty
.
all
(
SystemMouseCursors
.
text
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
>
(
SystemMouseCursors
.
text
),
)
)
));
));
...
...
packages/flutter/test/material/switch_test.dart
View file @
17e2fce1
...
@@ -1589,7 +1589,7 @@ void main() {
...
@@ -1589,7 +1589,7 @@ void main() {
autofocus:
focused
,
autofocus:
focused
,
value:
active
,
value:
active
,
onChanged:
(
_
)
{
},
onChanged:
(
_
)
{
},
thumbColor:
MaterialStateProperty
.
all
(
thumbColor
),
thumbColor:
const
MaterialStatePropertyAll
<
Color
>
(
thumbColor
),
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
overlayColor:
useOverlay
?
MaterialStateProperty
.
resolveWith
(
getOverlayColor
)
:
null
,
hoverColor:
hoverColor
,
hoverColor:
hoverColor
,
focusColor:
focusColor
,
focusColor:
focusColor
,
...
...
packages/flutter/test/material/switch_theme_test.dart
View file @
17e2fce1
...
@@ -47,12 +47,12 @@ void main() {
...
@@ -47,12 +47,12 @@ void main() {
testWidgets
(
'SwitchThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'SwitchThemeData implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
SwitchThemeData
(
const
SwitchThemeData
(
thumbColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff0
)),
thumbColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff0
)),
trackColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff1
)),
trackColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff1
)),
mouseCursor:
MaterialStateProperty
.
all
(
SystemMouseCursors
.
click
),
mouseCursor:
MaterialStateProperty
All
<
MouseCursor
>
(
SystemMouseCursors
.
click
),
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
overlayColor:
MaterialStateProperty
.
all
(
const
Color
(
0xfffffff2
)),
overlayColor:
MaterialStateProperty
All
<
Color
>(
Color
(
0xfffffff2
)),
splashRadius:
1.0
,
splashRadius:
1.0
,
).
debugFillProperties
(
builder
);
).
debugFillProperties
(
builder
);
...
@@ -61,11 +61,11 @@ void main() {
...
@@ -61,11 +61,11 @@ void main() {
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
.
toList
();
expect
(
description
[
0
],
'thumbColor: MaterialStateProperty
.a
ll(Color(0xfffffff0))'
);
expect
(
description
[
0
],
'thumbColor: MaterialStateProperty
A
ll(Color(0xfffffff0))'
);
expect
(
description
[
1
],
'trackColor: MaterialStateProperty
.a
ll(Color(0xfffffff1))'
);
expect
(
description
[
1
],
'trackColor: MaterialStateProperty
A
ll(Color(0xfffffff1))'
);
expect
(
description
[
2
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
2
],
'materialTapTargetSize: MaterialTapTargetSize.shrinkWrap'
);
expect
(
description
[
3
],
'mouseCursor: MaterialStateProperty
.a
ll(SystemMouseCursor(click))'
);
expect
(
description
[
3
],
'mouseCursor: MaterialStateProperty
A
ll(SystemMouseCursor(click))'
);
expect
(
description
[
4
],
'overlayColor: MaterialStateProperty
.a
ll(Color(0xfffffff2))'
);
expect
(
description
[
4
],
'overlayColor: MaterialStateProperty
A
ll(Color(0xfffffff2))'
);
expect
(
description
[
5
],
'splashRadius: 1.0'
);
expect
(
description
[
5
],
'splashRadius: 1.0'
);
});
});
...
@@ -98,7 +98,7 @@ void main() {
...
@@ -98,7 +98,7 @@ void main() {
}
}
return
defaultTrackColor
;
return
defaultTrackColor
;
}),
}),
mouseCursor:
MaterialStateProperty
.
all
(
mouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
>
(
mouseCursor
),
materialTapTargetSize:
materialTapTargetSize
,
materialTapTargetSize:
materialTapTargetSize
,
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
...
@@ -203,7 +203,7 @@ void main() {
...
@@ -203,7 +203,7 @@ void main() {
}
}
return
themeDefaultTrackColor
;
return
themeDefaultTrackColor
;
}),
}),
mouseCursor:
MaterialStateProperty
.
all
(
themeMouseCursor
),
mouseCursor:
const
MaterialStatePropertyAll
<
MouseCursor
>
(
themeMouseCursor
),
materialTapTargetSize:
themeMaterialTapTargetSize
,
materialTapTargetSize:
themeMaterialTapTargetSize
,
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
overlayColor:
MaterialStateProperty
.
resolveWith
((
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
if
(
states
.
contains
(
MaterialState
.
focused
))
{
...
@@ -429,16 +429,16 @@ void main() {
...
@@ -429,16 +429,16 @@ void main() {
Widget
buildSwitch
({
bool
selected
=
false
,
bool
autofocus
=
false
})
{
Widget
buildSwitch
({
bool
selected
=
false
,
bool
autofocus
=
false
})
{
return
MaterialApp
(
return
MaterialApp
(
theme:
ThemeData
(
theme:
ThemeData
(
switchTheme:
SwitchThemeData
(
switchTheme:
const
SwitchThemeData
(
thumbColor:
MaterialStateProperty
.
a
ll
<
Color
>(
globalThemeThumbColor
),
thumbColor:
MaterialStateProperty
A
ll
<
Color
>(
globalThemeThumbColor
),
trackColor:
MaterialStateProperty
.
a
ll
<
Color
>(
globalThemeTrackColor
),
trackColor:
MaterialStateProperty
A
ll
<
Color
>(
globalThemeTrackColor
),
),
),
),
),
home:
Scaffold
(
home:
Scaffold
(
body:
SwitchTheme
(
body:
SwitchTheme
(
data:
SwitchThemeData
(
data:
const
SwitchThemeData
(
thumbColor:
MaterialStateProperty
.
a
ll
<
Color
>(
localThemeThumbColor
),
thumbColor:
MaterialStateProperty
A
ll
<
Color
>(
localThemeThumbColor
),
trackColor:
MaterialStateProperty
.
a
ll
<
Color
>(
localThemeTrackColor
),
trackColor:
MaterialStateProperty
A
ll
<
Color
>(
localThemeTrackColor
),
),
),
child:
Switch
(
child:
Switch
(
value:
selected
,
value:
selected
,
...
...
packages/flutter/test/material/text_button_test.dart
View file @
17e2fce1
...
@@ -492,11 +492,11 @@ void main() {
...
@@ -492,11 +492,11 @@ void main() {
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
Center
(
child:
TextButton
(
child:
TextButton
(
style:
ButtonStyle
(
style:
const
ButtonStyle
(
// Specifying minimumSize to mimic the original minimumSize for
// Specifying minimumSize to mimic the original minimumSize for
// RaisedButton so that the semantics tree's rect and transform
// RaisedButton so that the semantics tree's rect and transform
// match the original version of this test.
// match the original version of this test.
minimumSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
88
,
36
)),
minimumSize:
MaterialStateProperty
All
<
Size
>(
Size
(
88
,
36
)),
),
),
onPressed:
()
{
},
onPressed:
()
{
},
child:
const
Text
(
'ABC'
),
child:
const
Text
(
'ABC'
),
...
...
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