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
9240c9a0
Unverified
Commit
9240c9a0
authored
Mar 08, 2022
by
Kate Lovett
Committed by
GitHub
Mar 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated OutlineButton (#98546)
parent
cd9e30bb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
45 additions
and
1972 deletions
+45
-1972
material.dart
packages/flutter/lib/material.dart
+0
-1
button.dart
packages/flutter/lib/src/material/button.dart
+4
-4
button_theme.dart
packages/flutter/lib/src/material/button_theme.dart
+25
-39
flat_button.dart
packages/flutter/lib/src/material/flat_button.dart
+4
-4
material_button.dart
packages/flutter/lib/src/material/material_button.dart
+8
-8
outline_button.dart
packages/flutter/lib/src/material/outline_button.dart
+0
-587
raised_button.dart
packages/flutter/lib/src/material/raised_button.dart
+4
-4
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+0
-2
outline_button_test.dart
packages/flutter/test/material/outline_button_test.dart
+0
-1236
theme_defaults_test.dart
packages/flutter/test/material/theme_defaults_test.dart
+0
-87
No files found.
packages/flutter/lib/material.dart
View file @
9240c9a0
...
...
@@ -104,7 +104,6 @@ export 'src/material/navigation_bar_theme.dart';
export
'src/material/navigation_rail.dart'
;
export
'src/material/navigation_rail_theme.dart'
;
export
'src/material/no_splash.dart'
;
export
'src/material/outline_button.dart'
;
export
'src/material/outlined_button.dart'
;
export
'src/material/outlined_button_theme.dart'
;
export
'src/material/page.dart'
;
...
...
packages/flutter/lib/src/material/button.dart
View file @
9240c9a0
...
...
@@ -26,10 +26,10 @@ import 'theme_data.dart';
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
/// [OutlinedButton].
///
/// FlatButton
, RaisedButton, and Outline
Button have been replaced by
/// TextButton
, ElevatedButton, and Outlin
edButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme
,
/// ElevatedButtonTheme
, and OutlinedButtonTheme
. The original classes
/// FlatButton
and Raised
Button have been replaced by
/// TextButton
and Elevat
edButton respectively.
/// 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
/// theme classes in
...
...
packages/flutter/lib/src/material/button_theme.dart
View file @
9240c9a0
...
...
@@ -11,7 +11,6 @@ import 'constants.dart';
import
'flat_button.dart'
;
import
'material_button.dart'
;
import
'material_state.dart'
;
import
'outline_button.dart'
;
import
'raised_button.dart'
;
import
'theme.dart'
;
import
'theme_data.dart'
show
MaterialTapTargetSize
;
...
...
@@ -22,7 +21,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
///
/// See also:
///
/// * [RaisedButton]
, [FlatButton], [OutlineButton],
which are configured
/// * [RaisedButton]
and [FlatButton]
which are configured
/// based on the ambient [ButtonTheme].
enum
ButtonTextTheme
{
/// Button text is black or white depending on [ThemeData.brightness].
...
...
@@ -69,7 +68,7 @@ enum ButtonBarLayoutBehavior {
///
/// See also:
///
/// * [FlatButton]
[RaisedButton], and [OutlineButton],
which are styled
/// * [FlatButton]
and [RaisedButton]
which are styled
/// based on the ambient button theme.
/// * [RawMaterialButton], which can be used to configure a button that doesn't
/// depend on any inherited themes.
...
...
@@ -175,10 +174,10 @@ class ButtonTheme extends InheritedTheme {
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
///
/// FlatButton
, RaisedButton, and Outline
Button have been replaced by
/// TextButton
, ElevatedButton, and Outlin
edButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme
,
/// ElevatedButtonTheme
, and OutlinedButtonTheme
. The original classes
/// FlatButton
and Raised
Button have been replaced by
/// TextButton
and Elevat
edButton respectively.
/// 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
/// theme classes in
...
...
@@ -197,8 +196,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]
,
///
[OutlineButton],
and [FlatButton] to configure a [RawMaterialButton].
/// have a name with a `get` prefix are used by [RaisedButton]
/// and [FlatButton] to configure a [RawMaterialButton].
const
ButtonThemeData
({
this
.
textTheme
=
ButtonTextTheme
.
normal
,
this
.
minWidth
=
88.0
,
...
...
@@ -279,8 +278,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getPadding], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getPadding], which is used by [RaisedButton] and [FlatButton].
EdgeInsetsGeometry
get
padding
{
if
(
_padding
!=
null
)
return
_padding
!;
...
...
@@ -306,8 +304,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getShape], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getShape], which is used by [RaisedButton] and [FlatButton].
ShapeBorder
get
shape
{
if
(
_shape
!=
null
)
return
_shape
!;
...
...
@@ -369,8 +366,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getFocusColor], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getFocusColor], which is used by [RaisedButton] and [FlatButton].
final
Color
?
_focusColor
;
/// The fill color of the button when a pointer is hovering over it.
...
...
@@ -382,8 +378,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getHoverColor], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getHoverColor], which is used by [RaisedButton] and [FlatButton].
final
Color
?
_hoverColor
;
/// The color of the overlay that appears when a button is pressed.
...
...
@@ -392,8 +387,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getHighlightColor], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getHighlightColor], which is used by [RaisedButton] and [FlatButton].
final
Color
?
_highlightColor
;
/// The color of the ink "splash" overlay that appears when a button is tapped.
...
...
@@ -402,8 +396,7 @@ class ButtonThemeData with Diagnosticable {
///
/// See also:
///
/// * [getSplashColor], which is used by [RaisedButton], [OutlineButton]
/// and [FlatButton].
/// * [getSplashColor], which is used by [RaisedButton] and [FlatButton].
final
Color
?
_splashColor
;
/// A set of thirteen colors that can be used to derive the button theme's
...
...
@@ -424,8 +417,7 @@ class ButtonThemeData with Diagnosticable {
//
// See also:
//
// * [getMaterialTargetTapSize], which is used by [RaisedButton],
// [OutlineButton] and [FlatButton].
// * [getMaterialTargetTapSize], which is used by [RaisedButton] and [FlatButton].
final
MaterialTapTargetSize
?
_materialTapTargetSize
;
/// The [button]'s overall brightness.
...
...
@@ -489,7 +481,7 @@ class ButtonThemeData with Diagnosticable {
/// Otherwise, returns [MaterialButton.disabledColor] if it is non-null and
/// the button is disabled.
///
/// Otherwise, if button is a [FlatButton]
or an [OutlineButton]
then null is
/// Otherwise, if button is a [FlatButton] then null is
/// returned.
///
/// Otherwise, if button is a [RaisedButton], returns the `buttonColor`
...
...
@@ -510,7 +502,7 @@ class ButtonThemeData with Diagnosticable {
if
(
fillColor
!=
null
)
return
fillColor
;
if
(
button
is
FlatButton
||
button
is
OutlineButton
||
button
.
runtimeType
==
MaterialButton
)
if
(
button
is
FlatButton
||
button
.
runtimeType
==
MaterialButton
)
return
null
;
if
(
button
.
enabled
&&
button
is
RaisedButton
&&
_buttonColor
!=
null
)
...
...
@@ -542,7 +534,7 @@ class ButtonThemeData with Diagnosticable {
/// [getBrightness] resolves to [Brightness.light].
/// * [ButtonTextTheme.accent]: [ColorScheme.secondary] of [colorScheme].
/// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white],
/// otherwise if [button] is a [FlatButton]
or an [OutlineButton]
then
/// otherwise if [button] is a [FlatButton] then
/// [ColorScheme.primary] of [colorScheme], otherwise [Colors.black].
Color
getTextColor
(
MaterialButton
button
)
{
if
(!
button
.
enabled
)
...
...
@@ -565,7 +557,7 @@ class ButtonThemeData with Diagnosticable {
:
getBrightness
(
button
)
==
Brightness
.
dark
;
if
(
fillIsDark
)
return
Colors
.
white
;
if
(
button
is
FlatButton
||
button
is
OutlineButton
)
if
(
button
is
FlatButton
)
return
colorScheme
!.
primary
;
return
Colors
.
black
;
}
...
...
@@ -577,7 +569,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]
or an [OutlineButton]
.
/// it is non-null and [button] is a [RaisedButton].
///
/// Otherwise, returns the value of the `splashColor` constructor parameter
/// if it is non-null and [button] is a [FlatButton] and
...
...
@@ -588,7 +580,7 @@ class ButtonThemeData with Diagnosticable {
if
(
button
.
splashColor
!=
null
)
return
button
.
splashColor
!;
if
(
_splashColor
!=
null
&&
(
button
is
RaisedButton
||
button
is
OutlineButton
)
)
if
(
_splashColor
!=
null
&&
button
is
RaisedButton
)
return
_splashColor
!;
if
(
_splashColor
!=
null
&&
button
is
FlatButton
)
{
...
...
@@ -669,15 +661,13 @@ class ButtonThemeData with Diagnosticable {
///
/// Returns the button's [MaterialButton.focusElevation] if it is non-null.
///
/// If button is a [FlatButton]
or an [OutlineButton]
then the focus
/// If button is a [FlatButton] then the focus
/// elevation is 0.0, otherwise the highlight elevation is 4.0.
double
getFocusElevation
(
MaterialButton
button
)
{
if
(
button
.
focusElevation
!=
null
)
return
button
.
focusElevation
!;
if
(
button
is
FlatButton
)
return
0.0
;
if
(
button
is
OutlineButton
)
return
0.0
;
return
4.0
;
}
...
...
@@ -685,15 +675,13 @@ class ButtonThemeData with Diagnosticable {
///
/// Returns the button's [MaterialButton.hoverElevation] if it is non-null.
///
/// If button is a [FlatButton]
or an [OutlineButton]
then the hover
/// If button is a [FlatButton] then the hover
/// elevation is 0.0, otherwise the highlight elevation is 4.0.
double
getHoverElevation
(
MaterialButton
button
)
{
if
(
button
.
hoverElevation
!=
null
)
return
button
.
hoverElevation
!;
if
(
button
is
FlatButton
)
return
0.0
;
if
(
button
is
OutlineButton
)
return
0.0
;
return
4.0
;
}
...
...
@@ -701,15 +689,13 @@ class ButtonThemeData with Diagnosticable {
///
/// Returns the button's [MaterialButton.highlightElevation] if it is non-null.
///
/// If button is a [FlatButton]
or an [OutlineButton]
then the highlight
/// If button is a [FlatButton] then the highlight
/// elevation is 0.0, otherwise the highlight elevation is 8.0.
double
getHighlightElevation
(
MaterialButton
button
)
{
if
(
button
.
highlightElevation
!=
null
)
return
button
.
highlightElevation
!;
if
(
button
is
FlatButton
)
return
0.0
;
if
(
button
is
OutlineButton
)
return
0.0
;
return
8.0
;
}
...
...
@@ -730,7 +716,7 @@ 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]
or [OutlineButton.icon]
then the padding is:
/// [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 @
9240c9a0
...
...
@@ -14,10 +14,10 @@ import 'theme_data.dart';
///
/// ### This class is deprecated, please use [TextButton] instead.
///
/// FlatButton
, RaisedButton, and Outline
Button have been replaced by
/// [TextButton]
, [ElevatedButton], and [Outlin
edButton] respectively.
/// ButtonTheme has been replaced by [TextButtonTheme]
,
/// [ElevatedButtonTheme]
, and [OutlinedButtonTheme]
. The original classes
/// FlatButton
and Raised
Button have been replaced by
/// [TextButton]
and [Elevat
edButton] respectively.
/// 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
/// theme classes in
...
...
packages/flutter/lib/src/material/material_button.dart
View file @
9240c9a0
...
...
@@ -21,10 +21,10 @@ import 'theme_data.dart';
///
/// ### This class is obsolete.
///
/// FlatButton
, RaisedButton, and Outline
Button have been replaced by
/// TextButton
, ElevatedButton, and Outlin
edButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme
,
/// ElevatedButtonTheme
, and OutlinedButtonTheme
. The appearance of the
/// FlatButton
and Raised
Button have been replaced by
/// TextButton
and Elevat
edButton respectively.
/// ButtonTheme has been replaced by TextButtonTheme
and
/// ElevatedButtonTheme. 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,8 +38,8 @@ 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]
,
///
[OutlineButton],
or [RaisedButton], which configure this class with
/// Rather than using this class directly, consider using [FlatButton]
/// or [RaisedButton], which configure this class with
/// appropriate defaults that match the material design specification.
///
/// To create a button directly, without inheriting theme defaults, use
...
...
@@ -457,8 +457,8 @@ class MaterialButton extends StatelessWidget {
}
}
/// The type of [MaterialButton]s created with RaisedButton.icon
, FlatButton.icon,
///
and Outline
Button.icon.
/// The type of [MaterialButton]s created with RaisedButton.icon
] and
///
Flat
Button.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/outline_button.dart
deleted
100644 → 0
View file @
cd9e30bb
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/raised_button.dart
View file @
9240c9a0
...
...
@@ -16,10 +16,10 @@ import 'theme_data.dart';
///
/// ### This class is deprecated, please use [ElevatedButton] instead.
///
/// FlatButton
, RaisedButton, and Outline
Button have been replaced by
/// [TextButton]
, [ElevatedButton], and [Outlin
edButton] respectively.
/// ButtonTheme has been replaced by [TextButtonTheme]
,
/// [ElevatedButtonTheme]
, and [OutlinedButtonTheme]
. The original classes
/// FlatButton
and Raised
Button have been replaced by
/// [TextButton]
and [Elevat
edButton] respectively.
/// 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
/// theme classes in
...
...
packages/flutter/lib/src/material/theme_data.dart
View file @
9240c9a0
...
...
@@ -81,7 +81,6 @@ const Color _kDarkThemeSplashColor = Color(0x40CCCCCC);
/// * [OutlinedButton]
/// * [TextButton]
/// * [ElevatedButton]
/// * [OutlineButton]
/// * [FlatButton]
/// * [RaisedButton]
/// * The time picker widget ([showTimePicker])
...
...
@@ -2469,7 +2468,6 @@ class _FifoCache<K, V> {
/// * [InputDecorator] (which gives density support to [TextField], etc.)
/// * [ListTile]
/// * [MaterialButton]
/// * [OutlineButton]
/// * [OutlinedButton]
/// * [Radio]
/// * [RawMaterialButton]
...
...
packages/flutter/test/material/outline_button_test.dart
deleted
100644 → 0
View file @
cd9e30bb
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/theme_defaults_test.dart
View file @
9240c9a0
...
...
@@ -127,93 +127,6 @@ void main() {
});
});
group
(
'OutlineButton'
,
()
{
testWidgets
(
'theme: ThemeData.light(), enabled: true, highlightElevation: 2.0'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
light
(),
home:
Center
(
child:
OutlineButton
(
onPressed:
()
{
},
// button.enabled == true
// Causes the button to be filled with the theme's canvasColor
// instead of Colors.transparent before the button material's
// elevation is animated to 2.0.
highlightElevation:
2.0
,
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
(
0x00fafafa
));
expect
(
raw
.
highlightColor
,
const
Color
(
0x29000000
));
// Was Color(0x66bcbcbc)
expect
(
raw
.
splashColor
,
const
Color
(
0x1f000000
));
// Was Color(0x66c8c8c8)
expect
(
raw
.
elevation
,
0.0
);
expect
(
raw
.
highlightElevation
,
0.0
);
expect
(
raw
.
disabledElevation
,
0.0
);
expect
(
raw
.
constraints
,
defaultButtonConstraints
);
expect
(
raw
.
padding
,
defaultButtonPadding
);
// animationDuration can't be configured by the theme/constructor
expect
(
raw
.
materialTapTargetSize
,
MaterialTapTargetSize
.
padded
);
});
testWidgets
(
'theme: ThemeData.light(), enabled: true'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
light
(),
home:
Center
(
child:
OutlineButton
(
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
,
Colors
.
transparent
);
expect
(
raw
.
highlightColor
,
const
Color
(
0x29000000
));
// Was Color(0x66bcbcbc)
expect
(
raw
.
splashColor
,
const
Color
(
0x1f000000
));
// Was Color(0x66c8c8c8)
expect
(
raw
.
elevation
,
0.0
);
expect
(
raw
.
highlightElevation
,
0.0
);
expect
(
raw
.
disabledElevation
,
0.0
);
expect
(
raw
.
constraints
,
defaultButtonConstraints
);
expect
(
raw
.
padding
,
defaultButtonPadding
);
// animationDuration can't be configured by the theme/constructor
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:
OutlineButton
(
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
(
0x00000000
));
// highlightColor, disabled button can't be pressed
// splashColor, disabled button doesn't splash
expect
(
raw
.
elevation
,
0.0
);
expect
(
raw
.
highlightElevation
,
0.0
);
expect
(
raw
.
disabledElevation
,
0.0
);
expect
(
raw
.
constraints
,
defaultButtonConstraints
);
expect
(
raw
.
padding
,
defaultButtonPadding
);
// animationDuration can't be configured by the theme/constructor
expect
(
raw
.
materialTapTargetSize
,
MaterialTapTargetSize
.
padded
);
});
});
group
(
'FloatingActionButton'
,
()
{
const
BoxConstraints
defaultFABConstraints
=
BoxConstraints
.
tightFor
(
width:
56.0
,
height:
56.0
);
const
ShapeBorder
defaultFABShape
=
CircleBorder
();
...
...
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