Linkify 'see also' sections (#150734)
Follow-up to https://github.com/flutter/flutter/pull/150540. Fixes https://github.com/flutter/flutter/issues/150562.
This commit is contained in:
parent
9efe11c6cb
commit
d2b42d8c13
@ -81,8 +81,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
this.velocityTrackerBuilder = _defaultBuilder,
|
this.velocityTrackerBuilder = _defaultBuilder,
|
||||||
this.onlyAcceptDragOnThreshold = false,
|
this.onlyAcceptDragOnThreshold = false,
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
AllowedButtonsFilter? allowedButtonsFilter,
|
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
}) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior);
|
});
|
||||||
|
|
||||||
static VelocityTracker _defaultBuilder(PointerEvent event) => VelocityTracker.withKind(event.kind);
|
static VelocityTracker _defaultBuilder(PointerEvent event) => VelocityTracker.withKind(event.kind);
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// 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.
|
/// * [DragDownDetails], which is passed as an argument to this callback.
|
||||||
GestureDragDownCallback? onDown;
|
GestureDragDownCallback? onDown;
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// 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.
|
/// * [DragStartDetails], which is passed as an argument to this callback.
|
||||||
GestureDragStartCallback? onStart;
|
GestureDragStartCallback? onStart;
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// 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.
|
/// * [DragUpdateDetails], which is passed as an argument to this callback.
|
||||||
GestureDragUpdateCallback? onUpdate;
|
GestureDragUpdateCallback? onUpdate;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// 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.
|
/// * [DragEndDetails], which is passed as an argument to this callback.
|
||||||
GestureDragEndCallback? onEnd;
|
GestureDragEndCallback? onEnd;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * `allowedButtonsFilter`, which decides which button will be allowed.
|
/// * [allowedButtonsFilter], which decides which button will be allowed.
|
||||||
GestureDragCancelCallback? onCancel;
|
GestureDragCancelCallback? onCancel;
|
||||||
|
|
||||||
/// The minimum distance an input pointer drag must have moved
|
/// The minimum distance an input pointer drag must have moved
|
||||||
|
@ -119,8 +119,8 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
|||||||
DoubleTapGestureRecognizer({
|
DoubleTapGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
AllowedButtonsFilter? allowedButtonsFilter,
|
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
}) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior);
|
});
|
||||||
|
|
||||||
// The default value for [allowedButtonsFilter].
|
// The default value for [allowedButtonsFilter].
|
||||||
// Accept the input if, and only if, [kPrimaryButton] is pressed.
|
// Accept the input if, and only if, [kPrimaryButton] is pressed.
|
||||||
@ -161,7 +161,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// 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.
|
/// * [TapDownDetails], which is passed as an argument to this callback.
|
||||||
/// * [GestureDetector.onDoubleTapDown], which exposes this callback.
|
/// * [GestureDetector.onDoubleTapDown], which exposes this callback.
|
||||||
GestureTapDownCallback? onDoubleTapDown;
|
GestureTapDownCallback? onDoubleTapDown;
|
||||||
@ -174,7 +174,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * `allowedButtonsFilter`, which decides which button will be allowed.
|
/// * [allowedButtonsFilter], which decides which button will be allowed.
|
||||||
/// * [GestureDetector.onDoubleTap], which exposes this callback.
|
/// * [GestureDetector.onDoubleTap], which exposes this callback.
|
||||||
GestureDoubleTapCallback? onDoubleTap;
|
GestureDoubleTapCallback? onDoubleTap;
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * `allowedButtonsFilter`, which decides which button will be allowed.
|
/// * [allowedButtonsFilter], which decides which button will be allowed.
|
||||||
/// * [GestureDetector.onDoubleTapCancel], which exposes this callback.
|
/// * [GestureDetector.onDoubleTapCancel], which exposes this callback.
|
||||||
GestureTapCancelCallback? onDoubleTapCancel;
|
GestureTapCancelCallback? onDoubleTapCancel;
|
||||||
|
|
||||||
|
@ -101,7 +101,8 @@ enum MultitouchDragStrategy {
|
|||||||
sumAllPointers,
|
sumAllPointers,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signature for `allowedButtonsFilter` in [GestureRecognizer].
|
/// Signature for [GestureRecognizer.allowedButtonsFilter].
|
||||||
|
///
|
||||||
/// Used to filter the input buttons of incoming pointer events.
|
/// Used to filter the input buttons of incoming pointer events.
|
||||||
/// The parameter `buttons` comes from [PointerEvent.buttons].
|
/// The parameter `buttons` comes from [PointerEvent.buttons].
|
||||||
typedef AllowedButtonsFilter = bool Function(int buttons);
|
typedef AllowedButtonsFilter = bool Function(int buttons);
|
||||||
@ -132,8 +133,8 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
|
|||||||
GestureRecognizer({
|
GestureRecognizer({
|
||||||
this.debugOwner,
|
this.debugOwner,
|
||||||
this.supportedDevices,
|
this.supportedDevices,
|
||||||
AllowedButtonsFilter? allowedButtonsFilter,
|
this.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
}) : _allowedButtonsFilter = allowedButtonsFilter ?? _defaultButtonAcceptBehavior {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
// TODO(polina-c): stop duplicating code across disposables
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
// https://github.com/flutter/flutter/issues/137435
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
if (kFlutterMemoryAllocationsEnabled) {
|
||||||
@ -178,7 +179,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
|
|||||||
///
|
///
|
||||||
/// Defaults to all buttons.
|
/// Defaults to all buttons.
|
||||||
/// {@endtemplate}
|
/// {@endtemplate}
|
||||||
final AllowedButtonsFilter _allowedButtonsFilter;
|
final AllowedButtonsFilter allowedButtonsFilter;
|
||||||
|
|
||||||
// The default value for [allowedButtonsFilter].
|
// The default value for [allowedButtonsFilter].
|
||||||
// Accept any input.
|
// 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.
|
/// Checks whether or not a pointer is allowed to be tracked by this recognizer.
|
||||||
@protected
|
@protected
|
||||||
bool isPointerAllowed(PointerDownEvent event) {
|
bool isPointerAllowed(PointerDownEvent event) {
|
||||||
return (supportedDevices == null ||
|
return (supportedDevices == null || supportedDevices!.contains(event.kind))
|
||||||
supportedDevices!.contains(event.kind)) &&
|
&& allowedButtonsFilter(event.buttons);
|
||||||
_allowedButtonsFilter(event.buttons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a pointer pan/zoom being added that's not allowed by this recognizer.
|
/// Handles a pointer pan/zoom being added that's not allowed by this recognizer.
|
||||||
|
@ -354,7 +354,7 @@ abstract class BaseTapGestureRecognizer extends PrimaryPointerGestureRecognizer
|
|||||||
/// no-op.
|
/// no-op.
|
||||||
///
|
///
|
||||||
/// {@template flutter.gestures.tap.TapGestureRecognizer.allowedButtonsFilter}
|
/// {@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 limit the buttons it accepts. It does not provide the
|
||||||
/// ability to recognize any buttons beyond the ones it already accepts:
|
/// ability to recognize any buttons beyond the ones it already accepts:
|
||||||
/// kPrimaryButton, kSecondaryButton or kTertiaryButton. Therefore, a
|
/// kPrimaryButton, kSecondaryButton or kTertiaryButton. Therefore, a
|
||||||
|
@ -137,10 +137,10 @@ class Switch extends StatelessWidget {
|
|||||||
/// is iOS or macOS, otherwise a Material Design switch is created.
|
/// is iOS or macOS, otherwise a Material Design switch is created.
|
||||||
///
|
///
|
||||||
/// To provide a custom switch theme that's only used by this factory
|
/// To provide a custom switch theme that's only used by this factory
|
||||||
/// constructor, add a custom `Adaptation<SwitchThemeData>` class to
|
/// constructor, pass a custom `Adaptation<SwitchThemeData>` class to the
|
||||||
/// `ThemeData.adaptations`. This can be useful in situations where you don't
|
/// `adaptations` parameter of [ThemeData]. This can be useful in situations
|
||||||
/// want the overall [ThemeData.switchTheme] to apply when this adaptive
|
/// where you don't want the overall [ThemeData.switchTheme] to apply when
|
||||||
/// constructor is used.
|
/// this adaptive constructor is used.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad}
|
/// {@tool dartpad}
|
||||||
/// This sample shows how to create and use subclasses of [Adaptation] that
|
/// This sample shows how to create and use subclasses of [Adaptation] that
|
||||||
|
@ -87,11 +87,12 @@ class Adaptation<T> {
|
|||||||
/// ThemeData class, like [SwitchThemeData], instead of the defaultValue.
|
/// ThemeData class, like [SwitchThemeData], instead of the defaultValue.
|
||||||
///
|
///
|
||||||
/// Factory constructors that support adaptations - currently only
|
/// Factory constructors that support adaptations - currently only
|
||||||
/// [Switch.adaptive] - look for a `ThemeData.adaptations` member of the expected
|
/// [Switch.adaptive] - look for a type-specific adaptation in
|
||||||
/// type when computing their effective default component theme. If a matching
|
/// [ThemeData.adaptationMap] when computing their effective default component
|
||||||
/// adaptation is not found, the component may choose to use a default adaptation.
|
/// theme. If a matching adaptation is not found, the component may choose to
|
||||||
/// For example, the [Switch.adaptive] component uses an empty [SwitchThemeData]
|
/// use a default adaptation. For example, the [Switch.adaptive] component
|
||||||
/// if a matching adaptation is not found, for the sake of backwards compatibility.
|
/// uses an empty [SwitchThemeData] if a matching adaptation is not found, for
|
||||||
|
/// the sake of backwards compatibility.
|
||||||
///
|
///
|
||||||
/// {@tool dartpad}
|
/// {@tool dartpad}
|
||||||
/// This sample shows how to create and use subclasses of [Adaptation] that
|
/// This sample shows how to create and use subclasses of [Adaptation] that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user