Skip to content

Commit 9240c9a

Browse files
authored
Remove deprecated OutlineButton (#98546)
1 parent cd9e30b commit 9240c9a

File tree

10 files changed

+45
-1972
lines changed

10 files changed

+45
-1972
lines changed

packages/flutter/lib/material.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export 'src/material/navigation_bar_theme.dart';
104104
export 'src/material/navigation_rail.dart';
105105
export 'src/material/navigation_rail_theme.dart';
106106
export 'src/material/no_splash.dart';
107-
export 'src/material/outline_button.dart';
108107
export 'src/material/outlined_button.dart';
109108
export 'src/material/outlined_button_theme.dart';
110109
export 'src/material/page.dart';

packages/flutter/lib/src/material/button.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import 'theme_data.dart';
2626
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
2727
/// [OutlinedButton].
2828
///
29-
/// FlatButton, RaisedButton, and OutlineButton have been replaced by
30-
/// TextButton, ElevatedButton, and OutlinedButton respectively.
31-
/// ButtonTheme has been replaced by TextButtonTheme,
32-
/// ElevatedButtonTheme, and OutlinedButtonTheme. The original classes
29+
/// FlatButton and RaisedButton have been replaced by
30+
/// TextButton and ElevatedButton respectively.
31+
/// ButtonTheme has been replaced by TextButtonTheme and
32+
/// ElevatedButtonTheme. The original classes
3333
/// have been deprecated, please migrate code that uses them.
3434
/// There's a detailed migration guide for the new button and button
3535
/// theme classes in

packages/flutter/lib/src/material/button_theme.dart

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'constants.dart';
1111
import 'flat_button.dart';
1212
import 'material_button.dart';
1313
import 'material_state.dart';
14-
import 'outline_button.dart';
1514
import 'raised_button.dart';
1615
import 'theme.dart';
1716
import 'theme_data.dart' show MaterialTapTargetSize;
@@ -22,7 +21,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
2221
///
2322
/// See also:
2423
///
25-
/// * [RaisedButton], [FlatButton], [OutlineButton], which are configured
24+
/// * [RaisedButton] and [FlatButton] which are configured
2625
/// based on the ambient [ButtonTheme].
2726
enum ButtonTextTheme {
2827
/// Button text is black or white depending on [ThemeData.brightness].
@@ -69,7 +68,7 @@ enum ButtonBarLayoutBehavior {
6968
///
7069
/// See also:
7170
///
72-
/// * [FlatButton] [RaisedButton], and [OutlineButton], which are styled
71+
/// * [FlatButton] and [RaisedButton] which are styled
7372
/// based on the ambient button theme.
7473
/// * [RawMaterialButton], which can be used to configure a button that doesn't
7574
/// depend on any inherited themes.
@@ -175,10 +174,10 @@ class ButtonTheme extends InheritedTheme {
175174
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
176175
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
177176
///
178-
/// FlatButton, RaisedButton, and OutlineButton have been replaced by
179-
/// TextButton, ElevatedButton, and OutlinedButton respectively.
180-
/// ButtonTheme has been replaced by TextButtonTheme,
181-
/// ElevatedButtonTheme, and OutlinedButtonTheme. The original classes
177+
/// FlatButton and RaisedButton have been replaced by
178+
/// TextButton and ElevatedButton respectively.
179+
/// ButtonTheme has been replaced by TextButtonTheme and
180+
/// ElevatedButtonTheme. The original classes
182181
/// have been deprecated, please migrate code that uses them.
183182
/// There's a detailed migration guide for the new button and button
184183
/// theme classes in
@@ -197,8 +196,8 @@ class ButtonThemeData with Diagnosticable {
197196
/// [height] parameters must greater than or equal to zero.
198197
///
199198
/// The ButtonTheme's methods that have a [MaterialButton] parameter and
200-
/// have a name with a `get` prefix are used by [RaisedButton],
201-
/// [OutlineButton], and [FlatButton] to configure a [RawMaterialButton].
199+
/// have a name with a `get` prefix are used by [RaisedButton]
200+
/// and [FlatButton] to configure a [RawMaterialButton].
202201
const ButtonThemeData({
203202
this.textTheme = ButtonTextTheme.normal,
204203
this.minWidth = 88.0,
@@ -279,8 +278,7 @@ class ButtonThemeData with Diagnosticable {
279278
///
280279
/// See also:
281280
///
282-
/// * [getPadding], which is used by [RaisedButton], [OutlineButton]
283-
/// and [FlatButton].
281+
/// * [getPadding], which is used by [RaisedButton] and [FlatButton].
284282
EdgeInsetsGeometry get padding {
285283
if (_padding != null)
286284
return _padding!;
@@ -306,8 +304,7 @@ class ButtonThemeData with Diagnosticable {
306304
///
307305
/// See also:
308306
///
309-
/// * [getShape], which is used by [RaisedButton], [OutlineButton]
310-
/// and [FlatButton].
307+
/// * [getShape], which is used by [RaisedButton] and [FlatButton].
311308
ShapeBorder get shape {
312309
if (_shape != null)
313310
return _shape!;
@@ -369,8 +366,7 @@ class ButtonThemeData with Diagnosticable {
369366
///
370367
/// See also:
371368
///
372-
/// * [getFocusColor], which is used by [RaisedButton], [OutlineButton]
373-
/// and [FlatButton].
369+
/// * [getFocusColor], which is used by [RaisedButton] and [FlatButton].
374370
final Color? _focusColor;
375371

376372
/// The fill color of the button when a pointer is hovering over it.
@@ -382,8 +378,7 @@ class ButtonThemeData with Diagnosticable {
382378
///
383379
/// See also:
384380
///
385-
/// * [getHoverColor], which is used by [RaisedButton], [OutlineButton]
386-
/// and [FlatButton].
381+
/// * [getHoverColor], which is used by [RaisedButton] and [FlatButton].
387382
final Color? _hoverColor;
388383

389384
/// The color of the overlay that appears when a button is pressed.
@@ -392,8 +387,7 @@ class ButtonThemeData with Diagnosticable {
392387
///
393388
/// See also:
394389
///
395-
/// * [getHighlightColor], which is used by [RaisedButton], [OutlineButton]
396-
/// and [FlatButton].
390+
/// * [getHighlightColor], which is used by [RaisedButton] and [FlatButton].
397391
final Color? _highlightColor;
398392

399393
/// The color of the ink "splash" overlay that appears when a button is tapped.
@@ -402,8 +396,7 @@ class ButtonThemeData with Diagnosticable {
402396
///
403397
/// See also:
404398
///
405-
/// * [getSplashColor], which is used by [RaisedButton], [OutlineButton]
406-
/// and [FlatButton].
399+
/// * [getSplashColor], which is used by [RaisedButton] and [FlatButton].
407400
final Color? _splashColor;
408401

409402
/// A set of thirteen colors that can be used to derive the button theme's
@@ -424,8 +417,7 @@ class ButtonThemeData with Diagnosticable {
424417
//
425418
// See also:
426419
//
427-
// * [getMaterialTargetTapSize], which is used by [RaisedButton],
428-
// [OutlineButton] and [FlatButton].
420+
// * [getMaterialTargetTapSize], which is used by [RaisedButton] and [FlatButton].
429421
final MaterialTapTargetSize? _materialTapTargetSize;
430422

431423
/// The [button]'s overall brightness.
@@ -489,7 +481,7 @@ class ButtonThemeData with Diagnosticable {
489481
/// Otherwise, returns [MaterialButton.disabledColor] if it is non-null and
490482
/// the button is disabled.
491483
///
492-
/// Otherwise, if button is a [FlatButton] or an [OutlineButton] then null is
484+
/// Otherwise, if button is a [FlatButton] then null is
493485
/// returned.
494486
///
495487
/// Otherwise, if button is a [RaisedButton], returns the `buttonColor`
@@ -510,7 +502,7 @@ class ButtonThemeData with Diagnosticable {
510502
if (fillColor != null)
511503
return fillColor;
512504

513-
if (button is FlatButton || button is OutlineButton || button.runtimeType == MaterialButton)
505+
if (button is FlatButton || button.runtimeType == MaterialButton)
514506
return null;
515507

516508
if (button.enabled && button is RaisedButton && _buttonColor != null)
@@ -542,7 +534,7 @@ class ButtonThemeData with Diagnosticable {
542534
/// [getBrightness] resolves to [Brightness.light].
543535
/// * [ButtonTextTheme.accent]: [ColorScheme.secondary] of [colorScheme].
544536
/// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white],
545-
/// otherwise if [button] is a [FlatButton] or an [OutlineButton] then
537+
/// otherwise if [button] is a [FlatButton] then
546538
/// [ColorScheme.primary] of [colorScheme], otherwise [Colors.black].
547539
Color getTextColor(MaterialButton button) {
548540
if (!button.enabled)
@@ -565,7 +557,7 @@ class ButtonThemeData with Diagnosticable {
565557
: getBrightness(button) == Brightness.dark;
566558
if (fillIsDark)
567559
return Colors.white;
568-
if (button is FlatButton || button is OutlineButton)
560+
if (button is FlatButton)
569561
return colorScheme!.primary;
570562
return Colors.black;
571563
}
@@ -577,7 +569,7 @@ class ButtonThemeData with Diagnosticable {
577569
/// Returns the button's [MaterialButton.splashColor] if it is non-null.
578570
///
579571
/// Otherwise, returns the value of the `splashColor` constructor parameter
580-
/// it is non-null and [button] is a [RaisedButton] or an [OutlineButton].
572+
/// it is non-null and [button] is a [RaisedButton].
581573
///
582574
/// Otherwise, returns the value of the `splashColor` constructor parameter
583575
/// if it is non-null and [button] is a [FlatButton] and
@@ -588,7 +580,7 @@ class ButtonThemeData with Diagnosticable {
588580
if (button.splashColor != null)
589581
return button.splashColor!;
590582

591-
if (_splashColor != null && (button is RaisedButton || button is OutlineButton))
583+
if (_splashColor != null && button is RaisedButton)
592584
return _splashColor!;
593585

594586
if (_splashColor != null && button is FlatButton) {
@@ -669,47 +661,41 @@ class ButtonThemeData with Diagnosticable {
669661
///
670662
/// Returns the button's [MaterialButton.focusElevation] if it is non-null.
671663
///
672-
/// If button is a [FlatButton] or an [OutlineButton] then the focus
664+
/// If button is a [FlatButton] then the focus
673665
/// elevation is 0.0, otherwise the highlight elevation is 4.0.
674666
double getFocusElevation(MaterialButton button) {
675667
if (button.focusElevation != null)
676668
return button.focusElevation!;
677669
if (button is FlatButton)
678670
return 0.0;
679-
if (button is OutlineButton)
680-
return 0.0;
681671
return 4.0;
682672
}
683673

684674
/// The [button]'s elevation when it is enabled and has focus.
685675
///
686676
/// Returns the button's [MaterialButton.hoverElevation] if it is non-null.
687677
///
688-
/// If button is a [FlatButton] or an [OutlineButton] then the hover
678+
/// If button is a [FlatButton] then the hover
689679
/// elevation is 0.0, otherwise the highlight elevation is 4.0.
690680
double getHoverElevation(MaterialButton button) {
691681
if (button.hoverElevation != null)
692682
return button.hoverElevation!;
693683
if (button is FlatButton)
694684
return 0.0;
695-
if (button is OutlineButton)
696-
return 0.0;
697685
return 4.0;
698686
}
699687

700688
/// The [button]'s elevation when it is enabled and has been pressed.
701689
///
702690
/// Returns the button's [MaterialButton.highlightElevation] if it is non-null.
703691
///
704-
/// If button is a [FlatButton] or an [OutlineButton] then the highlight
692+
/// If button is a [FlatButton] then the highlight
705693
/// elevation is 0.0, otherwise the highlight elevation is 8.0.
706694
double getHighlightElevation(MaterialButton button) {
707695
if (button.highlightElevation != null)
708696
return button.highlightElevation!;
709697
if (button is FlatButton)
710698
return 0.0;
711-
if (button is OutlineButton)
712-
return 0.0;
713699
return 8.0;
714700
}
715701

@@ -730,7 +716,7 @@ class ButtonThemeData with Diagnosticable {
730716
/// Returns the button's [MaterialButton.padding] if it is non-null.
731717
///
732718
/// If this is a button constructed with [RaisedButton.icon] or
733-
/// [FlatButton.icon] or [OutlineButton.icon] then the padding is:
719+
/// [FlatButton.icon] then the padding is:
734720
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
735721
///
736722
/// Otherwise, returns [padding] if it is non-null.

packages/flutter/lib/src/material/flat_button.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import 'theme_data.dart';
1414
///
1515
/// ### This class is deprecated, please use [TextButton] instead.
1616
///
17-
/// FlatButton, RaisedButton, and OutlineButton have been replaced by
18-
/// [TextButton], [ElevatedButton], and [OutlinedButton] respectively.
19-
/// ButtonTheme has been replaced by [TextButtonTheme],
20-
/// [ElevatedButtonTheme], and [OutlinedButtonTheme]. The original classes
17+
/// FlatButton and RaisedButton have been replaced by
18+
/// [TextButton] and [ElevatedButton] respectively.
19+
/// ButtonTheme has been replaced by [TextButtonTheme] and
20+
/// [ElevatedButtonTheme]. The original classes
2121
/// will eventually be removed, please migrate code that uses them.
2222
/// There's a detailed migration guide for the new button and button
2323
/// theme classes in

packages/flutter/lib/src/material/material_button.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import 'theme_data.dart';
2121
///
2222
/// ### This class is obsolete.
2323
///
24-
/// FlatButton, RaisedButton, and OutlineButton have been replaced by
25-
/// TextButton, ElevatedButton, and OutlinedButton respectively.
26-
/// ButtonTheme has been replaced by TextButtonTheme,
27-
/// ElevatedButtonTheme, and OutlinedButtonTheme. The appearance of the
24+
/// FlatButton and RaisedButton have been replaced by
25+
/// TextButton and ElevatedButton respectively.
26+
/// ButtonTheme has been replaced by TextButtonTheme and
27+
/// ElevatedButtonTheme. The appearance of the
2828
/// new widgets can be customized by specifying a [ButtonStyle]
2929
/// or by creating a one-off style using a `styleFrom` method like
3030
/// [TextButton.styleFrom]. The original button classes
@@ -38,8 +38,8 @@ import 'theme_data.dart';
3838
/// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have
3939
/// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress].
4040
///
41-
/// Rather than using this class directly, consider using [FlatButton],
42-
/// [OutlineButton], or [RaisedButton], which configure this class with
41+
/// Rather than using this class directly, consider using [FlatButton]
42+
/// or [RaisedButton], which configure this class with
4343
/// appropriate defaults that match the material design specification.
4444
///
4545
/// To create a button directly, without inheriting theme defaults, use
@@ -457,8 +457,8 @@ class MaterialButton extends StatelessWidget {
457457
}
458458
}
459459

460-
/// The type of [MaterialButton]s created with RaisedButton.icon, FlatButton.icon,
461-
/// and OutlineButton.icon.
460+
/// The type of [MaterialButton]s created with RaisedButton.icon] and
461+
/// FlatButton.icon.
462462
///
463463
/// This mixin only exists to give the "label and icon" button widgets a distinct
464464
/// type for the sake of [ButtonTheme].

0 commit comments

Comments
 (0)