From d2b42d8c13f2dba6ba12c84a0e66fadf7eb94c16 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 24 Jun 2024 16:52:12 -0700 Subject: [PATCH] Linkify 'see also' sections (#150734) Follow-up to https://github.com/flutter/flutter/pull/150540. Fixes https://github.com/flutter/flutter/issues/150562. --- packages/flutter/lib/src/gestures/monodrag.dart | 14 +++++++------- packages/flutter/lib/src/gestures/multitap.dart | 10 +++++----- packages/flutter/lib/src/gestures/recognizer.dart | 14 +++++++------- packages/flutter/lib/src/gestures/tap.dart | 2 +- packages/flutter/lib/src/material/switch.dart | 8 ++++---- packages/flutter/lib/src/material/theme_data.dart | 11 ++++++----- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/packages/flutter/lib/src/gestures/monodrag.dart b/packages/flutter/lib/src/gestures/monodrag.dart index 2a211ec7804..4c8490eb47d 100644 --- a/packages/flutter/lib/src/gestures/monodrag.dart +++ b/packages/flutter/lib/src/gestures/monodrag.dart @@ -81,8 +81,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { this.velocityTrackerBuilder = _defaultBuilder, this.onlyAcceptDragOnThreshold = false, super.supportedDevices, - AllowedButtonsFilter? allowedButtonsFilter, - }) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior); + super.allowedButtonsFilter = _defaultButtonAcceptBehavior, + }); static VelocityTracker _defaultBuilder(PointerEvent event) => VelocityTracker.withKind(event.kind); @@ -146,7 +146,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [DragDownDetails], which is passed as an argument to this callback. GestureDragDownCallback? onDown; @@ -161,7 +161,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [DragStartDetails], which is passed as an argument to this callback. GestureDragStartCallback? onStart; @@ -183,7 +183,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [DragUpdateDetails], which is passed as an argument to this callback. GestureDragUpdateCallback? onUpdate; @@ -206,7 +206,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [DragEndDetails], which is passed as an argument to this callback. GestureDragEndCallback? onEnd; @@ -214,7 +214,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. GestureDragCancelCallback? onCancel; /// The minimum distance an input pointer drag must have moved diff --git a/packages/flutter/lib/src/gestures/multitap.dart b/packages/flutter/lib/src/gestures/multitap.dart index 46be06bd7a4..404130ece6b 100644 --- a/packages/flutter/lib/src/gestures/multitap.dart +++ b/packages/flutter/lib/src/gestures/multitap.dart @@ -119,8 +119,8 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { DoubleTapGestureRecognizer({ super.debugOwner, super.supportedDevices, - AllowedButtonsFilter? allowedButtonsFilter, - }) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior); + super.allowedButtonsFilter = _defaultButtonAcceptBehavior, + }); // The default value for [allowedButtonsFilter]. // Accept the input if, and only if, [kPrimaryButton] is pressed. @@ -161,7 +161,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [TapDownDetails], which is passed as an argument to this callback. /// * [GestureDetector.onDoubleTapDown], which exposes this callback. GestureTapDownCallback? onDoubleTapDown; @@ -174,7 +174,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [GestureDetector.onDoubleTap], which exposes this callback. GestureDoubleTapCallback? onDoubleTap; @@ -188,7 +188,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { /// /// See also: /// - /// * `allowedButtonsFilter`, which decides which button will be allowed. + /// * [allowedButtonsFilter], which decides which button will be allowed. /// * [GestureDetector.onDoubleTapCancel], which exposes this callback. GestureTapCancelCallback? onDoubleTapCancel; diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart index 37794bdf8de..9d1b564d182 100644 --- a/packages/flutter/lib/src/gestures/recognizer.dart +++ b/packages/flutter/lib/src/gestures/recognizer.dart @@ -101,7 +101,8 @@ enum MultitouchDragStrategy { sumAllPointers, } -/// Signature for `allowedButtonsFilter` in [GestureRecognizer]. +/// Signature for [GestureRecognizer.allowedButtonsFilter]. +/// /// Used to filter the input buttons of incoming pointer events. /// The parameter `buttons` comes from [PointerEvent.buttons]. typedef AllowedButtonsFilter = bool Function(int buttons); @@ -132,8 +133,8 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT GestureRecognizer({ this.debugOwner, this.supportedDevices, - AllowedButtonsFilter? allowedButtonsFilter, - }) : _allowedButtonsFilter = allowedButtonsFilter ?? _defaultButtonAcceptBehavior { + this.allowedButtonsFilter = _defaultButtonAcceptBehavior, + }) { // TODO(polina-c): stop duplicating code across disposables // https://github.com/flutter/flutter/issues/137435 if (kFlutterMemoryAllocationsEnabled) { @@ -178,7 +179,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT /// /// Defaults to all buttons. /// {@endtemplate} - final AllowedButtonsFilter _allowedButtonsFilter; + final AllowedButtonsFilter allowedButtonsFilter; // The default value for [allowedButtonsFilter]. // Accept any input. @@ -271,9 +272,8 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT /// Checks whether or not a pointer is allowed to be tracked by this recognizer. @protected bool isPointerAllowed(PointerDownEvent event) { - return (supportedDevices == null || - supportedDevices!.contains(event.kind)) && - _allowedButtonsFilter(event.buttons); + return (supportedDevices == null || supportedDevices!.contains(event.kind)) + && allowedButtonsFilter(event.buttons); } /// Handles a pointer pan/zoom being added that's not allowed by this recognizer. diff --git a/packages/flutter/lib/src/gestures/tap.dart b/packages/flutter/lib/src/gestures/tap.dart index 0bdc01e341a..d522c799110 100644 --- a/packages/flutter/lib/src/gestures/tap.dart +++ b/packages/flutter/lib/src/gestures/tap.dart @@ -354,7 +354,7 @@ abstract class BaseTapGestureRecognizer extends PrimaryPointerGestureRecognizer /// no-op. /// /// {@template flutter.gestures.tap.TapGestureRecognizer.allowedButtonsFilter} -/// The `allowedButtonsFilter` argument only gives this recognizer the +/// The [allowedButtonsFilter] argument only gives this recognizer the /// ability to limit the buttons it accepts. It does not provide the /// ability to recognize any buttons beyond the ones it already accepts: /// kPrimaryButton, kSecondaryButton or kTertiaryButton. Therefore, a diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index aab4348d3e6..b810583b36a 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -137,10 +137,10 @@ class Switch extends StatelessWidget { /// is iOS or macOS, otherwise a Material Design switch is created. /// /// To provide a custom switch theme that's only used by this factory - /// constructor, add a custom `Adaptation` class to - /// `ThemeData.adaptations`. This can be useful in situations where you don't - /// want the overall [ThemeData.switchTheme] to apply when this adaptive - /// constructor is used. + /// constructor, pass a custom `Adaptation` class to the + /// `adaptations` parameter of [ThemeData]. This can be useful in situations + /// where you don't want the overall [ThemeData.switchTheme] to apply when + /// this adaptive constructor is used. /// /// {@tool dartpad} /// This sample shows how to create and use subclasses of [Adaptation] that diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 9ebea08c0b7..1a245112e15 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -87,11 +87,12 @@ class Adaptation { /// ThemeData class, like [SwitchThemeData], instead of the defaultValue. /// /// Factory constructors that support adaptations - currently only - /// [Switch.adaptive] - look for a `ThemeData.adaptations` member of the expected - /// type when computing their effective default component theme. If a matching - /// adaptation is not found, the component may choose to use a default adaptation. - /// For example, the [Switch.adaptive] component uses an empty [SwitchThemeData] - /// if a matching adaptation is not found, for the sake of backwards compatibility. + /// [Switch.adaptive] - look for a type-specific adaptation in + /// [ThemeData.adaptationMap] when computing their effective default component + /// theme. If a matching adaptation is not found, the component may choose to + /// use a default adaptation. For example, the [Switch.adaptive] component + /// uses an empty [SwitchThemeData] if a matching adaptation is not found, for + /// the sake of backwards compatibility. /// /// {@tool dartpad} /// This sample shows how to create and use subclasses of [Adaptation] that