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
afe6c2e7
Unverified
Commit
afe6c2e7
authored
Apr 06, 2022
by
Kate Lovett
Committed by
GitHub
Apr 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated RaisedButton (#98547)
parent
94fefaa4
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
1317 deletions
+39
-1317
material.dart
packages/flutter/lib/material.dart
+0
-1
button.dart
packages/flutter/lib/src/material/button.dart
+2
-5
button_theme.dart
packages/flutter/lib/src/material/button_theme.dart
+24
-33
flat_button.dart
packages/flutter/lib/src/material/flat_button.dart
+2
-5
material_button.dart
packages/flutter/lib/src/material/material_button.dart
+7
-10
raised_button.dart
packages/flutter/lib/src/material/raised_button.dart
+0
-272
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+2
-5
button_theme_test.dart
packages/flutter/test/material/button_theme_test.dart
+0
-106
inherited_theme_test.dart
packages/flutter/test/material/inherited_theme_test.dart
+0
-94
raised_button_test.dart
packages/flutter/test/material/raised_button_test.dart
+0
-726
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+2
-2
theme_defaults_test.dart
packages/flutter/test/material/theme_defaults_test.dart
+0
-58
No files found.
packages/flutter/lib/material.dart
View file @
afe6c2e7
...
...
@@ -118,7 +118,6 @@ export 'src/material/progress_indicator_theme.dart';
export
'src/material/radio.dart'
;
export
'src/material/radio_list_tile.dart'
;
export
'src/material/radio_theme.dart'
;
export
'src/material/raised_button.dart'
;
export
'src/material/range_slider.dart'
;
export
'src/material/refresh_indicator.dart'
;
export
'src/material/reorderable_list.dart'
;
...
...
packages/flutter/lib/src/material/button.dart
View file @
afe6c2e7
...
...
@@ -26,11 +26,8 @@ import 'theme_data.dart';
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
/// [OutlinedButton].
///
/// FlatButton and RaisedButton have been replaced by
/// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them.
/// FlatButton has been replaced by TextButton and ButtonTheme has been
/// replaced by TextButtonTheme. Please migrate code that uses them.
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
...
...
packages/flutter/lib/src/material/button_theme.dart
View file @
afe6c2e7
...
...
@@ -11,7 +11,6 @@ import 'constants.dart';
import
'flat_button.dart'
;
import
'material_button.dart'
;
import
'material_state.dart'
;
import
'raised_button.dart'
;
import
'theme.dart'
;
import
'theme_data.dart'
show
MaterialTapTargetSize
;
...
...
@@ -21,8 +20,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
///
/// See also:
///
/// * [RaisedButton] and [FlatButton] which are configured
/// based on the ambient [ButtonTheme].
/// * [FlatButton] which is configured based on the ambient [ButtonTheme].
enum
ButtonTextTheme
{
/// Button text is black or white depending on [ThemeData.brightness].
normal
,
...
...
@@ -68,8 +66,7 @@ enum ButtonBarLayoutBehavior {
///
/// See also:
///
/// * [FlatButton] and [RaisedButton] which are styled
/// based on the ambient button theme.
/// * [FlatButton] which is styled based on the ambient button theme.
/// * [RawMaterialButton], which can be used to configure a button that doesn't
/// depend on any inherited themes.
class
ButtonTheme
extends
InheritedTheme
{
...
...
@@ -174,11 +171,9 @@ class ButtonTheme extends InheritedTheme {
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
///
/// FlatButton and RaisedButton have been replaced by
/// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them.
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
/// by TextButtonTheme. Please migrate code that uses them.
///
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
...
...
@@ -196,8 +191,8 @@ class ButtonThemeData with Diagnosticable {
/// [height] parameters must greater than or equal to zero.
///
/// The ButtonTheme's methods that have a [MaterialButton] parameter and
/// have a name with a `get` prefix are used by [
RaisedButton]
///
and [FlatButton] to configure a
[RawMaterialButton].
/// have a name with a `get` prefix are used by [
FlatButton] to configure a
/// [RawMaterialButton].
const
ButtonThemeData
({
this
.
textTheme
=
ButtonTextTheme
.
normal
,
this
.
minWidth
=
88.0
,
...
...
@@ -278,7 +273,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getPadding], which is used by [
RaisedButton] and [
FlatButton].
/// * [getPadding], which is used by [FlatButton].
EdgeInsetsGeometry
get
padding
{
if
(
_padding
!=
null
)
return
_padding
!;
...
...
@@ -304,7 +299,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getShape], which is used by [
RaisedButton] and [
FlatButton].
/// * [getShape], which is used by [FlatButton].
ShapeBorder
get
shape
{
if
(
_shape
!=
null
)
return
_shape
!;
...
...
@@ -333,7 +328,7 @@ class ButtonThemeData with Diagnosticable {
/// This property only affects [DropdownButton] and its menu.
final
bool
alignedDropdown
;
/// The background fill color
for [RaisedButton]s
.
/// The background fill color.
///
/// This property is null by default.
///
...
...
@@ -343,18 +338,17 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getFillColor], which is used by [RaisedButton] to compute its
/// background fill color.
/// * [getFillColor], which is used to compute the background fill color.
final
Color
?
_buttonColor
;
/// The background fill color
for disabled [RaisedButton]s
.
/// The background fill color
when disabled
.
///
/// This property is null by default.
///
/// See also:
///
/// * [getDisabledFillColor], which is
used by [RaisedButton] to compute its
///
background fill color
.
/// * [getDisabledFillColor], which is
to compute background fill color for
///
disabled state
.
final
Color
?
_disabledColor
;
/// The fill color of the button when it has the input focus.
...
...
@@ -366,7 +360,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getFocusColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getFocusColor], which is used by [FlatButton].
final
Color
?
_focusColor
;
/// The fill color of the button when a pointer is hovering over it.
...
...
@@ -378,7 +372,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getHoverColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getHoverColor], which is used by [FlatButton].
final
Color
?
_hoverColor
;
/// The color of the overlay that appears when a button is pressed.
...
...
@@ -387,7 +381,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getHighlightColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getHighlightColor], which is used by [FlatButton].
final
Color
?
_highlightColor
;
/// The color of the ink "splash" overlay that appears when a button is tapped.
...
...
@@ -396,7 +390,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getSplashColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getSplashColor], which is used by [FlatButton].
final
Color
?
_splashColor
;
/// A set of thirteen colors that can be used to derive the button theme's
...
...
@@ -417,7 +411,7 @@ class ButtonThemeData with Diagnosticable {
//
// See also:
//
// * [getMaterialTargetTapSize], which is used by [
RaisedButton] and [
FlatButton].
// * [getMaterialTargetTapSize], which is used by [FlatButton].
final
MaterialTapTargetSize
?
_materialTapTargetSize
;
/// The [button]'s overall brightness.
...
...
@@ -484,9 +478,6 @@ class ButtonThemeData with Diagnosticable {
/// Otherwise, if button is a [FlatButton] then null is
/// returned.
///
/// Otherwise, if button is a [RaisedButton], returns the `buttonColor`
/// constructor parameter if it was non-null and the button is enabled.
///
/// Otherwise the fill color depends on the value of [getTextTheme].
///
/// * [ButtonTextTheme.normal] or [ButtonTextTheme.accent], the
...
...
@@ -505,7 +496,7 @@ class ButtonThemeData with Diagnosticable {
if
(
button
is
FlatButton
||
button
.
runtimeType
==
MaterialButton
)
return
null
;
if
(
button
.
enabled
&&
button
is
RaisedButton
&&
_buttonColor
!=
null
)
if
(
button
.
enabled
&&
_buttonColor
!=
null
)
return
_buttonColor
;
switch
(
getTextTheme
(
button
))
{
...
...
@@ -569,7 +560,7 @@ class ButtonThemeData with Diagnosticable {
/// Returns the button's [MaterialButton.splashColor] if it is non-null.
///
/// Otherwise, returns the value of the `splashColor` constructor parameter
/// it is non-null
and [button] is a [RaisedButton]
.
/// it is non-null.
///
/// Otherwise, returns the value of the `splashColor` constructor parameter
/// if it is non-null and [button] is a [FlatButton] and
...
...
@@ -580,7 +571,7 @@ class ButtonThemeData with Diagnosticable {
if
(
button
.
splashColor
!=
null
)
return
button
.
splashColor
!;
if
(
_splashColor
!=
null
&&
button
is
RaisedButton
)
if
(
_splashColor
!=
null
)
return
_splashColor
!;
if
(
_splashColor
!=
null
&&
button
is
FlatButton
)
{
...
...
@@ -715,8 +706,8 @@ class ButtonThemeData with Diagnosticable {
///
/// Returns the button's [MaterialButton.padding] if it is non-null.
///
/// If this is a button constructed with [
RaisedButton.icon] or
///
[FlatButton.icon] then the padding
is:
/// If this is a button constructed with [
FlatButton.icon] then the padding
/// is:
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
///
/// Otherwise, returns [padding] if it is non-null.
...
...
packages/flutter/lib/src/material/flat_button.dart
View file @
afe6c2e7
...
...
@@ -14,11 +14,8 @@ import 'theme_data.dart';
///
/// ### This class is deprecated, please use [TextButton] instead.
///
/// FlatButton and RaisedButton have been replaced by
/// [TextButton] and [ElevatedButton] respectively.
/// ButtonTheme has been replaced by [TextButtonTheme] and
/// [ElevatedButtonTheme]. The original classes
/// will eventually be removed, please migrate code that uses them.
/// FlatButton have been replaced by [TextButton] and ButtonTheme has been
/// replaced by [TextButtonTheme]. Please migrate code that uses them.
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
...
...
packages/flutter/lib/src/material/material_button.dart
View file @
afe6c2e7
...
...
@@ -21,10 +21,8 @@ import 'theme_data.dart';
///
/// ### This class is obsolete.
///
/// FlatButton and RaisedButton have been replaced by
/// TextButton and ElevatedButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme. The appearance of the
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
/// by TextButtonTheme. The appearance of the
/// new widgets can be customized by specifying a [ButtonStyle]
/// or by creating a one-off style using a `styleFrom` method like
/// [TextButton.styleFrom]. The original button classes
...
...
@@ -38,9 +36,9 @@ import 'theme_data.dart';
/// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have
/// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress].
///
/// Rather than using this class directly, consider using [FlatButton]
///
or [RaisedButton], which configure this class with
///
appropriate defaults that match the material
design specification.
/// Rather than using this class directly, consider using [FlatButton]
, which
///
configure this class with appropriate defaults that match the material
/// design specification.
///
/// To create a button directly, without inheriting theme defaults, use
/// [RawMaterialButton].
...
...
@@ -55,7 +53,7 @@ class MaterialButton extends StatelessWidget {
/// Creates a material button.
///
/// Rather than creating a material button directly, consider using
/// [FlatButton]
or [RaisedButton]
. To create a custom Material button
/// [FlatButton]. To create a custom Material button
/// consider using [RawMaterialButton].
///
/// The [autofocus] and [clipBehavior] arguments must not be null.
...
...
@@ -457,8 +455,7 @@ class MaterialButton extends StatelessWidget {
}
}
/// The type of [MaterialButton]s created with RaisedButton.icon] and
/// FlatButton.icon.
/// The type of [MaterialButton]s created with FlatButton.icon.
///
/// This mixin only exists to give the "label and icon" button widgets a distinct
/// type for the sake of [ButtonTheme].
...
...
packages/flutter/lib/src/material/raised_button.dart
deleted
100644 → 0
View file @
94fefaa4
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/theme_data.dart
View file @
afe6c2e7
...
...
@@ -115,7 +115,6 @@ const Color _kDarkThemeSplashColor = Color(0x40CCCCCC);
/// * [TextButton]
/// * [ElevatedButton]
/// * [FlatButton]
/// * [RaisedButton]
/// * The time picker widget ([showTimePicker])
/// * [SnackBar]
/// * [Chip]
...
...
@@ -524,7 +523,6 @@ class ThemeData with Diagnosticable {
// [disabledColor], [highlightColor], and [splashColor].
buttonTheme
??=
ButtonThemeData
(
colorScheme:
colorScheme
,
// Defaults to the fill color for RaisedButtons for backwards compatibility.
buttonColor:
buttonColor
??
(
isDark
?
primarySwatch
[
600
]!
:
Colors
.
grey
[
300
]!),
disabledColor:
disabledColor
,
focusColor:
focusColor
,
...
...
@@ -1423,8 +1421,7 @@ class ThemeData with Diagnosticable {
/// A theme for customizing the appearance and layout of [ButtonBar] widgets.
final
ButtonBarThemeData
buttonBarTheme
;
/// Defines the default configuration of button widgets, like [RaisedButton]
/// and [FlatButton].
/// Defines the default configuration of button widgets, like [FlatButton].
final
ButtonThemeData
buttonTheme
;
/// The colors and styles used to render [Card].
...
...
@@ -1627,7 +1624,7 @@ class ThemeData with Diagnosticable {
)
final
IconThemeData
accentIconTheme
;
/// The default fill color of the [Material]
used in [RaisedButton]s
.
/// The default fill color of the [Material].
@Deprecated
(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.3.0-0.2.pre.'
,
...
...
packages/flutter/test/material/button_theme_test.dart
View file @
afe6c2e7
...
...
@@ -117,112 +117,6 @@ void main() {
expect
(
theme
.
colorScheme
,
const
ColorScheme
.
dark
());
});
testWidgets
(
'Theme buttonTheme defaults'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
lightTheme
=
ThemeData
.
light
();
late
ButtonTextTheme
textTheme
;
late
BoxConstraints
constraints
;
late
EdgeInsets
padding
;
late
ShapeBorder
shape
;
const
Color
disabledColor
=
Color
(
0xFF00FF00
);
await
tester
.
pumpWidget
(
Theme
(
data:
lightTheme
.
copyWith
(
disabledColor:
disabledColor
,
// disabled RaisedButton fill color
buttonTheme:
const
ButtonThemeData
(
disabledColor:
disabledColor
),
textTheme:
lightTheme
.
textTheme
.
copyWith
(
button:
lightTheme
.
textTheme
.
button
!.
copyWith
(
// The button's height will match because there's no
// vertical padding by default
fontSize:
48.0
,
),
),
),
child:
Builder
(
builder:
(
BuildContext
context
)
{
final
ButtonThemeData
theme
=
ButtonTheme
.
of
(
context
);
textTheme
=
theme
.
textTheme
;
constraints
=
theme
.
constraints
;
padding
=
theme
.
padding
as
EdgeInsets
;
shape
=
theme
.
shape
;
return
Container
(
alignment:
Alignment
.
topLeft
,
child:
const
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
RaisedButton
(
onPressed:
null
,
child:
Text
(
'b'
),
// intrinsic width < minimum width
),
),
);
},
),
),
);
expect
(
textTheme
,
ButtonTextTheme
.
normal
);
expect
(
constraints
,
const
BoxConstraints
(
minWidth:
88.0
,
minHeight:
36.0
));
expect
(
padding
,
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
));
expect
(
shape
,
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
2.0
)),
));
expect
(
tester
.
widget
<
Material
>(
find
.
byType
(
Material
)).
shape
,
shape
);
expect
(
tester
.
widget
<
Material
>(
find
.
byType
(
Material
)).
color
,
disabledColor
);
expect
(
tester
.
getSize
(
find
.
byType
(
Material
)),
const
Size
(
88.0
,
48.0
));
});
testWidgets
(
'Theme buttonTheme ButtonTheme overrides'
,
(
WidgetTester
tester
)
async
{
late
ButtonTextTheme
textTheme
;
late
BoxConstraints
constraints
;
late
EdgeInsets
padding
;
late
ShapeBorder
shape
;
await
tester
.
pumpWidget
(
Theme
(
data:
ThemeData
.
light
().
copyWith
(
buttonColor:
const
Color
(
0xFF00FF00
),
// enabled RaisedButton fill color
),
child:
ButtonTheme
(
textTheme:
ButtonTextTheme
.
primary
,
minWidth:
100.0
,
height:
200.0
,
padding:
EdgeInsets
.
zero
,
buttonColor:
const
Color
(
0xFF00FF00
),
// enabled RaisedButton fill color
shape:
const
RoundedRectangleBorder
(),
child:
Builder
(
builder:
(
BuildContext
context
)
{
final
ButtonThemeData
theme
=
ButtonTheme
.
of
(
context
);
textTheme
=
theme
.
textTheme
;
constraints
=
theme
.
constraints
;
padding
=
theme
.
padding
as
EdgeInsets
;
shape
=
theme
.
shape
;
return
Container
(
alignment:
Alignment
.
topLeft
,
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
RaisedButton
(
onPressed:
()
{
},
child:
const
Text
(
'b'
),
// intrinsic width < minimum width
),
),
);
},
),
),
),
);
expect
(
textTheme
,
ButtonTextTheme
.
primary
);
expect
(
constraints
,
const
BoxConstraints
(
minWidth:
100.0
,
minHeight:
200.0
));
expect
(
padding
,
EdgeInsets
.
zero
);
expect
(
shape
,
const
RoundedRectangleBorder
());
expect
(
tester
.
widget
<
Material
>(
find
.
byType
(
Material
)).
shape
,
shape
);
expect
(
tester
.
widget
<
Material
>(
find
.
byType
(
Material
)).
color
,
const
Color
(
0xFF00FF00
));
expect
(
tester
.
getSize
(
find
.
byType
(
Material
)),
const
Size
(
100.0
,
200.0
));
});
testWidgets
(
'ButtonTheme alignedDropdown'
,
(
WidgetTester
tester
)
async
{
final
Key
dropdownKey
=
UniqueKey
();
...
...
packages/flutter/test/material/inherited_theme_test.dart
View file @
afe6c2e7
...
...
@@ -607,99 +607,5 @@ void main() {
await
tester
.
pumpAndSettle
();
// route animation
expect
(
getTextColor
(
'selected'
),
isNot
(
selectedButtonColor
));
expect
(
getTextColor
(
'unselected'
),
isNot
(
buttonColor
));
});
testWidgets
(
'ButtonTheme.wrap()'
,
(
WidgetTester
tester
)
async
{
const
Color
buttonColor
=
Color
(
0xFF00FF00
);
const
Color
disabledButtonColor
=
Color
(
0xFFFF0000
);
final
Widget
buttons
=
Scaffold
(
body:
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
const
RaisedButton
(
onPressed:
null
,
child:
Text
(
'disabled'
)),
RaisedButton
(
child:
const
Text
(
'enabled'
),
onPressed:
()
{
}),
],
),
),
);
late
BuildContext
navigatorContext
;
Widget
buildFrame
()
{
return
MaterialApp
(
home:
Scaffold
(
body:
ButtonTheme
.
fromButtonThemeData
(
data:
const
ButtonThemeData
(
buttonColor:
buttonColor
,
disabledColor:
disabledButtonColor
,
),
child:
Builder
(
// Introduce a context so the shadow ButtonTheme is visible to captureAll().
builder:
(
BuildContext
context
)
{
navigatorContext
=
context
;
return
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
RaisedButton
(
child:
const
Text
(
'push unwrapped'
),
onPressed:
()
{
Navigator
.
of
(
context
).
push
<
void
>(
MaterialPageRoute
<
void
>(
// The slider will see the default ButtonTheme when built.
builder:
(
BuildContext
_
)
=>
buttons
,
),
);
},
),
RaisedButton
(
child:
const
Text
(
'push wrapped'
),
onPressed:
()
{
Navigator
.
of
(
context
).
push
<
void
>(
MaterialPageRoute
<
void
>(
// Capture the shadow toggleButtons.
builder:
(
BuildContext
_
)
=>
InheritedTheme
.
captureAll
(
context
,
buttons
),
),
);
},
),
],
),
);
},
),
),
),
);
}
Color
getButtonColor
(
String
text
)
{
return
tester
.
widget
<
Material
>(
find
.
descendant
(
of:
find
.
widgetWithText
(
RawMaterialButton
,
text
),
matching:
find
.
byType
(
Material
),
),
).
color
!;
}
await
tester
.
pumpWidget
(
buildFrame
());
// Show a route which contains toggleButtons.
await
tester
.
tap
(
find
.
text
(
'push wrapped'
));
await
tester
.
pumpAndSettle
();
// route animation
expect
(
getButtonColor
(
'disabled'
),
disabledButtonColor
);
expect
(
getButtonColor
(
'enabled'
),
buttonColor
);
Navigator
.
of
(
navigatorContext
).
pop
();
await
tester
.
pumpAndSettle
();
// route animation
await
tester
.
tap
(
find
.
text
(
'push unwrapped'
));
await
tester
.
pumpAndSettle
();
// route animation
expect
(
getButtonColor
(
'disabled'
),
isNot
(
disabledButtonColor
));
expect
(
getButtonColor
(
'enabled'
),
isNot
(
buttonColor
));
});
}
packages/flutter/test/material/raised_button_test.dart
deleted
100644 → 0
View file @
94fefaa4
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/text_field_test.dart
View file @
afe6c2e7
...
...
@@ -10364,11 +10364,11 @@ void main() {
onTap:
()
{
textFieldTapCount
+=
1
;
},
decoration:
InputDecoration
(
labelText:
'Label'
,
prefix:
Rais
edButton
(
prefix:
Elevat
edButton
(
onPressed:
()
{
prefixTapCount
+=
1
;
},
child:
const
Text
(
'prefix'
),
),
suffix:
Rais
edButton
(
suffix:
Elevat
edButton
(
onPressed:
()
{
suffixTapCount
+=
1
;
},
child:
const
Text
(
'suffix'
),
),
...
...
packages/flutter/test/material/theme_defaults_test.dart
View file @
afe6c2e7
...
...
@@ -11,64 +11,6 @@ const BoxConstraints defaultButtonConstraints = BoxConstraints(minWidth: 88.0, m
const
Duration
defaultButtonDuration
=
Duration
(
milliseconds:
200
);
void
main
(
)
{
group
(
'RaisedButton'
,
()
{
testWidgets
(
'theme: ThemeData.light(), enabled: true'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
light
(),
home:
Center
(
child:
RaisedButton
(
onPressed:
()
{
},
// button.enabled == true
child:
const
Text
(
'button'
),
),
),
),
);
final
RawMaterialButton
raw
=
tester
.
widget
<
RawMaterialButton
>(
find
.
byType
(
RawMaterialButton
));
expect
(
raw
.
textStyle
!.
color
,
const
Color
(
0xdd000000
));
expect
(
raw
.
fillColor
,
const
Color
(
0xffe0e0e0
));
expect
(
raw
.
highlightColor
,
const
Color
(
0x29000000
));
// Was Color(0x66bcbcbc)
expect
(
raw
.
splashColor
,
const
Color
(
0x1f000000
));
// Was Color(0x66c8c8c8)
expect
(
raw
.
elevation
,
2.0
);
expect
(
raw
.
highlightElevation
,
8.0
);
expect
(
raw
.
disabledElevation
,
0.0
);
expect
(
raw
.
constraints
,
defaultButtonConstraints
);
expect
(
raw
.
padding
,
defaultButtonPadding
);
expect
(
raw
.
shape
,
defaultButtonShape
);
expect
(
raw
.
animationDuration
,
defaultButtonDuration
);
expect
(
raw
.
materialTapTargetSize
,
MaterialTapTargetSize
.
padded
);
});
testWidgets
(
'theme: ThemeData.light(), enabled: false'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
light
(),
home:
const
Center
(
child:
RaisedButton
(
onPressed:
null
,
// button.enabled == false
child:
Text
(
'button'
),
),
),
),
);
final
RawMaterialButton
raw
=
tester
.
widget
<
RawMaterialButton
>(
find
.
byType
(
RawMaterialButton
));
expect
(
raw
.
textStyle
!.
color
,
const
Color
(
0x61000000
));
expect
(
raw
.
fillColor
,
const
Color
(
0x61000000
));
// highlightColor, disabled button can't be pressed
// splashColor, disabled button doesn't splash
expect
(
raw
.
elevation
,
2.0
);
expect
(
raw
.
highlightElevation
,
8.0
);
expect
(
raw
.
disabledElevation
,
0.0
);
expect
(
raw
.
constraints
,
defaultButtonConstraints
);
expect
(
raw
.
padding
,
defaultButtonPadding
);
expect
(
raw
.
shape
,
defaultButtonShape
);
expect
(
raw
.
animationDuration
,
defaultButtonDuration
);
expect
(
raw
.
materialTapTargetSize
,
MaterialTapTargetSize
.
padded
);
});
});
group
(
'FlatButton'
,
()
{
testWidgets
(
'theme: ThemeData.light(), enabled: true'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
...
...
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