diff --git a/packages/flutter/lib/src/cupertino/colors.dart b/packages/flutter/lib/src/cupertino/colors.dart index 329274a58f..bc91b42103 100644 --- a/packages/flutter/lib/src/cupertino/colors.dart +++ b/packages/flutter/lib/src/cupertino/colors.dart @@ -675,7 +675,7 @@ class CupertinoColors { /// * [CupertinoTheme.of], a static method that retrieves the ambient [CupertinoThemeData], /// and then resolves [CupertinoDynamicColor]s used in the retrieved data. @immutable -class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Diagnosticable { +class CupertinoDynamicColor extends Color with Diagnosticable { /// Creates an adaptive [Color] that changes its effective color based on the /// [BuildContext] given. The default effective color is [color]. /// diff --git a/packages/flutter/lib/src/cupertino/icon_theme_data.dart b/packages/flutter/lib/src/cupertino/icon_theme_data.dart index 41de478b1e..4c6f32be02 100644 --- a/packages/flutter/lib/src/cupertino/icon_theme_data.dart +++ b/packages/flutter/lib/src/cupertino/icon_theme_data.dart @@ -8,7 +8,7 @@ import 'colors.dart'; /// An [IconThemeData] subclass that automatically resolves its [color] when retrieved /// using [IconTheme.of]. -class CupertinoIconThemeData extends IconThemeData with DiagnosticableMixin implements Diagnosticable { +class CupertinoIconThemeData extends IconThemeData with Diagnosticable { /// Creates a [CupertinoIconThemeData]. /// /// The opacity applies to both explicit and default icon colors. The value diff --git a/packages/flutter/lib/src/cupertino/text_theme.dart b/packages/flutter/lib/src/cupertino/text_theme.dart index 9ff53ae8bb..21f5f8782e 100644 --- a/packages/flutter/lib/src/cupertino/text_theme.dart +++ b/packages/flutter/lib/src/cupertino/text_theme.dart @@ -107,7 +107,7 @@ TextStyle _resolveTextStyle(TextStyle style, BuildContext context, bool nullOk) /// Cupertino typography theme in a [CupertinoThemeData]. @immutable -class CupertinoTextThemeData extends Diagnosticable { +class CupertinoTextThemeData with Diagnosticable { /// Create a [CupertinoTextThemeData]. /// /// The [primaryColor] is used to derive TextStyle defaults of other attributes diff --git a/packages/flutter/lib/src/cupertino/theme.dart b/packages/flutter/lib/src/cupertino/theme.dart index e0d4b7ca4a..d75df0fc84 100644 --- a/packages/flutter/lib/src/cupertino/theme.dart +++ b/packages/flutter/lib/src/cupertino/theme.dart @@ -143,7 +143,7 @@ class _InheritedCupertinoTheme extends InheritedWidget { /// * [ThemeData], a Material equivalent that also configures Cupertino /// styling via a [CupertinoThemeData] subclass [MaterialBasedCupertinoThemeData]. @immutable -class CupertinoThemeData extends Diagnosticable { +class CupertinoThemeData with Diagnosticable { /// Creates a [CupertinoTheme] styling specification. /// /// Unspecified parameters default to a reasonable iOS default style. diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 34677d2246..da506883dc 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -326,7 +326,7 @@ class ErrorSpacer extends DiagnosticsProperty { /// Class for information provided to [FlutterExceptionHandler] callbacks. /// /// See [FlutterError.onError]. -class FlutterErrorDetails extends Diagnosticable { +class FlutterErrorDetails with Diagnosticable { /// Creates a [FlutterErrorDetails] object with the given arguments setting /// the object's properties. /// @@ -478,7 +478,7 @@ class FlutterErrorDetails extends Diagnosticable { return longMessage; } - DiagnosticableMixin _exceptionToDiagnosticable() { + Diagnosticable _exceptionToDiagnosticable() { if (exception is FlutterError) { return exception as FlutterError; } @@ -501,7 +501,7 @@ class FlutterErrorDetails extends Diagnosticable { if (kReleaseMode) { return DiagnosticsNode.message(formatException()); } - final DiagnosticableMixin diagnosticable = _exceptionToDiagnosticable(); + final Diagnosticable diagnosticable = _exceptionToDiagnosticable(); DiagnosticsNode summary; if (diagnosticable != null) { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); @@ -515,7 +515,7 @@ class FlutterErrorDetails extends Diagnosticable { void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); final DiagnosticsNode verb = ErrorDescription('thrown${ context != null ? ErrorDescription(" $context") : ""}'); - final DiagnosticableMixin diagnosticable = _exceptionToDiagnosticable(); + final Diagnosticable diagnosticable = _exceptionToDiagnosticable(); if (exception is NullThrownError) { properties.add(ErrorDescription('The null value was $verb.')); } else if (exception is num) { diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index a8d2bf6d83..25f257ad08 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -2640,7 +2640,7 @@ class DiagnosticsProperty extends DiagnosticsNode { Map toJsonMap(DiagnosticsSerializationDelegate delegate) { final T v = value; List> properties; - if (delegate.expandPropertyValues && delegate.includeProperties && v is DiagnosticableMixin && getProperties().isEmpty) { + if (delegate.expandPropertyValues && delegate.includeProperties && v is Diagnosticable && getProperties().isEmpty) { // Exclude children for expanded nodes to avoid cycles. delegate = delegate.copyWith(subtreeDepth: 0, includeProperties: false); properties = DiagnosticsNode.toJsonList( @@ -2666,7 +2666,7 @@ class DiagnosticsProperty extends DiagnosticsNode { json['exception'] = exception.toString(); json['propertyType'] = propertyType.toString(); json['defaultLevel'] = describeEnum(_defaultLevel); - if (value is DiagnosticableMixin || value is DiagnosticsNode) + if (value is Diagnosticable || value is DiagnosticsNode) json['isDiagnosticableValue'] = true; if (v is num) // Workaround for https://github.com/flutter/flutter/issues/39937#issuecomment-529558033. @@ -2846,7 +2846,7 @@ class DiagnosticsProperty extends DiagnosticsNode { if (object is DiagnosticsNode) { return object.getProperties(); } - if (object is DiagnosticableMixin) { + if (object is Diagnosticable) { return object.toDiagnosticsNode(style: style).getProperties(); } } @@ -2860,7 +2860,7 @@ class DiagnosticsProperty extends DiagnosticsNode { if (object is DiagnosticsNode) { return object.getChildren(); } - if (object is DiagnosticableMixin) { + if (object is Diagnosticable) { return object.toDiagnosticsNode(style: style).getChildren(); } } @@ -2870,7 +2870,7 @@ class DiagnosticsProperty extends DiagnosticsNode { /// [DiagnosticsNode] that lazily calls the associated [Diagnosticable] [value] /// to implement [getChildren] and [getProperties]. -class DiagnosticableNode extends DiagnosticsNode { +class DiagnosticableNode extends DiagnosticsNode { /// Create a diagnostics describing a [DiagnosticableMixin] value. /// /// The [value] argument must not be null. @@ -3017,42 +3017,47 @@ class DiagnosticPropertiesBuilder { String emptyBodyDescription; } -// Examples can assume: -// class ExampleSuperclass extends Diagnosticable { String message; double stepWidth; double scale; double paintExtent; double hitTestExtent; double paintExtend; double maxWidth; bool primary; double progress; int maxLines; Duration duration; int depth; dynamic boxShadow; dynamic style; bool hasSize; Matrix4 transform; Map handles; Color color; bool obscureText; ImageRepeat repeat; Size size; Widget widget; bool isCurrent; bool keepAlive; TextAlign textAlign; } +// TODO(gspencergoog): Remove DiagnosticableMixin once the mixin Diagnosticable is in stable. +// https://github.com/flutter/flutter/issues/50498 -/// A base class for providing string and [DiagnosticsNode] debug -/// representations describing the properties of an object. +/// A mixin class implementing the [Diagnosticable] interface that provides +/// string and [DiagnosticsNode] debug representations describing the properties +/// of an object. /// -/// The string debug representation is generated from the intermediate -/// [DiagnosticsNode] representation. The [DiagnosticsNode] representation is -/// also used by debugging tools displaying interactive trees of objects and -/// properties. -/// -/// See also: -/// -/// * [DiagnosticableTree], which extends this class to also describe the -/// children of a tree structured object. -/// * [DiagnosticableMixin], which provides the implementation for -/// [Diagnosticable], and can be used to add diagnostics to classes which -/// already have a base class. -/// * [DiagnosticableMixin.debugFillProperties], which lists best practices -/// for specifying the properties of a [DiagnosticsNode]. The most common use -/// case is to override [debugFillProperties] defining custom properties for -/// a subclass of [DiagnosticableTreeMixin] using the existing -/// [DiagnosticsProperty] subclasses. -/// * [DiagnosticableTree.debugDescribeChildren], which lists best practices -/// for describing the children of a [DiagnosticsNode]. Typically the base -/// class already describes the children of a node properly or a node has -/// no children. -/// * [DiagnosticsProperty], which should be used to create leaf diagnostic -/// nodes without properties or children. There are many -/// [DiagnosticsProperty] subclasses to handle common use cases. -abstract class Diagnosticable with DiagnosticableMixin { - /// Abstract const constructor. This constructor enables subclasses to provide - /// const constructors so that they can be used in const expressions. - const Diagnosticable(); +/// _This mixin is exists only to support plugins that require older Flutter +/// versions: Use the identical mixin [Diagnosticable] instead for most code._ +mixin DiagnosticableMixin implements Diagnosticable { + @override + String toStringShort() => describeIdentity(this); + + @override + String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + String fullString; + assert(() { + fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); + return true; + }()); + return fullString ?? toStringShort(); + } + + @override + DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) { + return DiagnosticableNode( + name: name, + value: this, + style: style, + ); + } + + @override + @protected + @mustCallSuper + void debugFillProperties(DiagnosticPropertiesBuilder properties) { } } +// Examples can assume: +// class ExampleSuperclass with Diagnosticable { String message; double stepWidth; double scale; double paintExtent; double hitTestExtent; double paintExtend; double maxWidth; bool primary; double progress; int maxLines; Duration duration; int depth; dynamic boxShadow; dynamic style; bool hasSize; Matrix4 transform; Map handles; Color color; bool obscureText; ImageRepeat repeat; Size size; Widget widget; bool isCurrent; bool keepAlive; TextAlign textAlign; } + /// A mixin class for providing string and [DiagnosticsNode] debug /// representations describing the properties of an object. /// @@ -3077,7 +3082,7 @@ abstract class Diagnosticable with DiagnosticableMixin { /// * [DiagnosticsProperty], which should be used to create leaf diagnostic /// nodes without properties or children. There are many /// [DiagnosticsProperty] subclasses to handle common use cases. -mixin DiagnosticableMixin { +mixin Diagnosticable { /// A brief description of this object, usually just the [runtimeType] and the /// [hashCode]. /// @@ -3106,7 +3111,7 @@ mixin DiagnosticableMixin { /// relationship between the parent and the node. For example, pass /// [DiagnosticsTreeStyle.offstage] to indicate that a node is offstage. DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) { - return DiagnosticableNode( + return DiagnosticableNode( name: name, value: this, style: style, @@ -3338,7 +3343,7 @@ mixin DiagnosticableMixin { /// * [DiagnosticableTreeMixin], a mixin that implements this class. /// * [DiagnosticableMixin], which should be used instead of this class to /// provide diagnostics for objects without children. -abstract class DiagnosticableTree extends Diagnosticable { +abstract class DiagnosticableTree with Diagnosticable { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const DiagnosticableTree(); diff --git a/packages/flutter/lib/src/gestures/events.dart b/packages/flutter/lib/src/gestures/events.dart index 8aa5dee7f3..23f9b26f1e 100644 --- a/packages/flutter/lib/src/gestures/events.dart +++ b/packages/flutter/lib/src/gestures/events.dart @@ -196,7 +196,7 @@ bool isSingleButton(int buttons) => buttons != 0 && (smallestButton(buttons) == /// /// * [Window.devicePixelRatio], which defines the device's current resolution. @immutable -abstract class PointerEvent extends Diagnosticable { +abstract class PointerEvent with Diagnosticable { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const PointerEvent({ diff --git a/packages/flutter/lib/src/gestures/mouse_tracking.dart b/packages/flutter/lib/src/gestures/mouse_tracking.dart index 7b79f36311..1b5b1c7fbb 100644 --- a/packages/flutter/lib/src/gestures/mouse_tracking.dart +++ b/packages/flutter/lib/src/gestures/mouse_tracking.dart @@ -30,7 +30,7 @@ typedef PointerHoverEventListener = void Function(PointerHoverEvent event); /// movements. /// /// This is added to a layer and managed by the [MouseRegion] widget. -class MouseTrackerAnnotation extends Diagnosticable { +class MouseTrackerAnnotation with Diagnosticable { /// Creates an annotation that can be used to find layers interested in mouse /// movements. const MouseTrackerAnnotation({this.onEnter, this.onHover, this.onExit}); diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart index f4758f9de8..25e474cf5e 100644 --- a/packages/flutter/lib/src/material/app_bar_theme.dart +++ b/packages/flutter/lib/src/material/app_bar_theme.dart @@ -27,7 +27,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class AppBarTheme extends Diagnosticable { +class AppBarTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.AppBarTheme]. const AppBarTheme({ this.brightness, diff --git a/packages/flutter/lib/src/material/banner_theme.dart b/packages/flutter/lib/src/material/banner_theme.dart index 4e3d2b7207..5ca4c6837d 100644 --- a/packages/flutter/lib/src/material/banner_theme.dart +++ b/packages/flutter/lib/src/material/banner_theme.dart @@ -23,7 +23,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class MaterialBannerThemeData extends Diagnosticable { +class MaterialBannerThemeData with Diagnosticable { /// Creates a theme that can be used for [MaterialBannerTheme] or /// [ThemeData.bannerTheme]. diff --git a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart index a05c15baa5..18d8461f47 100644 --- a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart +++ b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart @@ -25,7 +25,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class BottomAppBarTheme extends Diagnosticable { +class BottomAppBarTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.BottomAppBarTheme]. const BottomAppBarTheme({ this.color, diff --git a/packages/flutter/lib/src/material/bottom_sheet_theme.dart b/packages/flutter/lib/src/material/bottom_sheet_theme.dart index 2324b3f456..c2ccf24977 100644 --- a/packages/flutter/lib/src/material/bottom_sheet_theme.dart +++ b/packages/flutter/lib/src/material/bottom_sheet_theme.dart @@ -24,7 +24,7 @@ import 'package:flutter/rendering.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class BottomSheetThemeData extends Diagnosticable { +class BottomSheetThemeData with Diagnosticable { /// Creates a theme that can be used for [ThemeData.bottomSheetTheme]. const BottomSheetThemeData({ this.backgroundColor, diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart index 66dfbbf554..1f8772834d 100644 --- a/packages/flutter/lib/src/material/button_bar_theme.dart +++ b/packages/flutter/lib/src/material/button_bar_theme.dart @@ -24,7 +24,7 @@ import 'theme.dart'; /// its subtree. /// * [ButtonBar], which uses this to configure itself and its children /// button widgets. -class ButtonBarThemeData extends Diagnosticable { +class ButtonBarThemeData with Diagnosticable { /// Constructs the set of properties used to configure [ButtonBar] widgets. /// /// Both [buttonMinWidth] and [buttonHeight] must be non-negative if they diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index f4e0616faa..3c61054c6e 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -248,7 +248,7 @@ class ButtonTheme extends InheritedTheme { /// A button theme can be specified as part of the overall Material theme /// using [ThemeData.buttonTheme]. The Material theme's button theme data /// can be overridden with [ButtonTheme]. -class ButtonThemeData extends Diagnosticable { +class ButtonThemeData with Diagnosticable { /// Create a button theme object that can be used with [ButtonTheme] /// or [ThemeData]. /// diff --git a/packages/flutter/lib/src/material/card_theme.dart b/packages/flutter/lib/src/material/card_theme.dart index 91e8174508..7c6da59d8e 100644 --- a/packages/flutter/lib/src/material/card_theme.dart +++ b/packages/flutter/lib/src/material/card_theme.dart @@ -26,7 +26,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class CardTheme extends Diagnosticable { +class CardTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.cardTheme]. /// diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart index bb5b64bc1a..527e29ac88 100644 --- a/packages/flutter/lib/src/material/chip_theme.dart +++ b/packages/flutter/lib/src/material/chip_theme.dart @@ -168,7 +168,7 @@ class ChipTheme extends InheritedTheme { /// * [Theme] widget, which performs a similar function to [ChipTheme], /// but for overall themes. /// * [ThemeData], which has a default [ChipThemeData]. -class ChipThemeData extends Diagnosticable { +class ChipThemeData with Diagnosticable { /// Create a [ChipThemeData] given a set of exact values. All the values /// must be specified except for [shadowColor], [selectedShadowColor], /// [elevation], and [pressElevation], which may be null. diff --git a/packages/flutter/lib/src/material/color_scheme.dart b/packages/flutter/lib/src/material/color_scheme.dart index 74414d8408..a0cf874dd9 100644 --- a/packages/flutter/lib/src/material/color_scheme.dart +++ b/packages/flutter/lib/src/material/color_scheme.dart @@ -16,7 +16,7 @@ import 'theme_data.dart'; /// The [Theme] has a color scheme, [ThemeData.colorScheme], which is constructed /// with [ColorScheme.fromSwatch]. @immutable -class ColorScheme extends Diagnosticable { +class ColorScheme with Diagnosticable { /// Create a ColorScheme instance. const ColorScheme({ @required this.primary, diff --git a/packages/flutter/lib/src/material/dialog_theme.dart b/packages/flutter/lib/src/material/dialog_theme.dart index 48ae8f7f29..62bbdb4e39 100644 --- a/packages/flutter/lib/src/material/dialog_theme.dart +++ b/packages/flutter/lib/src/material/dialog_theme.dart @@ -27,7 +27,7 @@ import 'theme.dart'; /// * [Dialog], a material dialog that can be customized using this [DialogTheme]. /// * [ThemeData], which describes the overall theme information for the /// application. -class DialogTheme extends Diagnosticable { +class DialogTheme with Diagnosticable { /// Creates a dialog theme that can be used for [ThemeData.dialogTheme]. const DialogTheme({ this.backgroundColor, diff --git a/packages/flutter/lib/src/material/divider_theme.dart b/packages/flutter/lib/src/material/divider_theme.dart index 399d24f36f..53d53ad3e7 100644 --- a/packages/flutter/lib/src/material/divider_theme.dart +++ b/packages/flutter/lib/src/material/divider_theme.dart @@ -26,7 +26,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class DividerThemeData extends Diagnosticable { +class DividerThemeData with Diagnosticable { /// Creates a theme that can be used for [DividerTheme] or /// [ThemeData.dividerTheme]. diff --git a/packages/flutter/lib/src/material/floating_action_button_theme.dart b/packages/flutter/lib/src/material/floating_action_button_theme.dart index 84c22d7942..89eca9ad40 100644 --- a/packages/flutter/lib/src/material/floating_action_button_theme.dart +++ b/packages/flutter/lib/src/material/floating_action_button_theme.dart @@ -26,7 +26,7 @@ import 'package:flutter/rendering.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class FloatingActionButtonThemeData extends Diagnosticable { +class FloatingActionButtonThemeData with Diagnosticable { /// Creates a theme that can be used for /// [ThemeData.floatingActionButtonTheme]. const FloatingActionButtonThemeData({ diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 454183b733..5e29f47a6e 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -3548,7 +3548,7 @@ class InputDecoration { /// The [InputDecoration.applyDefaults] method is used to combine a input /// decoration theme with an [InputDecoration] object. @immutable -class InputDecorationTheme extends Diagnosticable { +class InputDecorationTheme with Diagnosticable { /// Creates a value for [ThemeData.inputDecorationTheme] that /// defines default values for [InputDecorator]. /// diff --git a/packages/flutter/lib/src/material/page_transitions_theme.dart b/packages/flutter/lib/src/material/page_transitions_theme.dart index 145005ce71..7c51b42de4 100644 --- a/packages/flutter/lib/src/material/page_transitions_theme.dart +++ b/packages/flutter/lib/src/material/page_transitions_theme.dart @@ -483,7 +483,7 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder { /// * [CupertinoPageTransitionsBuilder], which defines a horizontal page /// transition that matches native iOS page transitions. @immutable -class PageTransitionsTheme extends Diagnosticable { +class PageTransitionsTheme with Diagnosticable { /// Construct a PageTransitionsTheme. /// /// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder] diff --git a/packages/flutter/lib/src/material/popup_menu_theme.dart b/packages/flutter/lib/src/material/popup_menu_theme.dart index 45df40745f..83a33f9a8d 100644 --- a/packages/flutter/lib/src/material/popup_menu_theme.dart +++ b/packages/flutter/lib/src/material/popup_menu_theme.dart @@ -29,7 +29,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. -class PopupMenuThemeData extends Diagnosticable { +class PopupMenuThemeData with Diagnosticable { /// Creates the set of properties used to configure [PopupMenuTheme]. const PopupMenuThemeData({ this.color, diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 7bcd6d32c9..c9579d81f1 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -305,7 +305,7 @@ enum Thumb { /// {@macro flutter.material.slider.seeAlso.rangeSliderValueIndicatorShape} /// {@macro flutter.material.slider.seeAlso.rangeSliderTrackShape} /// {@macro flutter.material.slider.seeAlso.rangeSliderTickMarkShape} -class SliderThemeData extends Diagnosticable { +class SliderThemeData with Diagnosticable { /// Create a [SliderThemeData] given a set of exact values. All the values /// must be specified. /// diff --git a/packages/flutter/lib/src/material/snack_bar_theme.dart b/packages/flutter/lib/src/material/snack_bar_theme.dart index 33b3e8c818..e05916b3d9 100644 --- a/packages/flutter/lib/src/material/snack_bar_theme.dart +++ b/packages/flutter/lib/src/material/snack_bar_theme.dart @@ -46,7 +46,7 @@ enum SnackBarBehavior { /// /// * [ThemeData], which describes the overall theme information for the /// application. -class SnackBarThemeData extends Diagnosticable { +class SnackBarThemeData with Diagnosticable { /// Creates a theme that can be used for [ThemeData.snackBarTheme]. /// diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart index 84685624cd..b6bbf597d0 100644 --- a/packages/flutter/lib/src/material/tab_bar_theme.dart +++ b/packages/flutter/lib/src/material/tab_bar_theme.dart @@ -23,7 +23,7 @@ import 'theme.dart'; /// * [TabBar], a widget that displays a horizontal row of tabs. /// * [ThemeData], which describes the overall theme information for the /// application. -class TabBarTheme extends Diagnosticable { +class TabBarTheme with Diagnosticable { /// Creates a tab bar theme that can be used with [ThemeData.tabBarTheme]. const TabBarTheme({ this.indicator, diff --git a/packages/flutter/lib/src/material/text_theme.dart b/packages/flutter/lib/src/material/text_theme.dart index f82f20899c..cd5a07b52c 100644 --- a/packages/flutter/lib/src/material/text_theme.dart +++ b/packages/flutter/lib/src/material/text_theme.dart @@ -103,7 +103,7 @@ import 'typography.dart'; /// globally adjusted, such as the color scheme. /// * @immutable -class TextTheme extends Diagnosticable { +class TextTheme with Diagnosticable { /// Creates a text theme that uses the given values. /// /// Rather than creating a new text theme, consider using [Typography.black] diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index ad5c1ded25..f0d556ede2 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -163,7 +163,7 @@ enum MaterialTapTargetSize { /// ``` /// {@end-tool} @immutable -class ThemeData extends Diagnosticable { +class ThemeData with Diagnosticable { /// Create a [ThemeData] given a set of preferred values. /// /// Default values will be derived for arguments that are omitted. @@ -1697,7 +1697,7 @@ class _FifoCache { /// * [ThemeData.visualDensity], where this property is used to specify the base /// horizontal density of Material components. /// * [Material design guidance on density](https://material.io/design/layout/applying-density.html). -class VisualDensity extends Diagnosticable { +class VisualDensity with Diagnosticable { /// A const constructor for [VisualDensity]. /// /// All of the arguments must be non-null, and [horizontal] and [vertical] diff --git a/packages/flutter/lib/src/material/toggle_buttons_theme.dart b/packages/flutter/lib/src/material/toggle_buttons_theme.dart index c4d4b3fab4..2874dbd7d1 100644 --- a/packages/flutter/lib/src/material/toggle_buttons_theme.dart +++ b/packages/flutter/lib/src/material/toggle_buttons_theme.dart @@ -24,7 +24,7 @@ import 'theme.dart'; /// /// * [ToggleButtonsTheme], which describes the actual configuration of a /// toggle buttons theme. -class ToggleButtonsThemeData extends Diagnosticable { +class ToggleButtonsThemeData with Diagnosticable { /// Creates the set of color and border properties used to configure /// [ToggleButtons]. const ToggleButtonsThemeData({ diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart index 1719ccd09f..f3bfd9e1fa 100644 --- a/packages/flutter/lib/src/material/tooltip_theme.dart +++ b/packages/flutter/lib/src/material/tooltip_theme.dart @@ -23,7 +23,7 @@ import 'theme.dart'; /// subtree. /// * [TooltipThemeData], which describes the actual configuration of a /// tooltip theme. -class TooltipThemeData extends Diagnosticable { +class TooltipThemeData with Diagnosticable { /// Creates the set of properties used to configure [Tooltip]s. const TooltipThemeData({ this.height, diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index 00bb4eef62..c6359a28fb 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -82,7 +82,7 @@ enum ScriptCategory { /// [ThemeData.primaryTextTheme], [ThemeData.accentTextTheme]. /// * @immutable -class Typography extends Diagnosticable { +class Typography with Diagnosticable { /// Creates a typography instance. /// /// This constructor is identical to [Typography.material2014]. It is diff --git a/packages/flutter/lib/src/painting/decoration.dart b/packages/flutter/lib/src/painting/decoration.dart index a629ce7b39..0c2063b52b 100644 --- a/packages/flutter/lib/src/painting/decoration.dart +++ b/packages/flutter/lib/src/painting/decoration.dart @@ -20,7 +20,7 @@ import 'image_provider.dart'; /// shared between boxes; [BoxPainter] objects can cache resources to /// make painting on a particular surface faster. @immutable -abstract class Decoration extends Diagnosticable { +abstract class Decoration with Diagnosticable { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const Decoration(); diff --git a/packages/flutter/lib/src/painting/image_stream.dart b/packages/flutter/lib/src/painting/image_stream.dart index acd996ef7e..4a06e1fa75 100644 --- a/packages/flutter/lib/src/painting/image_stream.dart +++ b/packages/flutter/lib/src/painting/image_stream.dart @@ -159,7 +159,7 @@ typedef ImageErrorListener = void Function(dynamic exception, StackTrace stackTr /// * [ImageChunkListener], the means by which callers get notified of /// these events. @immutable -class ImageChunkEvent extends Diagnosticable { +class ImageChunkEvent with Diagnosticable { /// Creates a new chunk event. const ImageChunkEvent({ @required this.cumulativeBytesLoaded, @@ -212,7 +212,7 @@ class ImageChunkEvent extends Diagnosticable { /// /// * [ImageProvider], which has an example that includes the use of an /// [ImageStream] in a [Widget]. -class ImageStream extends Diagnosticable { +class ImageStream with Diagnosticable { /// Create an initially unbound image stream. /// /// Once an [ImageStreamCompleter] is available, call [setCompleter]. @@ -324,7 +324,7 @@ class ImageStream extends Diagnosticable { /// [ImageStreamListener] objects are rarely constructed directly. Generally, an /// [ImageProvider] subclass will return an [ImageStream] and automatically /// configure it with the right [ImageStreamCompleter] when possible. -abstract class ImageStreamCompleter extends Diagnosticable { +abstract class ImageStreamCompleter with Diagnosticable { final List _listeners = []; ImageInfo _currentImage; FlutterErrorDetails _currentError; diff --git a/packages/flutter/lib/src/painting/strut_style.dart b/packages/flutter/lib/src/painting/strut_style.dart index 2cd5b3e8f3..f405e5efea 100644 --- a/packages/flutter/lib/src/painting/strut_style.dart +++ b/packages/flutter/lib/src/painting/strut_style.dart @@ -285,7 +285,7 @@ import 'text_style.dart'; /// {@end-tool} /// @immutable -class StrutStyle extends Diagnosticable { +class StrutStyle with Diagnosticable { /// Creates a strut style. /// /// The `package` argument must be non-null if the font family is defined in a diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index 2d48ef6233..eec3589ba5 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -391,7 +391,7 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a /// * [TextStyle](https://api.flutter.dev/flutter/dart-ui/TextStyle-class.html), the class in the [dart:ui] library. /// @immutable -class TextStyle extends Diagnosticable { +class TextStyle with Diagnosticable { /// Creates a text style. /// /// The `package` argument must be non-null if the font family is defined in a diff --git a/packages/flutter/lib/src/rendering/sliver.dart b/packages/flutter/lib/src/rendering/sliver.dart index 6653b8c6e2..ebf6391304 100644 --- a/packages/flutter/lib/src/rendering/sliver.dart +++ b/packages/flutter/lib/src/rendering/sliver.dart @@ -525,7 +525,7 @@ class SliverConstraints extends Constraints { /// A sliver can occupy space in several different ways, which is why this class /// contains multiple values. @immutable -class SliverGeometry extends Diagnosticable { +class SliverGeometry with Diagnosticable { /// Creates an object that describes the amount of space occupied by a sliver. /// /// If the [layoutExtent] argument is null, [layoutExtent] defaults to the diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart index 5a234991a9..1ff8291972 100644 --- a/packages/flutter/lib/src/semantics/semantics.dart +++ b/packages/flutter/lib/src/semantics/semantics.dart @@ -172,7 +172,7 @@ class CustomSemanticsAction { /// /// Typically obtained from [SemanticsNode.getSemanticsData]. @immutable -class SemanticsData extends Diagnosticable { +class SemanticsData with Diagnosticable { /// Creates a semantics data object. /// /// The [flags], [actions], [label], and [Rect] arguments must not be null. @@ -3997,7 +3997,7 @@ String _concatStrings({ /// See also: /// /// * [OrdinalSortKey] for a sort key that sorts using an ordinal. -abstract class SemanticsSortKey extends Diagnosticable implements Comparable { +abstract class SemanticsSortKey with Diagnosticable implements Comparable { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const SemanticsSortKey({this.name}); diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart index dacbd24aa4..82a6def358 100644 --- a/packages/flutter/lib/src/services/keyboard_key.dart +++ b/packages/flutter/lib/src/services/keyboard_key.dart @@ -19,7 +19,7 @@ import 'package:flutter/foundation.dart'; /// that are returned from [RawKeyEvent.physicalKey]. /// * [LogicalKeyboardKey], a class with static values that describe the keys /// that are returned from [RawKeyEvent.logicalKey]. -abstract class KeyboardKey extends Diagnosticable { +abstract class KeyboardKey with Diagnosticable { /// A const constructor so that subclasses may be const. const KeyboardKey(); } diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart index eb05faf76a..83136d1a23 100644 --- a/packages/flutter/lib/src/services/raw_keyboard.dart +++ b/packages/flutter/lib/src/services/raw_keyboard.dart @@ -236,7 +236,7 @@ abstract class RawKeyEventData { /// * [RawKeyboard], which uses this interface to expose key data. /// * [RawKeyboardListener], a widget that listens for raw key events. @immutable -abstract class RawKeyEvent extends Diagnosticable { +abstract class RawKeyEvent with Diagnosticable { /// Initializes fields for subclasses, and provides a const constructor for /// const subclasses. const RawKeyEvent({ diff --git a/packages/flutter/lib/src/widgets/actions.dart b/packages/flutter/lib/src/widgets/actions.dart index a9e2320353..6385f4c6d3 100644 --- a/packages/flutter/lib/src/widgets/actions.dart +++ b/packages/flutter/lib/src/widgets/actions.dart @@ -25,7 +25,7 @@ typedef ActionFactory = Action Function(); /// /// If this intent returns false from [isEnabled], then its associated action will /// not be invoked if requested. -class Intent extends Diagnosticable { +class Intent with Diagnosticable { /// A const constructor for an [Intent]. /// /// The [key] argument must not be null. @@ -73,7 +73,7 @@ class Intent extends Diagnosticable { /// and allows redefining of actions for its descendants. /// * [ActionDispatcher], a class that takes an [Action] and invokes it using a /// [FocusNode] for context. -abstract class Action extends Diagnosticable { +abstract class Action with Diagnosticable { /// A const constructor for an [Action]. /// /// The [intentKey] parameter must not be null. @@ -140,7 +140,7 @@ class CallbackAction extends Action { } /// An action manager that simply invokes the actions given to it. -class ActionDispatcher extends Diagnosticable { +class ActionDispatcher with Diagnosticable { /// Const constructor so that subclasses can be const. const ActionDispatcher(); diff --git a/packages/flutter/lib/src/widgets/focus_manager.dart b/packages/flutter/lib/src/widgets/focus_manager.dart index fc17b2492c..57f1a69aa9 100644 --- a/packages/flutter/lib/src/widgets/focus_manager.dart +++ b/packages/flutter/lib/src/widgets/focus_manager.dart @@ -1352,7 +1352,7 @@ enum FocusHighlightStrategy { /// subtrees into groups and restrict focus to them. /// * The [primaryFocus] global accessor, for convenient access from anywhere /// to the current focus manager state. -class FocusManager with DiagnosticableTreeMixin, ChangeNotifier implements Diagnosticable { +class FocusManager with DiagnosticableTreeMixin, ChangeNotifier { /// Creates an object that manages the focus tree. /// /// This constructor is rarely called directly. To access the [FocusManager], diff --git a/packages/flutter/lib/src/widgets/focus_traversal.dart b/packages/flutter/lib/src/widgets/focus_traversal.dart index 319ba1471f..4fcf908c53 100644 --- a/packages/flutter/lib/src/widgets/focus_traversal.dart +++ b/packages/flutter/lib/src/widgets/focus_traversal.dart @@ -115,7 +115,7 @@ enum TraversalDirection { /// * [DirectionalFocusTraversalPolicyMixin] a mixin class that implements /// focus traversal in a direction. @immutable -abstract class FocusTraversalPolicy extends Diagnosticable { +abstract class FocusTraversalPolicy with Diagnosticable { /// A const constructor so subclasses can be const. const FocusTraversalPolicy(); @@ -806,7 +806,7 @@ class WidgetOrderTraversalPolicy extends FocusTraversalPolicy with DirectionalFo // // It's also a convenient place to put some utility functions having to do with // the sort data. -class _ReadingOrderSortData extends Diagnosticable { +class _ReadingOrderSortData with Diagnosticable { _ReadingOrderSortData(this.node) : assert(node != null), rect = node.rect, @@ -886,7 +886,7 @@ class _ReadingOrderSortData extends Diagnosticable { // A class for containing group data while sorting in reading order while taking // into account the ambient directionality. -class _ReadingOrderDirectionalGroupData extends Diagnosticable { +class _ReadingOrderDirectionalGroupData with Diagnosticable { _ReadingOrderDirectionalGroupData(this.members); final List<_ReadingOrderSortData> members; @@ -1105,7 +1105,7 @@ class ReadingOrderTraversalPolicy extends FocusTraversalPolicy with DirectionalF /// * [LexicalFocusOrder], a focus order that assigns a string-based lexical /// traversal order to a [FocusTraversalOrder] widget. @immutable -abstract class FocusOrder extends Diagnosticable implements Comparable { +abstract class FocusOrder with Diagnosticable implements Comparable { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const FocusOrder(); diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 7867c11760..33fd48c4de 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -1026,7 +1026,7 @@ typedef StateSetter = void Function(VoidCallback fn); /// be read by descendant widgets. /// * [Widget], for an overview of widgets in general. @optionalTypeArgs -abstract class State extends Diagnosticable { +abstract class State with Diagnosticable { /// The current configuration. /// /// A [State] object's configuration is the corresponding [StatefulWidget] diff --git a/packages/flutter/lib/src/widgets/icon_theme_data.dart b/packages/flutter/lib/src/widgets/icon_theme_data.dart index f4b25cd645..fbca5b2413 100644 --- a/packages/flutter/lib/src/widgets/icon_theme_data.dart +++ b/packages/flutter/lib/src/widgets/icon_theme_data.dart @@ -18,7 +18,7 @@ import 'framework.dart' show BuildContext; /// To obtain the current icon theme, use [IconTheme.of]. To convert an icon /// theme to a version with all the fields filled in, use [new /// IconThemeData.fallback]. -class IconThemeData extends Diagnosticable { +class IconThemeData with Diagnosticable { /// Creates an icon theme data. /// /// The opacity applies to both explicit and default icon colors. The value diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart index d346a9864d..104ffe23b8 100644 --- a/packages/flutter/lib/src/widgets/shortcuts.dart +++ b/packages/flutter/lib/src/widgets/shortcuts.dart @@ -110,7 +110,7 @@ class KeySet { /// This is a thin wrapper around a [Set], but changes the equality comparison /// from an identity comparison to a contents comparison so that non-identical /// sets with the same keys in them will compare as equal. -class LogicalKeySet extends KeySet with DiagnosticableMixin implements Diagnosticable { +class LogicalKeySet extends KeySet with Diagnosticable { /// A constructor for making a [LogicalKeySet] of up to four keys. /// /// If you need a set of more than four keys, use [LogicalKeySet.fromSet]. @@ -201,7 +201,7 @@ class ShortcutMapProperty extends DiagnosticsProperty /// /// A [ShortcutManager] is obtained by calling [Shortcuts.of] on the context of /// the widget that you want to find a manager for. -class ShortcutManager extends ChangeNotifier with DiagnosticableMixin implements Diagnosticable { +class ShortcutManager extends ChangeNotifier with Diagnosticable { /// Constructs a [ShortcutManager]. /// /// The [shortcuts] argument must not be null. diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index fcd5940fbd..4d021afd80 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -635,7 +635,7 @@ class _DiagnosticsPathNode { } List<_DiagnosticsPathNode> _followDiagnosticableChain( - List chain, { + List chain, { String name, DiagnosticsTreeStyle style, }) { @@ -644,7 +644,7 @@ List<_DiagnosticsPathNode> _followDiagnosticableChain( return path; DiagnosticsNode diagnostic = chain.first.toDiagnosticsNode(name: name, style: style); for (int i = 1; i < chain.length; i += 1) { - final DiagnosticableMixin target = chain[i]; + final Diagnosticable target = chain[i]; bool foundMatch = false; final List children = diagnostic.getChildren(); for (int j = 0; j < children.length; j += 1) { @@ -1550,7 +1550,7 @@ mixin WidgetInspectorService { return true; } final Object value = node.value; - if (value is! DiagnosticableMixin) { + if (value is! Diagnosticable) { return true; } if (value is! Element || !isWidgetCreationTracked()) { diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart index ce4ecf5389..18768a95a9 100644 --- a/packages/flutter/test/foundation/diagnostics_test.dart +++ b/packages/flutter/test/foundation/diagnostics_test.dart @@ -180,7 +180,7 @@ void validatePropertyJsonSerializationHelper(final Map json, Dia } expect(json['propertyType'], equals(property.propertyType.toString())); expect(json.containsKey('defaultLevel'), isTrue); - if (property.value is DiagnosticableMixin) { + if (property.value is Diagnosticable) { expect(json['isDiagnosticableValue'], isTrue); } else { expect(json.containsKey('isDiagnosticableValue'), isFalse);