Skip to content

Commit afe6c2e

Browse files
authored
Remove deprecated RaisedButton (#98547)
1 parent 94fefaa commit afe6c2e

File tree

12 files changed

+39
-1317
lines changed

12 files changed

+39
-1317
lines changed

packages/flutter/lib/material.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ export 'src/material/progress_indicator_theme.dart';
118118
export 'src/material/radio.dart';
119119
export 'src/material/radio_list_tile.dart';
120120
export 'src/material/radio_theme.dart';
121-
export 'src/material/raised_button.dart';
122121
export 'src/material/range_slider.dart';
123122
export 'src/material/refresh_indicator.dart';
124123
export 'src/material/reorderable_list.dart';

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ import 'theme_data.dart';
2626
/// [ButtonStyle] of a [TextButton], [ElevatedButton] or an
2727
/// [OutlinedButton].
2828
///
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
33-
/// have been deprecated, please migrate code that uses them.
29+
/// FlatButton has been replaced by TextButton and ButtonTheme has been
30+
/// replaced by TextButtonTheme. Please migrate code that uses them.
3431
/// There's a detailed migration guide for the new button and button
3532
/// theme classes in
3633
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).

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

Lines changed: 24 additions & 33 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 'raised_button.dart';
1514
import 'theme.dart';
1615
import 'theme_data.dart' show MaterialTapTargetSize;
1716

