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
Show 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';
...
@@ -118,7 +118,6 @@ export 'src/material/progress_indicator_theme.dart';
export
'src/material/radio.dart'
;
export
'src/material/radio.dart'
;
export
'src/material/radio_list_tile.dart'
;
export
'src/material/radio_list_tile.dart'
;
export
'src/material/radio_theme.dart'
;
export
'src/material/radio_theme.dart'
;
export
'src/material/raised_button.dart'
;
export
'src/material/range_slider.dart'
;
export
'src/material/range_slider.dart'
;
export
'src/material/refresh_indicator.dart'
;
export
'src/material/refresh_indicator.dart'
;
export
'src/material/reorderable_list.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';
...
@@ -26,11 +26,8 @@ import 'theme_data.dart';
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
/// [OutlinedButton].
/// [OutlinedButton].
///
///
/// FlatButton and RaisedButton have been replaced by
/// FlatButton has been replaced by TextButton and ButtonTheme has been
/// TextButton and ElevatedButton respectively.
/// replaced by TextButtonTheme. Please migrate code that uses them.
/// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
/// [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';
...
@@ -11,7 +11,6 @@ import 'constants.dart';
import
'flat_button.dart'
;
import
'flat_button.dart'
;
import
'material_button.dart'
;
import
'material_button.dart'
;
import
'material_state.dart'
;
import
'material_state.dart'
;
import
'raised_button.dart'
;
import
'theme.dart'
;
import
'theme.dart'
;
import
'theme_data.dart'
show
MaterialTapTargetSize
;
import
'theme_data.dart'
show
MaterialTapTargetSize
;
...
@@ -21,8 +20,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
...
@@ -21,8 +20,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
///
///
/// See also:
/// See also:
///
///
/// * [RaisedButton] and [FlatButton] which are configured
/// * [FlatButton] which is configured based on the ambient [ButtonTheme].
/// based on the ambient [ButtonTheme].
enum
ButtonTextTheme
{
enum
ButtonTextTheme
{
/// Button text is black or white depending on [ThemeData.brightness].
/// Button text is black or white depending on [ThemeData.brightness].
normal
,
normal
,
...
@@ -68,8 +66,7 @@ enum ButtonBarLayoutBehavior {
...
@@ -68,8 +66,7 @@ enum ButtonBarLayoutBehavior {
///
///
/// See also:
/// See also:
///
///
/// * [FlatButton] and [RaisedButton] which are styled
/// * [FlatButton] which is styled based on the ambient button theme.
/// based on the ambient button theme.
/// * [RawMaterialButton], which can be used to configure a button that doesn't
/// * [RawMaterialButton], which can be used to configure a button that doesn't
/// depend on any inherited themes.
/// depend on any inherited themes.
class
ButtonTheme
extends
InheritedTheme
{
class
ButtonTheme
extends
InheritedTheme
{
...
@@ -174,11 +171,9 @@ class ButtonTheme extends InheritedTheme {
...
@@ -174,11 +171,9 @@ class ButtonTheme extends InheritedTheme {
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
///
///
/// FlatButton and RaisedButton have been replaced by
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
/// TextButton and ElevatedButton respectively.
/// by TextButtonTheme. Please migrate code that uses them.
/// ButtonTheme has been replaced by TextButtonTheme and
///
/// ElevatedButtonTheme. The original classes
/// have been deprecated, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
...
@@ -196,8 +191,8 @@ class ButtonThemeData with Diagnosticable {
...
@@ -196,8 +191,8 @@ class ButtonThemeData with Diagnosticable {
/// [height] parameters must greater than or equal to zero.
/// [height] parameters must greater than or equal to zero.
///
///
/// The ButtonTheme's methods that have a [MaterialButton] parameter and
/// The ButtonTheme's methods that have a [MaterialButton] parameter and
/// have a name with a `get` prefix are used by [
RaisedButton]
/// have a name with a `get` prefix are used by [
FlatButton] to configure a
///
and [FlatButton] to configure a
[RawMaterialButton].
/// [RawMaterialButton].
const
ButtonThemeData
({
const
ButtonThemeData
({
this
.
textTheme
=
ButtonTextTheme
.
normal
,
this
.
textTheme
=
ButtonTextTheme
.
normal
,
this
.
minWidth
=
88.0
,
this
.
minWidth
=
88.0
,
...
@@ -278,7 +273,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -278,7 +273,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getPadding], which is used by [
RaisedButton] and [
FlatButton].
/// * [getPadding], which is used by [FlatButton].
EdgeInsetsGeometry
get
padding
{
EdgeInsetsGeometry
get
padding
{
if
(
_padding
!=
null
)
if
(
_padding
!=
null
)
return
_padding
!;
return
_padding
!;
...
@@ -304,7 +299,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -304,7 +299,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getShape], which is used by [
RaisedButton] and [
FlatButton].
/// * [getShape], which is used by [FlatButton].
ShapeBorder
get
shape
{
ShapeBorder
get
shape
{
if
(
_shape
!=
null
)
if
(
_shape
!=
null
)
return
_shape
!;
return
_shape
!;
...
@@ -333,7 +328,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -333,7 +328,7 @@ class ButtonThemeData with Diagnosticable {
/// This property only affects [DropdownButton] and its menu.
/// This property only affects [DropdownButton] and its menu.
final
bool
alignedDropdown
;
final
bool
alignedDropdown
;
/// The background fill color
for [RaisedButton]s
.
/// The background fill color.
///
///
/// This property is null by default.
/// This property is null by default.
///
///
...
@@ -343,18 +338,17 @@ class ButtonThemeData with Diagnosticable {
...
@@ -343,18 +338,17 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getFillColor], which is used by [RaisedButton] to compute its
/// * [getFillColor], which is used to compute the background fill color.
/// background fill color.
final
Color
?
_buttonColor
;
final
Color
?
_buttonColor
;
/// The background fill color
for disabled [RaisedButton]s
.
/// The background fill color
when disabled
.
///
///
/// This property is null by default.
/// This property is null by default.
///
///
/// See also:
/// See also:
///
///
/// * [getDisabledFillColor], which is
used by [RaisedButton] to compute its
/// * [getDisabledFillColor], which is
to compute background fill color for
///
background fill color
.
///
disabled state
.
final
Color
?
_disabledColor
;
final
Color
?
_disabledColor
;
/// The fill color of the button when it has the input focus.
/// The fill color of the button when it has the input focus.
...
@@ -366,7 +360,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -366,7 +360,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getFocusColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getFocusColor], which is used by [FlatButton].
final
Color
?
_focusColor
;
final
Color
?
_focusColor
;
/// The fill color of the button when a pointer is hovering over it.
/// The fill color of the button when a pointer is hovering over it.
...
@@ -378,7 +372,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -378,7 +372,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getHoverColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getHoverColor], which is used by [FlatButton].
final
Color
?
_hoverColor
;
final
Color
?
_hoverColor
;
/// The color of the overlay that appears when a button is pressed.
/// The color of the overlay that appears when a button is pressed.
...
@@ -387,7 +381,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -387,7 +381,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getHighlightColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getHighlightColor], which is used by [FlatButton].
final
Color
?
_highlightColor
;
final
Color
?
_highlightColor
;
/// The color of the ink "splash" overlay that appears when a button is tapped.
/// The color of the ink "splash" overlay that appears when a button is tapped.
...
@@ -396,7 +390,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -396,7 +390,7 @@ class ButtonThemeData with Diagnosticable {
///
///
/// See also:
/// See also:
///
///
/// * [getSplashColor], which is used by [
RaisedButton] and [
FlatButton].
/// * [getSplashColor], which is used by [FlatButton].
final
Color
?
_splashColor
;
final
Color
?
_splashColor
;
/// A set of thirteen colors that can be used to derive the button theme's
/// A set of thirteen colors that can be used to derive the button theme's
...
@@ -417,7 +411,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -417,7 +411,7 @@ class ButtonThemeData with Diagnosticable {
//
//
// See also:
// See also:
//
//
// * [getMaterialTargetTapSize], which is used by [
RaisedButton] and [
FlatButton].
// * [getMaterialTargetTapSize], which is used by [FlatButton].
final
MaterialTapTargetSize
?
_materialTapTargetSize
;
final
MaterialTapTargetSize
?
_materialTapTargetSize
;
/// The [button]'s overall brightness.
/// The [button]'s overall brightness.
...
@@ -484,9 +478,6 @@ class ButtonThemeData with Diagnosticable {
...
@@ -484,9 +478,6 @@ class ButtonThemeData with Diagnosticable {
/// Otherwise, if button is a [FlatButton] then null is
/// Otherwise, if button is a [FlatButton] then null is
/// returned.
/// 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].
/// Otherwise the fill color depends on the value of [getTextTheme].
///
///
/// * [ButtonTextTheme.normal] or [ButtonTextTheme.accent], the
/// * [ButtonTextTheme.normal] or [ButtonTextTheme.accent], the
...
@@ -505,7 +496,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -505,7 +496,7 @@ class ButtonThemeData with Diagnosticable {
if
(
button
is
FlatButton
||
button
.
runtimeType
==
MaterialButton
)
if
(
button
is
FlatButton
||
button
.
runtimeType
==
MaterialButton
)
return
null
;
return
null
;
if
(
button
.
enabled
&&
button
is
RaisedButton
&&
_buttonColor
!=
null
)
if
(
button
.
enabled
&&
_buttonColor
!=
null
)
return
_buttonColor
;
return
_buttonColor
;
switch
(
getTextTheme
(
button
))
{
switch
(
getTextTheme
(
button
))
{
...
@@ -569,7 +560,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -569,7 +560,7 @@ class ButtonThemeData with Diagnosticable {
/// Returns the button's [MaterialButton.splashColor] if it is non-null.
/// Returns the button's [MaterialButton.splashColor] if it is non-null.
///
///
/// Otherwise, returns the value of the `splashColor` constructor parameter
/// 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
/// Otherwise, returns the value of the `splashColor` constructor parameter
/// if it is non-null and [button] is a [FlatButton] and
/// if it is non-null and [button] is a [FlatButton] and
...
@@ -580,7 +571,7 @@ class ButtonThemeData with Diagnosticable {
...
@@ -580,7 +571,7 @@ class ButtonThemeData with Diagnosticable {
if
(
button
.
splashColor
!=
null
)
if
(
button
.
splashColor
!=
null
)
return
button
.
splashColor
!;
return
button
.
splashColor
!;
if
(
_splashColor
!=
null
&&
button
is
RaisedButton
)
if
(
_splashColor
!=
null
)
return
_splashColor
!;
return
_splashColor
!;
if
(
_splashColor
!=
null
&&
button
is
FlatButton
)
{
if
(
_splashColor
!=
null
&&
button
is
FlatButton
)
{
...
@@ -715,8 +706,8 @@ class ButtonThemeData with Diagnosticable {
...
@@ -715,8 +706,8 @@ class ButtonThemeData with Diagnosticable {
///
///
/// Returns the button's [MaterialButton.padding] if it is non-null.
/// Returns the button's [MaterialButton.padding] if it is non-null.
///
///
/// If this is a button constructed with [
RaisedButton.icon] or
/// If this is a button constructed with [
FlatButton.icon] then the padding
///
[FlatButton.icon] then the padding
is:
/// is:
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
///
///
/// Otherwise, returns [padding] if it is non-null.
/// 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';
...
@@ -14,11 +14,8 @@ import 'theme_data.dart';
///
///
/// ### This class is deprecated, please use [TextButton] instead.
/// ### This class is deprecated, please use [TextButton] instead.
///
///
/// FlatButton and RaisedButton have been replaced by
/// FlatButton have been replaced by [TextButton] and ButtonTheme has been
/// [TextButton] and [ElevatedButton] respectively.
/// replaced by [TextButtonTheme]. Please migrate code that uses them.
/// ButtonTheme has been replaced by [TextButtonTheme] and
/// [ElevatedButtonTheme]. The original classes
/// will eventually be removed, please migrate code that uses them.
/// There's a detailed migration guide for the new button and button
/// There's a detailed migration guide for the new button and button
/// theme classes in
/// theme classes in
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
/// [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';
...
@@ -21,10 +21,8 @@ import 'theme_data.dart';
///
///
/// ### This class is obsolete.
/// ### This class is obsolete.
///
///
/// FlatButton and RaisedButton have been replaced by
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
/// TextButton and ElevatedButton respectively.
/// by TextButtonTheme. The appearance of the
/// ButtonTheme has been replaced by TextButtonTheme and
/// ElevatedButtonTheme. The appearance of the
/// new widgets can be customized by specifying a [ButtonStyle]
/// new widgets can be customized by specifying a [ButtonStyle]
/// or by creating a one-off style using a `styleFrom` method like
/// or by creating a one-off style using a `styleFrom` method like
/// [TextButton.styleFrom]. The original button classes
/// [TextButton.styleFrom]. The original button classes
...
@@ -38,9 +36,9 @@ import 'theme_data.dart';
...
@@ -38,9 +36,9 @@ import 'theme_data.dart';
/// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have
/// 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].
/// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress].
///
///
/// Rather than using this class directly, consider using [FlatButton]
/// Rather than using this class directly, consider using [FlatButton]
, which
///
or [RaisedButton], which configure this class with
///
configure this class with appropriate defaults that match the material
///
appropriate defaults that match the material
design specification.
/// design specification.
///
///
/// To create a button directly, without inheriting theme defaults, use
/// To create a button directly, without inheriting theme defaults, use
/// [RawMaterialButton].
/// [RawMaterialButton].
...
@@ -55,7 +53,7 @@ class MaterialButton extends StatelessWidget {
...
@@ -55,7 +53,7 @@ class MaterialButton extends StatelessWidget {
/// Creates a material button.
/// Creates a material button.
///
///
/// Rather than creating a material button directly, consider using
/// 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].
/// consider using [RawMaterialButton].
///
///
/// The [autofocus] and [clipBehavior] arguments must not be null.
/// The [autofocus] and [clipBehavior] arguments must not be null.
...
@@ -457,8 +455,7 @@ class MaterialButton extends StatelessWidget {
...
@@ -457,8 +455,7 @@ class MaterialButton extends StatelessWidget {
}
}
}
}
/// The type of [MaterialButton]s created with RaisedButton.icon] and
/// The type of [MaterialButton]s created with FlatButton.icon.
/// FlatButton.icon.
///
///
/// This mixin only exists to give the "label and icon" button widgets a distinct
/// This mixin only exists to give the "label and icon" button widgets a distinct
/// type for the sake of [ButtonTheme].
/// 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);
...
@@ -115,7 +115,6 @@ const Color _kDarkThemeSplashColor = Color(0x40CCCCCC);
/// * [TextButton]
/// * [TextButton]
/// * [ElevatedButton]
/// * [ElevatedButton]
/// * [FlatButton]
/// * [FlatButton]
/// * [RaisedButton]
/// * The time picker widget ([showTimePicker])
/// * The time picker widget ([showTimePicker])
/// * [SnackBar]
/// * [SnackBar]
/// * [Chip]
/// * [Chip]
...
@@ -524,7 +523,6 @@ class ThemeData with Diagnosticable {
...
@@ -524,7 +523,6 @@ class ThemeData with Diagnosticable {
// [disabledColor], [highlightColor], and [splashColor].
// [disabledColor], [highlightColor], and [splashColor].
buttonTheme
??=
ButtonThemeData
(
buttonTheme
??=
ButtonThemeData
(
colorScheme:
colorScheme
,
colorScheme:
colorScheme
,
// Defaults to the fill color for RaisedButtons for backwards compatibility.
buttonColor:
buttonColor
??
(
isDark
?
primarySwatch
[
600
]!
:
Colors
.
grey
[
300
]!),
buttonColor:
buttonColor
??
(
isDark
?
primarySwatch
[
600
]!
:
Colors
.
grey
[
300
]!),
disabledColor:
disabledColor
,
disabledColor:
disabledColor
,
focusColor:
focusColor
,
focusColor:
focusColor
,
...
@@ -1423,8 +1421,7 @@ class ThemeData with Diagnosticable {
...
@@ -1423,8 +1421,7 @@ class ThemeData with Diagnosticable {
/// A theme for customizing the appearance and layout of [ButtonBar] widgets.
/// A theme for customizing the appearance and layout of [ButtonBar] widgets.
final
ButtonBarThemeData
buttonBarTheme
;
final
ButtonBarThemeData
buttonBarTheme
;
/// Defines the default configuration of button widgets, like [RaisedButton]
/// Defines the default configuration of button widgets, like [FlatButton].
/// and [FlatButton].
final
ButtonThemeData
buttonTheme
;
final
ButtonThemeData
buttonTheme
;
/// The colors and styles used to render [Card].
/// The colors and styles used to render [Card].
...
@@ -1627,7 +1624,7 @@ class ThemeData with Diagnosticable {
...
@@ -1627,7 +1624,7 @@ class ThemeData with Diagnosticable {
)
)
final
IconThemeData
accentIconTheme
;
final
IconThemeData
accentIconTheme
;
/// The default fill color of the [Material]
used in [RaisedButton]s
.
/// The default fill color of the [Material].
@Deprecated
(
@Deprecated
(
'No longer used by the framework, please remove any reference to it. '
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.3.0-0.2.pre.'
,
'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() {
...
@@ -117,112 +117,6 @@ void main() {
expect
(
theme
.
colorScheme
,
const
ColorScheme
.
dark
());
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
{
testWidgets
(
'ButtonTheme alignedDropdown'
,
(
WidgetTester
tester
)
async
{
final
Key
dropdownKey
=
UniqueKey
();
final
Key
dropdownKey
=
UniqueKey
();
...
...
packages/flutter/test/material/inherited_theme_test.dart
View file @
afe6c2e7
...
@@ -607,99 +607,5 @@ void main() {
...
@@ -607,99 +607,5 @@ void main() {
await
tester
.
pumpAndSettle
();
// route animation
await
tester
.
pumpAndSettle
();
// route animation
expect
(
getTextColor
(
'selected'
),
isNot
(
selectedButtonColor
));
expect
(
getTextColor
(
'selected'
),
isNot
(
selectedButtonColor
));
expect
(
getTextColor
(
'unselected'
),
isNot
(
buttonColor
));
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() {
...
@@ -10364,11 +10364,11 @@ void main() {
onTap:
()
{
textFieldTapCount
+=
1
;
},
onTap:
()
{
textFieldTapCount
+=
1
;
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
'Label'
,
labelText:
'Label'
,
prefix:
Rais
edButton
(
prefix:
Elevat
edButton
(
onPressed:
()
{
prefixTapCount
+=
1
;
},
onPressed:
()
{
prefixTapCount
+=
1
;
},
child:
const
Text
(
'prefix'
),
child:
const
Text
(
'prefix'
),
),
),
suffix:
Rais
edButton
(
suffix:
Elevat
edButton
(
onPressed:
()
{
suffixTapCount
+=
1
;
},
onPressed:
()
{
suffixTapCount
+=
1
;
},
child:
const
Text
(
'suffix'
),
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
...
@@ -11,64 +11,6 @@ const BoxConstraints defaultButtonConstraints = BoxConstraints(minWidth: 88.0, m
const
Duration
defaultButtonDuration
=
Duration
(
milliseconds:
200
);
const
Duration
defaultButtonDuration
=
Duration
(
milliseconds:
200
);
void
main
(
)
{
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'
,
()
{
group
(
'FlatButton'
,
()
{
testWidgets
(
'theme: ThemeData.light(), enabled: true'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'theme: ThemeData.light(), enabled: true'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
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