Skip to content

Commit d2b42d8

Browse files
authored
Linkify 'see also' sections (flutter#150734)
Follow-up to flutter#150540. Fixes flutter#150562.
1 parent 9efe11c commit d2b42d8

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

packages/flutter/lib/src/gestures/monodrag.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
8181
this.velocityTrackerBuilder = _defaultBuilder,
8282
this.onlyAcceptDragOnThreshold = false,
8383
super.supportedDevices,
84-
AllowedButtonsFilter? allowedButtonsFilter,
85-
}) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior);
84+
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
85+
});
8686

8787
static VelocityTracker _defaultBuilder(PointerEvent event) => VelocityTracker.withKind(event.kind);
8888

@@ -146,7 +146,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
146146
///
147147
/// See also:
148148
///
149-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
149+
/// * [allowedButtonsFilter], which decides which button will be allowed.
150150
/// * [DragDownDetails], which is passed as an argument to this callback.
151151
GestureDragDownCallback? onDown;
152152

@@ -161,7 +161,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
161161
///
162162
/// See also:
163163
///
164-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
164+
/// * [allowedButtonsFilter], which decides which button will be allowed.
165165
/// * [DragStartDetails], which is passed as an argument to this callback.
166166
GestureDragStartCallback? onStart;
167167

@@ -183,7 +183,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
183183
///
184184
/// See also:
185185
///
186-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
186+
/// * [allowedButtonsFilter], which decides which button will be allowed.
187187
/// * [DragUpdateDetails], which is passed as an argument to this callback.
188188
GestureDragUpdateCallback? onUpdate;
189189

@@ -206,15 +206,15 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
206206
///
207207
/// See also:
208208
///
209-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
209+
/// * [allowedButtonsFilter], which decides which button will be allowed.
210210
/// * [DragEndDetails], which is passed as an argument to this callback.
211211
GestureDragEndCallback? onEnd;
212212

213213
/// The pointer that previously triggered [onDown] did not complete.
214214
///
215215
/// See also:
216216
///
217-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
217+
/// * [allowedButtonsFilter], which decides which button will be allowed.
218218
GestureDragCancelCallback? onCancel;
219219

220220
/// The minimum distance an input pointer drag must have moved

packages/flutter/lib/src/gestures/multitap.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
119119
DoubleTapGestureRecognizer({
120120
super.debugOwner,
121121
super.supportedDevices,
122-
AllowedButtonsFilter? allowedButtonsFilter,
123-
}) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior);
122+
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
123+
});
124124

125125
// The default value for [allowedButtonsFilter].
126126
// Accept the input if, and only if, [kPrimaryButton] is pressed.
@@ -161,7 +161,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
161161
///
162162
/// See also:
163163
///
164-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
164+
/// * [allowedButtonsFilter], which decides which button will be allowed.
165165
/// * [TapDownDetails], which is passed as an argument to this callback.
166166
/// * [GestureDetector.onDoubleTapDown], which exposes this callback.
167167
GestureTapDownCallback? onDoubleTapDown;
@@ -174,7 +174,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
174174
///
175175
/// See also:
176176
///
177-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
177+
/// * [allowedButtonsFilter], which decides which button will be allowed.
178178
/// * [GestureDetector.onDoubleTap], which exposes this callback.
179179
GestureDoubleTapCallback? onDoubleTap;
180180

@@ -188,7 +188,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
188188
///
189189
/// See also:
190190
///
191-
/// * `allowedButtonsFilter`, which decides which button will be allowed.
191+
/// * [allowedButtonsFilter], which decides which button will be allowed.
192192
/// * [GestureDetector.onDoubleTapCancel], which exposes this callback.
193193
GestureTapCancelCallback? onDoubleTapCancel;
194194

packages/flutter/lib/src/gestures/recognizer.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ enum MultitouchDragStrategy {
101101
sumAllPointers,
102102
}
103103

