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
4c104eff
Unverified
Commit
4c104eff
authored
Jul 27, 2022
by
Darren Austin
Committed by
GitHub
Jul 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed references to deprecated styleFrom parameters. (#108401)
parent
7e683c02
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
77 additions
and
68 deletions
+77
-68
button_style.dart
packages/flutter/lib/src/material/button_style.dart
+2
-2
desktop_text_selection.dart
...ages/flutter/lib/src/material/desktop_text_selection.dart
+2
-2
elevated_button.dart
packages/flutter/lib/src/material/elevated_button.dart
+16
-9
outlined_button.dart
packages/flutter/lib/src/material/outlined_button.dart
+7
-7
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+1
-1
stepper.dart
packages/flutter/lib/src/material/stepper.dart
+1
-1
text_button.dart
packages/flutter/lib/src/material/text_button.dart
+7
-8
text_selection_toolbar_text_button.dart
.../lib/src/material/text_selection_toolbar_text_button.dart
+2
-2
elevated_button_theme_test.dart
...ges/flutter/test/material/elevated_button_theme_test.dart
+12
-11
outlined_button_test.dart
packages/flutter/test/material/outlined_button_test.dart
+3
-3
outlined_button_theme_test.dart
...ges/flutter/test/material/outlined_button_theme_test.dart
+9
-8
snack_bar_test.dart
packages/flutter/test/material/snack_bar_test.dart
+3
-3
text_button_theme_test.dart
packages/flutter/test/material/text_button_theme_test.dart
+9
-8
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+3
-3
No files found.
packages/flutter/lib/src/material/button_style.dart
View file @
4c104eff
...
@@ -75,7 +75,7 @@ import 'theme_data.dart';
...
@@ -75,7 +75,7 @@ import 'theme_data.dart';
///
///
/// ```dart
/// ```dart
/// TextButton(
/// TextButton(
/// style: TextButton.styleFrom(
primary
: Colors.green),
/// style: TextButton.styleFrom(
foregroundColor
: Colors.green),
/// )
/// )
/// ```
/// ```
///
///
...
@@ -85,7 +85,7 @@ import 'theme_data.dart';
...
@@ -85,7 +85,7 @@ import 'theme_data.dart';
/// MaterialApp(
/// MaterialApp(
/// theme: ThemeData(
/// theme: ThemeData(
/// textButtonTheme: TextButtonThemeData(
/// textButtonTheme: TextButtonThemeData(
/// style: TextButton.styleFrom(
primary
: Colors.green),
/// style: TextButton.styleFrom(
foregroundColor
: Colors.green),
/// ),
/// ),
/// ),
/// ),
/// home: MyAppHome(),
/// home: MyAppHome(),
...
...
packages/flutter/lib/src/material/desktop_text_selection.dart
View file @
4c104eff
...
@@ -325,7 +325,7 @@ class _DesktopTextSelectionToolbarButton extends StatelessWidget {
...
@@ -325,7 +325,7 @@ class _DesktopTextSelectionToolbarButton extends StatelessWidget {
// TODO(hansmuller): Should be colorScheme.onSurface
// TODO(hansmuller): Should be colorScheme.onSurface
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
bool
isDark
=
theme
.
colorScheme
.
brightness
==
Brightness
.
dark
;
final
bool
isDark
=
theme
.
colorScheme
.
brightness
==
Brightness
.
dark
;
final
Color
primary
=
isDark
?
Colors
.
white
:
Colors
.
black87
;
final
Color
foregroundColor
=
isDark
?
Colors
.
white
:
Colors
.
black87
;
return
SizedBox
(
return
SizedBox
(
width:
double
.
infinity
,
width:
double
.
infinity
,
...
@@ -334,7 +334,7 @@ class _DesktopTextSelectionToolbarButton extends StatelessWidget {
...
@@ -334,7 +334,7 @@ class _DesktopTextSelectionToolbarButton extends StatelessWidget {
alignment:
Alignment
.
centerLeft
,
alignment:
Alignment
.
centerLeft
,
enabledMouseCursor:
SystemMouseCursors
.
basic
,
enabledMouseCursor:
SystemMouseCursors
.
basic
,
disabledMouseCursor:
SystemMouseCursors
.
basic
,
disabledMouseCursor:
SystemMouseCursors
.
basic
,
primary:
primary
,
foregroundColor:
foregroundColor
,
shape:
const
RoundedRectangleBorder
(),
shape:
const
RoundedRectangleBorder
(),
minimumSize:
const
Size
(
kMinInteractiveDimension
,
36.0
),
minimumSize:
const
Size
(
kMinInteractiveDimension
,
36.0
),
padding:
_kToolbarButtonPadding
,
padding:
_kToolbarButtonPadding
,
...
...
packages/flutter/lib/src/material/elevated_button.dart
View file @
4c104eff
...
@@ -100,14 +100,12 @@ class ElevatedButton extends ButtonStyleButton {
...
@@ -100,14 +100,12 @@ class ElevatedButton extends ButtonStyleButton {
/// A static convenience method that constructs an elevated button
/// A static convenience method that constructs an elevated button
/// [ButtonStyle] given simple values.
/// [ButtonStyle] given simple values.
///
///
/// The [onPrimary], and [onSurface] colors are used to create a
/// The [foregroundColor] and [disabledForegroundColor] colors are used
/// [MaterialStateProperty] [ButtonStyle.foregroundColor] value in the same
/// to create a [MaterialStateProperty] [ButtonStyle.foregroundColor], and
/// way that [defaultStyleOf] uses the [ColorScheme] colors with the same
/// a derived [ButtonStyle.overlayColor].
/// names. Specify a value for [onPrimary] to specify the color of the
///
/// button's text and icons as well as the overlay colors used to indicate the
/// The [backgroundColor] and [disabledBackgroundColor] colors are
/// hover, focus, and pressed states. Use [primary] for the button's background
/// used to create a [MaterialStateProperty] [ButtonStyle.backgroundColor].
/// fill color and [onSurface] to specify the button's disabled text, icon,
/// and fill color.
///
///
/// The button's elevations are defined relative to the [elevation]
/// The button's elevations are defined relative to the [elevation]
/// parameter. The disabled elevation is the same as the parameter
/// parameter. The disabled elevation is the same as the parameter
...
@@ -131,9 +129,18 @@ class ElevatedButton extends ButtonStyleButton {
...
@@ -131,9 +129,18 @@ class ElevatedButton extends ButtonStyleButton {
///
///
/// ```dart
/// ```dart
/// ElevatedButton(
/// ElevatedButton(
/// style: ElevatedButton.styleFrom(primary: Colors.green),
/// style: ElevatedButton.styleFrom(foregroundColor: Colors.green),
/// )
/// ```
///
/// And to change the fill color:
///
/// ```dart
/// ElevatedButton(
/// style: ElevatedButton.styleFrom(backgroundColor: Colors.green),
/// )
/// )
/// ```
/// ```
///
static
ButtonStyle
styleFrom
({
static
ButtonStyle
styleFrom
({
Color
?
foregroundColor
,
Color
?
foregroundColor
,
Color
?
backgroundColor
,
Color
?
backgroundColor
,
...
...
packages/flutter/lib/src/material/outlined_button.dart
View file @
4c104eff
...
@@ -103,13 +103,13 @@ class OutlinedButton extends ButtonStyleButton {
...
@@ -103,13 +103,13 @@ class OutlinedButton extends ButtonStyleButton {
/// A static convenience method that constructs an outlined button
/// A static convenience method that constructs an outlined button
/// [ButtonStyle] given simple values.
/// [ButtonStyle] given simple values.
///
///
///
The [primary], and [onSurface] colors are used to create a
///
///
[MaterialStateProperty] [ButtonStyle.foregroundColor] value in the same
///
The [foregroundColor] and [disabledForegroundColor] colors are used
///
way that [defaultStyleOf] uses the [ColorScheme] colors with the same
///
to create a [MaterialStateProperty] [ButtonStyle.foregroundColor], and
///
names. Specify a value for [primary] to specify the color of the button's
///
a derived [ButtonStyle.overlayColor].
///
text and icons as well as the overlay colors used to indicate the hover,
///
///
focus, and pressed states. Use [onSurface] to specify the button's
///
The [backgroundColor] and [disabledBackgroundColor] colors are
///
disabled text and icon color
.
///
used to create a [MaterialStateProperty] [ButtonStyle.backgroundColor]
.
///
///
/// Similarly, the [enabledMouseCursor] and [disabledMouseCursor]
/// Similarly, the [enabledMouseCursor] and [disabledMouseCursor]
/// parameters are used to construct [ButtonStyle.mouseCursor].
/// parameters are used to construct [ButtonStyle.mouseCursor].
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
4c104eff
...
@@ -518,7 +518,7 @@ class _SnackBarState extends State<SnackBar> {
...
@@ -518,7 +518,7 @@ class _SnackBarState extends State<SnackBar> {
child:
TextButtonTheme
(
child:
TextButtonTheme
(
data:
TextButtonThemeData
(
data:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
style:
TextButton
.
styleFrom
(
primary
:
buttonColor
,
foregroundColor
:
buttonColor
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
horizontalPadding
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
horizontalPadding
),
),
),
),
),
...
...
packages/flutter/lib/src/material/stepper.dart
View file @
4c104eff
...
@@ -532,7 +532,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
...
@@ -532,7 +532,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
child:
TextButton
(
child:
TextButton
(
onPressed:
widget
.
onStepCancel
,
onPressed:
widget
.
onStepCancel
,
style:
TextButton
.
styleFrom
(
style:
TextButton
.
styleFrom
(
primary
:
cancelColor
,
foregroundColor
:
cancelColor
,
padding:
buttonPadding
,
padding:
buttonPadding
,
shape:
buttonShape
,
shape:
buttonShape
,
),
),
...
...
packages/flutter/lib/src/material/text_button.dart
View file @
4c104eff
...
@@ -112,13 +112,12 @@ class TextButton extends ButtonStyleButton {
...
@@ -112,13 +112,12 @@ class TextButton extends ButtonStyleButton {
/// A static convenience method that constructs a text button
/// A static convenience method that constructs a text button
/// [ButtonStyle] given simple values.
/// [ButtonStyle] given simple values.
///
///
/// The [primary], and [onSurface] colors are used to create a
/// The [foregroundColor] and [disabledForegroundColor] colors are used
/// [MaterialStateProperty] [ButtonStyle.foregroundColor] value in the same
/// to create a [MaterialStateProperty] [ButtonStyle.foregroundColor], and
/// way that [defaultStyleOf] uses the [ColorScheme] colors with the same
/// a derived [ButtonStyle.overlayColor].
/// names. Specify a value for [primary] to specify the color of the button's
///
/// text and icons as well as the overlay colors used to indicate the hover,
/// The [backgroundColor] and [disabledBackgroundColor] colors are
/// focus, and pressed states. Use [onSurface] to specify the button's
/// used to create a [MaterialStateProperty] [ButtonStyle.backgroundColor].
/// disabled text and icon color.
///
///
/// Similarly, the [enabledMouseCursor] and [disabledMouseCursor]
/// Similarly, the [enabledMouseCursor] and [disabledMouseCursor]
/// parameters are used to construct [ButtonStyle.mouseCursor].
/// parameters are used to construct [ButtonStyle.mouseCursor].
...
@@ -137,7 +136,7 @@ class TextButton extends ButtonStyleButton {
...
@@ -137,7 +136,7 @@ class TextButton extends ButtonStyleButton {
///
///
/// ```dart
/// ```dart
/// TextButton(
/// TextButton(
/// style: TextButton.styleFrom(
primary
: Colors.green),
/// style: TextButton.styleFrom(
foregroundColor
: Colors.green),
/// )
/// )
/// ```
/// ```
static
ButtonStyle
styleFrom
({
static
ButtonStyle
styleFrom
({
...
...
packages/flutter/lib/src/material/text_selection_toolbar_text_button.dart
View file @
4c104eff
...
@@ -109,11 +109,11 @@ class TextSelectionToolbarTextButton extends StatelessWidget {
...
@@ -109,11 +109,11 @@ class TextSelectionToolbarTextButton extends StatelessWidget {
// TODO(hansmuller): Should be colorScheme.onSurface
// TODO(hansmuller): Should be colorScheme.onSurface
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
bool
isDark
=
theme
.
colorScheme
.
brightness
==
Brightness
.
dark
;
final
bool
isDark
=
theme
.
colorScheme
.
brightness
==
Brightness
.
dark
;
final
Color
primary
=
isDark
?
Colors
.
white
:
Colors
.
black87
;
final
Color
foregroundColor
=
isDark
?
Colors
.
white
:
Colors
.
black87
;
return
TextButton
(
return
TextButton
(
style:
TextButton
.
styleFrom
(
style:
TextButton
.
styleFrom
(
primary:
primary
,
foregroundColor:
foregroundColor
,
shape:
const
RoundedRectangleBorder
(),
shape:
const
RoundedRectangleBorder
(),
minimumSize:
const
Size
(
kMinInteractiveDimension
,
kMinInteractiveDimension
),
minimumSize:
const
Size
(
kMinInteractiveDimension
,
kMinInteractiveDimension
),
padding:
padding
,
padding:
padding
,
...
...
packages/flutter/test/material/elevated_button_theme_test.dart
View file @
4c104eff
...
@@ -44,10 +44,10 @@ void main() {
...
@@ -44,10 +44,10 @@ void main() {
});
});
group
(
'[Theme, TextTheme, ElevatedButton style overrides]'
,
()
{
group
(
'[Theme, TextTheme, ElevatedButton style overrides]'
,
()
{
const
Color
primaryColor
=
Color
(
0xff000001
);
const
Color
foregroundColor
=
Color
(
0xff000001
);
const
Color
onSurfaceColor
=
Color
(
0xff000002
);
const
Color
backgroundColor
=
Color
(
0xff000002
);
const
Color
disabledColor
=
Color
(
0xff000003
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
Color
onPrimaryColor
=
Color
(
0xff000005
);
const
double
elevation
=
1
;
const
double
elevation
=
1
;
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
const
EdgeInsets
padding
=
EdgeInsets
.
all
(
3
);
const
EdgeInsets
padding
=
EdgeInsets
.
all
(
3
);
...
@@ -62,9 +62,10 @@ void main() {
...
@@ -62,9 +62,10 @@ void main() {
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
final
ButtonStyle
style
=
ElevatedButton
.
styleFrom
(
final
ButtonStyle
style
=
ElevatedButton
.
styleFrom
(
primary:
primaryColor
,
foregroundColor:
foregroundColor
,
onPrimary:
onPrimaryColor
,
disabledForegroundColor:
disabledColor
,
onSurface:
onSurfaceColor
,
backgroundColor:
backgroundColor
,
disabledBackgroundColor:
disabledColor
,
shadowColor:
shadowColor
,
shadowColor:
shadowColor
,
elevation:
elevation
,
elevation:
elevation
,
textStyle:
textStyle
,
textStyle:
textStyle
,
...
@@ -126,16 +127,16 @@ void main() {
...
@@ -126,16 +127,16 @@ void main() {
void
checkButton
(
WidgetTester
tester
)
{
void
checkButton
(
WidgetTester
tester
)
{
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
expect
(
material
.
textStyle
!.
color
,
onPrimary
Color
);
expect
(
material
.
textStyle
!.
color
,
foreground
Color
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
color
,
primary
Color
);
expect
(
material
.
color
,
background
Color
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
elevation
,
elevation
);
expect
(
material
.
elevation
,
elevation
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
!,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
!,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
!,
disabled
),
disabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
!,
disabled
),
disabledMouseCursor
);
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
onPrimary
Color
.
withOpacity
(
0.08
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
foreground
Color
.
withOpacity
(
0.08
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
onPrimary
Color
.
withOpacity
(
0.24
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
foreground
Color
.
withOpacity
(
0.24
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
pressed
),
onPrimary
Color
.
withOpacity
(
0.24
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
pressed
),
foreground
Color
.
withOpacity
(
0.24
));
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
shape
,
shape
);
expect
(
material
.
shape
,
shape
);
...
...
packages/flutter/test/material/outlined_button_test.dart
View file @
4c104eff
...
@@ -1568,7 +1568,7 @@ void main() {
...
@@ -1568,7 +1568,7 @@ void main() {
expect
(
tester
.
getRect
(
find
.
byKey
(
labelKey
)),
const
Rect
.
fromLTRB
(
104.0
,
0.0
,
154.0
,
100.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
labelKey
)),
const
Rect
.
fromLTRB
(
104.0
,
0.0
,
154.0
,
100.0
));
});
});
testWidgets
(
'
Text
Button maximumSize'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
Outlined
Button maximumSize'
,
(
WidgetTester
tester
)
async
{
final
Key
key0
=
UniqueKey
();
final
Key
key0
=
UniqueKey
();
final
Key
key1
=
UniqueKey
();
final
Key
key1
=
UniqueKey
();
...
@@ -1582,7 +1582,7 @@ void main() {
...
@@ -1582,7 +1582,7 @@ void main() {
children:
<
Widget
>[
children:
<
Widget
>[
OutlinedButton
(
OutlinedButton
(
key:
key0
,
key:
key0
,
style:
Text
Button
.
styleFrom
(
style:
Outlined
Button
.
styleFrom
(
minimumSize:
const
Size
(
24
,
36
),
minimumSize:
const
Size
(
24
,
36
),
maximumSize:
const
Size
.
fromWidth
(
64
),
maximumSize:
const
Size
.
fromWidth
(
64
),
),
),
...
@@ -1591,7 +1591,7 @@ void main() {
...
@@ -1591,7 +1591,7 @@ void main() {
),
),
OutlinedButton
.
icon
(
OutlinedButton
.
icon
(
key:
key1
,
key:
key1
,
style:
Text
Button
.
styleFrom
(
style:
Outlined
Button
.
styleFrom
(
minimumSize:
const
Size
(
24
,
36
),
minimumSize:
const
Size
(
24
,
36
),
maximumSize:
const
Size
.
fromWidth
(
104
),
maximumSize:
const
Size
.
fromWidth
(
104
),
),
),
...
...
packages/flutter/test/material/outlined_button_theme_test.dart
View file @
4c104eff
...
@@ -49,9 +49,9 @@ void main() {
...
@@ -49,9 +49,9 @@ void main() {
});
});
group
(
'[Theme, TextTheme, OutlinedButton style overrides]'
,
()
{
group
(
'[Theme, TextTheme, OutlinedButton style overrides]'
,
()
{
const
Color
primary
Color
=
Color
(
0xff000001
);
const
Color
foreground
Color
=
Color
(
0xff000001
);
const
Color
onSurface
Color
=
Color
(
0xff000002
);
const
Color
background
Color
=
Color
(
0xff000002
);
const
Color
backgroun
dColor
=
Color
(
0xff000003
);
const
Color
disable
dColor
=
Color
(
0xff000003
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
double
elevation
=
3
;
const
double
elevation
=
3
;
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
...
@@ -67,9 +67,10 @@ void main() {
...
@@ -67,9 +67,10 @@ void main() {
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
final
ButtonStyle
style
=
OutlinedButton
.
styleFrom
(
final
ButtonStyle
style
=
OutlinedButton
.
styleFrom
(
primary:
primary
Color
,
foregroundColor:
foreground
Color
,
onSurface:
onSurface
Color
,
disabledForegroundColor:
disabled
Color
,
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
disabledBackgroundColor:
disabledColor
,
shadowColor:
shadowColor
,
shadowColor:
shadowColor
,
elevation:
elevation
,
elevation:
elevation
,
textStyle:
textStyle
,
textStyle:
textStyle
,
...
@@ -130,15 +131,15 @@ void main() {
...
@@ -130,15 +131,15 @@ void main() {
void
checkButton
(
WidgetTester
tester
)
{
void
checkButton
(
WidgetTester
tester
)
{
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
expect
(
material
.
textStyle
!.
color
,
primary
Color
);
expect
(
material
.
textStyle
!.
color
,
foreground
Color
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
color
,
backgroundColor
);
expect
(
material
.
color
,
backgroundColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
elevation
,
elevation
);
expect
(
material
.
elevation
,
elevation
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
primary
Color
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
foreground
Color
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
primary
Color
.
withOpacity
(
0.12
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
foreground
Color
.
withOpacity
(
0.12
));
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
shape
,
shape
);
expect
(
material
.
shape
,
shape
);
...
...
packages/flutter/test/material/snack_bar_test.dart
View file @
4c104eff
...
@@ -499,9 +499,9 @@ void main() {
...
@@ -499,9 +499,9 @@ void main() {
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
black
),
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
black
),
bottomNavigationBarTheme:
const
BottomNavigationBarThemeData
(
type:
BottomNavigationBarType
.
fixed
),
bottomNavigationBarTheme:
const
BottomNavigationBarThemeData
(
type:
BottomNavigationBarType
.
fixed
),
timePickerTheme:
const
TimePickerThemeData
(
backgroundColor:
Colors
.
black
),
timePickerTheme:
const
TimePickerThemeData
(
backgroundColor:
Colors
.
black
),
textButtonTheme:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
primary
:
Colors
.
red
)),
textButtonTheme:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
foregroundColor
:
Colors
.
red
)),
elevatedButtonTheme:
ElevatedButtonThemeData
(
style:
ElevatedButton
.
styleFrom
(
primary
:
Colors
.
green
)),
elevatedButtonTheme:
ElevatedButtonThemeData
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor
:
Colors
.
green
)),
outlinedButtonTheme:
OutlinedButtonThemeData
(
style:
OutlinedButton
.
styleFrom
(
primary
:
Colors
.
blue
)),
outlinedButtonTheme:
OutlinedButtonThemeData
(
style:
OutlinedButton
.
styleFrom
(
foregroundColor
:
Colors
.
blue
)),
textSelectionTheme:
const
TextSelectionThemeData
(
cursorColor:
Colors
.
black
),
textSelectionTheme:
const
TextSelectionThemeData
(
cursorColor:
Colors
.
black
),
dataTableTheme:
const
DataTableThemeData
(),
dataTableTheme:
const
DataTableThemeData
(),
checkboxTheme:
const
CheckboxThemeData
(),
checkboxTheme:
const
CheckboxThemeData
(),
...
...
packages/flutter/test/material/text_button_theme_test.dart
View file @
4c104eff
...
@@ -44,9 +44,9 @@ void main() {
...
@@ -44,9 +44,9 @@ void main() {
});
});
group
(
'[Theme, TextTheme, TextButton style overrides]'
,
()
{
group
(
'[Theme, TextTheme, TextButton style overrides]'
,
()
{
const
Color
primary
Color
=
Color
(
0xff000001
);
const
Color
foreground
Color
=
Color
(
0xff000001
);
const
Color
onSurface
Color
=
Color
(
0xff000002
);
const
Color
background
Color
=
Color
(
0xff000002
);
const
Color
backgroun
dColor
=
Color
(
0xff000003
);
const
Color
disable
dColor
=
Color
(
0xff000003
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
Color
shadowColor
=
Color
(
0xff000004
);
const
double
elevation
=
3
;
const
double
elevation
=
3
;
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
const
TextStyle
textStyle
=
TextStyle
(
fontSize:
12.0
);
...
@@ -62,9 +62,10 @@ void main() {
...
@@ -62,9 +62,10 @@ void main() {
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
const
AlignmentGeometry
alignment
=
Alignment
.
centerLeft
;
final
ButtonStyle
style
=
TextButton
.
styleFrom
(
final
ButtonStyle
style
=
TextButton
.
styleFrom
(
primary:
primary
Color
,
foregroundColor:
foreground
Color
,
onSurface:
onSurface
Color
,
disabledForegroundColor:
disabled
Color
,
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
disabledBackgroundColor:
disabledColor
,
shadowColor:
shadowColor
,
shadowColor:
shadowColor
,
elevation:
elevation
,
elevation:
elevation
,
textStyle:
textStyle
,
textStyle:
textStyle
,
...
@@ -125,15 +126,15 @@ void main() {
...
@@ -125,15 +126,15 @@ void main() {
void
checkButton
(
WidgetTester
tester
)
{
void
checkButton
(
WidgetTester
tester
)
{
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
expect
(
material
.
textStyle
!.
color
,
primary
Color
);
expect
(
material
.
textStyle
!.
color
,
foreground
Color
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
textStyle
!.
fontSize
,
12
);
expect
(
material
.
color
,
backgroundColor
);
expect
(
material
.
color
,
backgroundColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
elevation
,
elevation
);
expect
(
material
.
elevation
,
elevation
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
primary
Color
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
hovered
),
foreground
Color
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
primary
Color
.
withOpacity
(
0.12
));
expect
(
inkWell
.
overlayColor
!.
resolve
(
focused
),
foreground
Color
.
withOpacity
(
0.12
));
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
shape
,
shape
);
expect
(
material
.
shape
,
shape
);
...
...
packages/flutter/test/material/theme_data_test.dart
View file @
4c104eff
...
@@ -695,13 +695,13 @@ void main() {
...
@@ -695,13 +695,13 @@ void main() {
dialogTheme:
const
DialogTheme
(
backgroundColor:
Colors
.
black
),
dialogTheme:
const
DialogTheme
(
backgroundColor:
Colors
.
black
),
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
black
),
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
black
),
drawerTheme:
const
DrawerThemeData
(),
drawerTheme:
const
DrawerThemeData
(),
elevatedButtonTheme:
ElevatedButtonThemeData
(
style:
ElevatedButton
.
styleFrom
(
primary
:
Colors
.
green
)),
elevatedButtonTheme:
ElevatedButtonThemeData
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor
:
Colors
.
green
)),
expansionTileTheme:
const
ExpansionTileThemeData
(
backgroundColor:
Colors
.
black
),
expansionTileTheme:
const
ExpansionTileThemeData
(
backgroundColor:
Colors
.
black
),
floatingActionButtonTheme:
const
FloatingActionButtonThemeData
(
backgroundColor:
Colors
.
black
),
floatingActionButtonTheme:
const
FloatingActionButtonThemeData
(
backgroundColor:
Colors
.
black
),
listTileTheme:
const
ListTileThemeData
(),
listTileTheme:
const
ListTileThemeData
(),
navigationBarTheme:
const
NavigationBarThemeData
(
backgroundColor:
Colors
.
black
),
navigationBarTheme:
const
NavigationBarThemeData
(
backgroundColor:
Colors
.
black
),
navigationRailTheme:
const
NavigationRailThemeData
(
backgroundColor:
Colors
.
black
),
navigationRailTheme:
const
NavigationRailThemeData
(
backgroundColor:
Colors
.
black
),
outlinedButtonTheme:
OutlinedButtonThemeData
(
style:
OutlinedButton
.
styleFrom
(
primary
:
Colors
.
blue
)),
outlinedButtonTheme:
OutlinedButtonThemeData
(
style:
OutlinedButton
.
styleFrom
(
foregroundColor
:
Colors
.
blue
)),
popupMenuTheme:
const
PopupMenuThemeData
(
color:
Colors
.
black
),
popupMenuTheme:
const
PopupMenuThemeData
(
color:
Colors
.
black
),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
progressIndicatorTheme:
const
ProgressIndicatorThemeData
(),
radioTheme:
const
RadioThemeData
(),
radioTheme:
const
RadioThemeData
(),
...
@@ -709,7 +709,7 @@ void main() {
...
@@ -709,7 +709,7 @@ void main() {
snackBarTheme:
const
SnackBarThemeData
(
backgroundColor:
Colors
.
black
),
snackBarTheme:
const
SnackBarThemeData
(
backgroundColor:
Colors
.
black
),
switchTheme:
const
SwitchThemeData
(),
switchTheme:
const
SwitchThemeData
(),
tabBarTheme:
const
TabBarTheme
(
labelColor:
Colors
.
black
),
tabBarTheme:
const
TabBarTheme
(
labelColor:
Colors
.
black
),
textButtonTheme:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
primary
:
Colors
.
red
)),
textButtonTheme:
TextButtonThemeData
(
style:
TextButton
.
styleFrom
(
foregroundColor
:
Colors
.
red
)),
textSelectionTheme:
const
TextSelectionThemeData
(
cursorColor:
Colors
.
black
),
textSelectionTheme:
const
TextSelectionThemeData
(
cursorColor:
Colors
.
black
),
timePickerTheme:
const
TimePickerThemeData
(
backgroundColor:
Colors
.
black
),
timePickerTheme:
const
TimePickerThemeData
(
backgroundColor:
Colors
.
black
),
toggleButtonsTheme:
const
ToggleButtonsThemeData
(
textStyle:
TextStyle
(
color:
Colors
.
black
)),
toggleButtonsTheme:
const
ToggleButtonsThemeData
(
textStyle:
TextStyle
(
color:
Colors
.
black
)),
...
...
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