@@ -21,8 +20,7 @@ import 'theme_data.dart' show MaterialTapTargetSize;
2120
///
2221
/// See also:
2322
///
24-
/// * [RaisedButton] and [FlatButton] which are configured
25-
/// based on the ambient [ButtonTheme].
23+
/// * [FlatButton] which is configured based on the ambient [ButtonTheme].
2624
enum ButtonTextTheme {
2725
/// Button text is black or white depending on [ThemeData.brightness].
2826
normal,
@@ -68,8 +66,7 @@ enum ButtonBarLayoutBehavior {
6866
///
6967
/// See also:
7068
///
71-
/// * [FlatButton] and [RaisedButton] which are styled
72-
/// based on the ambient button theme.
69+
/// * [FlatButton] which is styled based on the ambient button theme.
7370
/// * [RawMaterialButton], which can be used to configure a button that doesn't
7471
/// depend on any inherited themes.
7572
class ButtonTheme extends InheritedTheme {
@@ -174,11 +171,9 @@ class ButtonTheme extends InheritedTheme {
174171
/// * [ElevatedButton], [ElevatedButtonTheme], [ElevatedButtonThemeData],
175172
/// * [OutlinedButton], [OutlinedButtonTheme], [OutlinedButtonThemeData]
176173
///
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
181-
/// have been deprecated, please migrate code that uses them.
174+
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
175+
/// by TextButtonTheme. Please migrate code that uses them.
176+
///
182177
/// There's a detailed migration guide for the new button and button
183178
/// theme classes in
184179
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).
@@ -196,8 +191,8 @@ class ButtonThemeData with Diagnosticable {
196191
/// [height] parameters must greater than or equal to zero.
197192
///
198193
/// The ButtonTheme's methods that have a [MaterialButton] parameter and
199-
/// have a name with a `get` prefix are used by [RaisedButton]
200-
/// and [FlatButton] to configure a [RawMaterialButton].
194+
/// have a name with a `get` prefix are used by [FlatButton] to configure a
195+
/// [RawMaterialButton].
201196
const ButtonThemeData({
202197
this.textTheme = ButtonTextTheme.normal,
203198
this.minWidth = 88.0,
@@ -278,7 +273,7 @@ class ButtonThemeData with Diagnosticable {
278273
///
279274
/// See also:
280275
///
281-
/// * [getPadding], which is used by [RaisedButton] and [FlatButton].
276+
/// * [getPadding], which is used by [FlatButton].
282277
EdgeInsetsGeometry get padding {
283278
if (_padding != null)
284279
return _padding!;
@@ -304,7 +299,7 @@ class ButtonThemeData with Diagnosticable {
304299
///
305300
/// See also:
306301
///
307-
/// * [getShape], which is used by [RaisedButton] and [FlatButton].
302+
/// * [getShape], which is used by [FlatButton].
308303
ShapeBorder get shape {
309304
if (_shape != null)
310305
return _shape!;
@@ -333,7 +328,7 @@ class ButtonThemeData with Diagnosticable {
333328
/// This property only affects [DropdownButton] and its menu.
334329
final bool alignedDropdown;
335330

336-
/// The background fill color for [RaisedButton]s.
331+
/// The background fill color.
337332
///
338333
/// This property is null by default.
339334
///
@@ -343,18 +338,17 @@ class ButtonThemeData with Diagnosticable {
343338
///
344339
/// See also:
345340
///
346-
/// * [getFillColor], which is used by [RaisedButton] to compute its
347-
/// background fill color.
341+
/// * [getFillColor], which is used to compute the background fill color.
348342
final Color? _buttonColor;
349343

350-
/// The background fill color for disabled [RaisedButton]s.
344+
/// The background fill color when disabled.
351345
///
352346
/// This property is null by default.
353347
///
354348
/// See also:
355349
///
356-
/// * [getDisabledFillColor], which is used by [RaisedButton] to compute its
357-
/// background fill color.
350+
/// * [getDisabledFillColor], which is to compute background fill color for
351+
/// disabled state.
358352
final Color? _disabledColor;
359353

360354
/// The fill color of the button when it has the input focus.
@@ -366,7 +360,7 @@ class ButtonThemeData with Diagnosticable {
366360
///
367361
/// See also:
368362
///
369-
/// * [getFocusColor], which is used by [RaisedButton] and [FlatButton].
363+
/// * [getFocusColor], which is used by [FlatButton].
370364
final Color? _focusColor;
371365

372366
/// The fill color of the button when a pointer is hovering over it.
@@ -378,7 +372,7 @@ class ButtonThemeData with Diagnosticable {
378372
///
379373
/// See also:
380374
///
381-
/// * [getHoverColor], which is used by [RaisedButton] and [FlatButton].
375+
/// * [getHoverColor], which is used by [FlatButton].
382376
final Color? _hoverColor;
383377

384378
/// The color of the overlay that appears when a button is pressed.
@@ -387,7 +381,7 @@ class ButtonThemeData with Diagnosticable {
387381
///
388382
/// See also:
389383
///
390-
/// * [getHighlightColor], which is used by [RaisedButton] and [FlatButton].
384+
/// * [getHighlightColor], which is used by [FlatButton].
391385
final Color? _highlightColor;
392386

393387
/// The color of the ink "splash" overlay that appears when a button is tapped.
@@ -396,7 +390,7 @@ class ButtonThemeData with Diagnosticable {
396390
///
397391
/// See also:
398392
///
399-
/// * [getSplashColor], which is used by [RaisedButton] and [FlatButton].
393+
/// * [getSplashColor], which is used by [FlatButton].
400394
final Color? _splashColor;
401395

402396
/// A set of thirteen colors that can be used to derive the button theme's
@@ -417,7 +411,7 @@ class ButtonThemeData with Diagnosticable {
417411
//
418412
// See also:
419413
//
420-
// * [getMaterialTargetTapSize], which is used by [RaisedButton] and [FlatButton].
414+
// * [getMaterialTargetTapSize], which is used by [FlatButton].
421415
final MaterialTapTargetSize? _materialTapTargetSize;
422416

423417
/// The [button]'s overall brightness.
@@ -484,9 +478,6 @@ class ButtonThemeData with Diagnosticable {
484478
/// Otherwise, if button is a [FlatButton] then null is
485479
/// returned.
486480
///
487-
/// Otherwise, if button is a [RaisedButton], returns the `buttonColor`
488-
/// constructor parameter if it was non-null and the button is enabled.
489-
///
490481
/// Otherwise the fill color depends on the value of [getTextTheme].
491482
///
492483
/// * [ButtonTextTheme.normal] or [ButtonTextTheme.accent], the
@@ -505,7 +496,7 @@ class ButtonThemeData with Diagnosticable {
505496
if (button is FlatButton || button.runtimeType == MaterialButton)
506497
return null;
507498

508-
if (button.enabled && button is RaisedButton && _buttonColor != null)
499+
if (button.enabled && _buttonColor != null)
509500
return _buttonColor;
510501

511502
switch (getTextTheme(button)) {
@@ -569,7 +560,7 @@ class ButtonThemeData with Diagnosticable {
569560
/// Returns the button's [MaterialButton.splashColor] if it is non-null.
570561
///
571562
/// Otherwise, returns the value of the `splashColor` constructor parameter
572-
/// it is non-null and [button] is a [RaisedButton].
563+
/// it is non-null.
573564
///
574565
/// Otherwise, returns the value of the `splashColor` constructor parameter
575566
/// if it is non-null and [button] is a [FlatButton] and
@@ -580,7 +571,7 @@ class ButtonThemeData with Diagnosticable {
580571
if (button.splashColor != null)
581572
return button.splashColor!;
582573

583-
if (_splashColor != null && button is RaisedButton)
574+
if (_splashColor != null)
584575
return _splashColor!;
585576

586577
if (_splashColor != null && button is FlatButton) {
@@ -715,8 +706,8 @@ class ButtonThemeData with Diagnosticable {
715706
///
716707
/// Returns the button's [MaterialButton.padding] if it is non-null.
717708
///
718-
/// If this is a button constructed with [RaisedButton.icon] or
719-
/// [FlatButton.icon] then the padding is:
709+
/// If this is a button constructed with [FlatButton.icon] then the padding
710+
/// is:
720711
/// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`.
721712
///
722713
/// Otherwise, returns [padding] if it is non-null.

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import 'theme_data.dart';
1414
///
1515
/// ### This class is deprecated, please use [TextButton] instead.
1616
///
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
21-
/// will eventually be removed, please migrate code that uses them.
17+
/// FlatButton have been replaced by [TextButton] and ButtonTheme has been
18+
/// replaced by [TextButtonTheme]. Please migrate code that uses them.
2219
/// There's a detailed migration guide for the new button and button
2320
/// theme classes in
2421
/// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide).

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ import 'theme_data.dart';
2121
///
2222
/// ### This class is obsolete.
2323
///
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
24+
/// FlatButton has been replaced by TextButton and ButtonTheme has been replaced
25+
/// by TextButtonTheme. The appearance of the
2826
/// new widgets can be customized by specifying a [ButtonStyle]
2927
/// or by creating a one-off style using a `styleFrom` method like
3028
/// [TextButton.styleFrom]. The original button classes
@@ -38,9 +36,9 @@ import 'theme_data.dart';
3836
/// MaterialButtons whose [onPressed] and [onLongPress] callbacks are null will be disabled. To have
3937
/// an enabled button, make sure to pass a non-null value for [onPressed] or [onLongPress].
4038
///
41-
/// Rather than using this class directly, consider using [FlatButton]
42-
/// or [RaisedButton], which configure this class with
43-
/// appropriate defaults that match the material design specification.
39+
/// Rather than using this class directly, consider using [FlatButton], which
40+
/// configure this class with appropriate defaults that match the material
41+
/// design specification.
4442
///
4543
/// To create a button directly, without inheriting theme defaults, use
4644
/// [RawMaterialButton].
@@ -55,7 +53,7 @@ class MaterialButton extends StatelessWidget {
5553
/// Creates a material button.
5654
///
5755
/// Rather than creating a material button directly, consider using
58-
/// [FlatButton] or [RaisedButton]. To create a custom Material button
56+
/// [FlatButton]. To create a custom Material button
5957
/// consider using [RawMaterialButton].
6058
///
6159
/// The [autofocus] and [clipBehavior] arguments must not be null.
@@ -457,8 +455,7 @@ class MaterialButton extends StatelessWidget {
457455
}
458456
}
459457

460-
/// The type of [MaterialButton]s created with RaisedButton.icon] and
461-
/// FlatButton.icon.
458+
/// The type of [MaterialButton]s created with FlatButton.icon.
462459
///
463460
/// This mixin only exists to give the "label and icon" button widgets a distinct
464461
/// type for the sake of [ButtonTheme].

0 commit comments

Comments
 (0)