104-
/// Signature for `allowedButtonsFilter` in [GestureRecognizer].
104+
/// Signature for [GestureRecognizer.allowedButtonsFilter].
105+
///
105106
/// Used to filter the input buttons of incoming pointer events.
106107
/// The parameter `buttons` comes from [PointerEvent.buttons].
107108
typedef AllowedButtonsFilter = bool Function(int buttons);
@@ -132,8 +133,8 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
132133
GestureRecognizer({
133134
this.debugOwner,
134135
this.supportedDevices,
135-
AllowedButtonsFilter? allowedButtonsFilter,
136-
}) : _allowedButtonsFilter = allowedButtonsFilter ?? _defaultButtonAcceptBehavior {
136+
this.allowedButtonsFilter = _defaultButtonAcceptBehavior,
137+
}) {
137138
// TODO(polina-c): stop duplicating code across disposables
138139
// https://github.com/flutter/flutter/issues/137435
139140
if (kFlutterMemoryAllocationsEnabled) {
@@ -178,7 +179,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
178179
///
179180
/// Defaults to all buttons.
180181
/// {@endtemplate}
181-
final AllowedButtonsFilter _allowedButtonsFilter;
182+
final AllowedButtonsFilter allowedButtonsFilter;
182183

183184
// The default value for [allowedButtonsFilter].
184185
// Accept any input.
@@ -271,9 +272,8 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
271272
/// Checks whether or not a pointer is allowed to be tracked by this recognizer.
272273
@protected
273274
bool isPointerAllowed(PointerDownEvent event) {
274-
return (supportedDevices == null ||
275-
supportedDevices!.contains(event.kind)) &&
276-
_allowedButtonsFilter(event.buttons);
275+
return (supportedDevices == null || supportedDevices!.contains(event.kind))
276+
&& allowedButtonsFilter(event.buttons);
277277
}
278278

279279
/// Handles a pointer pan/zoom being added that's not allowed by this recognizer.

packages/flutter/lib/src/gestures/tap.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ abstract class BaseTapGestureRecognizer extends PrimaryPointerGestureRecognizer
354354
/// no-op.
355355
///
356356
/// {@template flutter.gestures.tap.TapGestureRecognizer.allowedButtonsFilter}
357-
/// The `allowedButtonsFilter` argument only gives this recognizer the
357+
/// The [allowedButtonsFilter] argument only gives this recognizer the
358358
/// ability to limit the buttons it accepts. It does not provide the
359359
/// ability to recognize any buttons beyond the ones it already accepts:
360360
/// kPrimaryButton, kSecondaryButton or kTertiaryButton. Therefore, a

packages/flutter/lib/src/material/switch.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ class Switch extends StatelessWidget {
137137
/// is iOS or macOS, otherwise a Material Design switch is created.
138138
///
139139
/// To provide a custom switch theme that's only used by this factory
140-
/// constructor, add a custom `Adaptation<SwitchThemeData>` class to
141-
/// `ThemeData.adaptations`. This can be useful in situations where you don't
142-
/// want the overall [ThemeData.switchTheme] to apply when this adaptive
143-
/// constructor is used.
140+
/// constructor, pass a custom `Adaptation<SwitchThemeData>` class to the
141+
/// `adaptations` parameter of [ThemeData]. This can be useful in situations
142+
/// where you don't want the overall [ThemeData.switchTheme] to apply when
143+
/// this adaptive constructor is used.
144144
///
145145
/// {@tool dartpad}
146146
/// This sample shows how to create and use subclasses of [Adaptation] that

packages/flutter/lib/src/material/theme_data.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ class Adaptation<T> {
8787
/// ThemeData class, like [SwitchThemeData], instead of the defaultValue.
8888
///
8989
/// Factory constructors that support adaptations - currently only
90-
/// [Switch.adaptive] - look for a `ThemeData.adaptations` member of the expected
91-
/// type when computing their effective default component theme. If a matching
92-
/// adaptation is not found, the component may choose to use a default adaptation.
93-
/// For example, the [Switch.adaptive] component uses an empty [SwitchThemeData]
94-
/// if a matching adaptation is not found, for the sake of backwards compatibility.
90+
/// [Switch.adaptive] - look for a type-specific adaptation in
91+
/// [ThemeData.adaptationMap] when computing their effective default component
92+
/// theme. If a matching adaptation is not found, the component may choose to
93+
/// use a default adaptation. For example, the [Switch.adaptive] component
94+
/// uses an empty [SwitchThemeData] if a matching adaptation is not found, for
95+
/// the sake of backwards compatibility.
9596
///
9697
/// {@tool dartpad}
9798
/// This sample shows how to create and use subclasses of [Adaptation] that

0 commit comments

Comments
 (0)