Skip to content

Commit

Permalink
Linkify 'see also' sections (flutter#150734)
Browse files Browse the repository at this point in the history
Follow-up to flutter#150540.

Fixes flutter#150562.
  • Loading branch information
goderbauer authored and sigurdm committed Jun 25, 2024
1 parent a58c8b0 commit 50f6edd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
14 changes: 7 additions & 7 deletions packages/flutter/lib/src/gestures/monodrag.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -206,15 +206,15 @@ 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;

/// The pointer that previously triggered [onDown] did not complete.
///
/// 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
Expand Down
10 changes: 5 additions & 5 deletions packages/flutter/lib/src/gestures/multitap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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;

Expand Down
14 changes: 7 additions & 7 deletions packages/flutter/lib/src/gestures/recognizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/gestures/tap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/material/switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<SwitchThemeData>` 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<SwitchThemeData>` 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
Expand Down
11 changes: 6 additions & 5 deletions packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ class Adaptation<T> {
/// 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
Expand Down

0 comments on commit 50f6edd

Please sign in to comment.