From 45c13702b32543964512785f9812429b3d26948b Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Wed, 10 Feb 2021 19:31:04 -0600 Subject: [PATCH] Audit and update deprecation warnings (#75813) --- .../src/material/date_picker_deprecated.dart | 12 +++++-- .../flutter/lib/src/material/flat_button.dart | 6 +++- .../lib/src/material/outline_button.dart | 6 +++- .../lib/src/material/raised_button.dart | 6 +++- .../lib/src/material/slider_theme.dart | 10 ++++-- .../flutter/lib/src/material/theme_data.dart | 34 ++++++++++++++----- .../lib/src/semantics/semantics_event.dart | 6 +++- 7 files changed, 63 insertions(+), 17 deletions(-) diff --git a/packages/flutter/lib/src/material/date_picker_deprecated.dart b/packages/flutter/lib/src/material/date_picker_deprecated.dart index 24303cd39c..fdace05bc7 100644 --- a/packages/flutter/lib/src/material/date_picker_deprecated.dart +++ b/packages/flutter/lib/src/material/date_picker_deprecated.dart @@ -69,12 +69,16 @@ const _DayPickerGridDelegate _kDayPickerGridDelegate = _DayPickerGridDelegate(); /// @Deprecated( 'Use CalendarDatePicker instead. ' - 'This feature was deprecated after v1.15.3.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class DayPicker extends StatelessWidget { /// Creates a day picker. /// /// Rarely used directly. Instead, typically used as part of a [MonthPicker]. + @Deprecated( + 'Use CalendarDatePicker instead. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) DayPicker({ Key? key, required this.selectedDate, @@ -351,13 +355,17 @@ class DayPicker extends StatelessWidget { /// @Deprecated( 'Use CalendarDatePicker instead. ' - 'This feature was deprecated after v1.15.3.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class MonthPicker extends StatefulWidget { /// Creates a month picker. /// /// Rarely used directly. Instead, typically used as part of the dialog shown /// by [showDatePicker]. + @Deprecated( + 'Use CalendarDatePicker instead. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) MonthPicker({ Key? key, required this.selectedDate, diff --git a/packages/flutter/lib/src/material/flat_button.dart b/packages/flutter/lib/src/material/flat_button.dart index 588661635a..ebb4c8e0ab 100644 --- a/packages/flutter/lib/src/material/flat_button.dart +++ b/packages/flutter/lib/src/material/flat_button.dart @@ -25,12 +25,16 @@ import 'theme_data.dart'; /// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide). @Deprecated( 'Use TextButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' - 'This feature was deprecated after v1.25.0-8.1.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class FlatButton extends MaterialButton { /// Create a simple text button. /// /// The [autofocus] and [clipBehavior] arguments must not be null. + @Deprecated( + 'Use TextButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) const FlatButton({ Key? key, required VoidCallback? onPressed, diff --git a/packages/flutter/lib/src/material/outline_button.dart b/packages/flutter/lib/src/material/outline_button.dart index 2b454f41af..ccb9bc6909 100644 --- a/packages/flutter/lib/src/material/outline_button.dart +++ b/packages/flutter/lib/src/material/outline_button.dart @@ -36,13 +36,17 @@ const Duration _kElevationDuration = Duration(milliseconds: 75); /// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide). @Deprecated( 'Use OutlinedButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' - 'This feature was deprecated after v1.25.0-8.1.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class OutlineButton extends MaterialButton { /// Create an outline button. /// /// The [highlightElevation] argument must be null or a positive value /// and the [autofocus] and [clipBehavior] arguments must not be null. + @Deprecated( + 'Use OutlinedButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) const OutlineButton({ Key? key, required VoidCallback? onPressed, diff --git a/packages/flutter/lib/src/material/raised_button.dart b/packages/flutter/lib/src/material/raised_button.dart index 26fd5e181d..11a7e147b7 100644 --- a/packages/flutter/lib/src/material/raised_button.dart +++ b/packages/flutter/lib/src/material/raised_button.dart @@ -26,7 +26,7 @@ import 'theme_data.dart'; /// [flutter.dev/go/material-button-migration-guide](https://flutter.dev/go/material-button-migration-guide). @Deprecated( 'Use ElevatedButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' - 'This feature was deprecated after v1.25.0-8.1.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class RaisedButton extends MaterialButton { /// Create a filled button. @@ -35,6 +35,10 @@ class RaisedButton extends MaterialButton { /// Additionally, [elevation], [hoverElevation], [focusElevation], /// [highlightElevation], and [disabledElevation] must be non-negative, if /// specified. + @Deprecated( + 'Use ElevatedButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) const RaisedButton({ Key? key, required VoidCallback? onPressed, diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index cb26f43936..cf1c678e56 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -1486,7 +1486,13 @@ abstract class BaseSliderTrackShape { /// * [RoundedRectSliderTrackShape], for a similar track with rounded edges. class RectangularSliderTrackShape extends SliderTrackShape with BaseSliderTrackShape { /// Creates a slider track that draws 2 rectangles. - const RectangularSliderTrackShape({ this.disabledThumbGapWidth = 2.0 }); + const RectangularSliderTrackShape({ + @Deprecated( + 'It no longer has any effect because the thumb does not shrink when the slider is disabled now. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) + this.disabledThumbGapWidth = 2.0 + }); /// Horizontal spacing, or gap, between the disabled thumb and the track. /// @@ -1496,7 +1502,7 @@ class RectangularSliderTrackShape extends SliderTrackShape with BaseSliderTrackS /// thumb radius. @Deprecated( 'It no longer has any effect because the thumb does not shrink when the slider is disabled now. ' - 'This feature was deprecated after v1.5.7.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) final double disabledThumbGapWidth; diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 525063f6ac..14ef3cd74d 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -240,17 +240,17 @@ class ThemeData with Diagnosticable { Color? secondaryHeaderColor, @Deprecated( 'Use TextSelectionThemeData.selectionColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? textSelectionColor, @Deprecated( 'Use TextSelectionThemeData.cursorColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? cursorColor, @Deprecated( 'Use TextSelectionThemeData.selectionHandleColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? textSelectionHandleColor, Color? backgroundColor, @@ -559,8 +559,20 @@ class ThemeData with Diagnosticable { required this.buttonColor, required this.toggleButtonsTheme, required this.secondaryHeaderColor, + @Deprecated( + 'Use TextSelectionThemeData.selectionColor instead. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) required this.textSelectionColor, + @Deprecated( + 'Use TextSelectionThemeData.cursorColor instead. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) required this.cursorColor, + @Deprecated( + 'Use TextSelectionThemeData.selectionHandleColor instead. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) required this.textSelectionHandleColor, required this.backgroundColor, required this.dialogBackgroundColor, @@ -610,6 +622,10 @@ class ThemeData with Diagnosticable { required this.radioTheme, required this.switchTheme, required this.fixTextFieldOutlineLabel, + @Deprecated( + 'No longer used by the framework, please remove any reference to it. ' + 'This feature was deprecated after v1.23.0-4.0.pre.' + ) required this.useTextSelectionTheme, }) : assert(visualDensity != null), assert(primaryColor != null), @@ -932,21 +948,21 @@ class ThemeData with Diagnosticable { /// The color of text selections in text fields, such as [TextField]. @Deprecated( 'Use TextSelectionThemeData.selectionColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) final Color textSelectionColor; /// The color of cursors in Material-style text fields, such as [TextField]. @Deprecated( 'Use TextSelectionThemeData.cursorColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) final Color cursorColor; /// The color of the handles used to adjust what part of the text is currently selected. @Deprecated( 'Use TextSelectionThemeData.selectionHandleColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) final Color textSelectionHandleColor; @@ -1241,17 +1257,17 @@ class ThemeData with Diagnosticable { Color? secondaryHeaderColor, @Deprecated( 'Use TextSelectionThemeData.selectionColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? textSelectionColor, @Deprecated( 'Use TextSelectionThemeData.cursorColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? cursorColor, @Deprecated( 'Use TextSelectionThemeData.selectionHandleColor instead. ' - 'This feature was deprecated after v1.23.0-4.0.pre.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) Color? textSelectionHandleColor, Color? backgroundColor, diff --git a/packages/flutter/lib/src/semantics/semantics_event.dart b/packages/flutter/lib/src/semantics/semantics_event.dart index 5e1aa065f6..5048012faa 100644 --- a/packages/flutter/lib/src/semantics/semantics_event.dart +++ b/packages/flutter/lib/src/semantics/semantics_event.dart @@ -152,10 +152,14 @@ class TapSemanticEvent extends SemanticsEvent { /// @Deprecated( 'This event has never been implemented and will be removed in a future version of Flutter. References to it should be removed. ' - 'This feature was deprecated after v1.12.16.' + 'This feature was deprecated after v1.26.0-18.0.pre.' ) class UpdateLiveRegionEvent extends SemanticsEvent { /// Creates a new [UpdateLiveRegionEvent]. + @Deprecated( + 'This event has never been implemented and will be removed in a future version of Flutter. References to it should be removed. ' + 'This feature was deprecated after v1.26.0-18.0.pre.' + ) const UpdateLiveRegionEvent() : super('updateLiveRegion'); @override