@@ -86,7 +86,7 @@ typedef DragAnchorStrategy = Offset Function(Draggable<Object> draggable, BuildC
86
86
/// If feedback is identical to the child, then this means the feedback will
87
87
/// exactly overlap the original child when the drag starts.
88
88
///
89
- /// This is the default [DragAnchorStrategy] and replaces [DragAnchor.child] .
89
+ /// This is the default [DragAnchorStrategy] .
90
90
///
91
91
/// See also:
92
92
///
@@ -110,8 +110,6 @@ Offset childDragAnchorStrategy(Draggable<Object> draggable, BuildContext context
110
110
/// weird for it to appear offset from the original child if it's anchored to
111
111
/// the child and not the finger.)
112
112
///
113
- /// This replaces [DragAnchor.pointer] , which has been deprecated.
114
- ///
115
113
/// See also:
116
114
///
117
115
/// * [DragAnchorStrategy] , the typedef that this function implements.
@@ -120,34 +118,6 @@ Offset pointerDragAnchorStrategy(Draggable<Object> draggable, BuildContext conte
120
118
return Offset .zero;
121
119
}
122
120
123
- /// Where the [Draggable] should be anchored during a drag.
124
- ///
125
- /// This has been replaced by the more configurable [DragAnchorStrategy] .
126
- @Deprecated (
127
- 'Use dragAnchorStrategy instead. '
128
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
129
- )
130
- enum DragAnchor {
131
- /// Display the feedback anchored at the position of the original child.
132
- ///
133
- /// Replaced by [childDragAnchorStrategy] .
134
- @Deprecated (
135
- 'Use childDragAnchorStrategy instead. '
136
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
137
- )
138
- child,
139
-
140
- /// Display the feedback anchored at the position of the touch that started
141
- /// the drag.
142
- ///
143
- /// Replaced by [pointerDragAnchorStrategy] .
144
- @Deprecated (
145
- 'Use pointerDragAnchorStrategy instead. '
146
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
147
- )
148
- pointer,
149
- }
150
-
151
121
/// A widget that can be dragged from to a [DragTarget] .
152
122
///
153
123
/// When a draggable widget recognizes the start of a drag gesture, it displays
@@ -197,14 +167,7 @@ class Draggable<T extends Object> extends StatefulWidget {
197
167
this .axis,
198
168
this .childWhenDragging,
199
169
this .feedbackOffset = Offset .zero,
200
- @Deprecated (
201
- 'Use dragAnchorStrategy instead. '
202
- 'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". '
203
- 'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". '
204
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
205
- )
206
- this .dragAnchor = DragAnchor .child,
207
- this .dragAnchorStrategy,
170
+ this .dragAnchorStrategy = childDragAnchorStrategy,
208
171
this .affinity,
209
172
this .maxSimultaneousDrags,
210
173
this .onDragStarted,
@@ -220,7 +183,8 @@ class Draggable<T extends Object> extends StatefulWidget {
220
183
assert (feedback != null ),
221
184
assert (ignoringFeedbackSemantics != null ),
222
185
assert (ignoringFeedbackPointer != null ),
223
- assert (maxSimultaneousDrags == null || maxSimultaneousDrags >= 0 );
186
+ assert (maxSimultaneousDrags == null || maxSimultaneousDrags >= 0 ),
187
+ assert (dragAnchorStrategy != null );
224
188
225
189
/// The data that will be dropped by this draggable.
226
190
final T ? data;
@@ -276,17 +240,6 @@ class Draggable<T extends Object> extends StatefulWidget {
276
240
/// is transformed compared to the child.
277
241
final Offset feedbackOffset;
278
242
279
- /// Where this widget should be anchored during a drag.
280
- ///
281
- /// This property is overridden by the [dragAnchorStrategy] if the latter is provided.
282
- ///
283
- /// Defaults to [DragAnchor.child] .
284
- @Deprecated (
285
- 'Use dragAnchorStrategy instead. '
286
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
287
- )
288
- final DragAnchor dragAnchor;
289
-
290
243
/// A strategy that is used by this draggable to get the anchor offset when it
291
244
/// is dragged.
292
245
///
@@ -302,10 +255,8 @@ class Draggable<T extends Object> extends StatefulWidget {
302
255
/// * [pointerDragAnchorStrategy] , which displays the feedback anchored at the
303
256
/// position of the touch that started the drag.
304
257
///
305
- /// Defaults to [childDragAnchorStrategy] if the deprecated [dragAnchor]
306
- /// property is set to [DragAnchor.child] , and [pointerDragAnchorStrategy] if
307
- /// the [dragAnchor] is set to [DragAnchor.pointer] .
308
- final DragAnchorStrategy ? dragAnchorStrategy;
258
+ /// Defaults to [childDragAnchorStrategy] .
259
+ final DragAnchorStrategy dragAnchorStrategy;
309
260
310
261
/// Whether the semantics of the [feedback] widget is ignored when building
311
262
/// the semantics tree.
@@ -447,13 +398,6 @@ class LongPressDraggable<T extends Object> extends Draggable<T> {
447
398
super .axis,
448
399
super .childWhenDragging,
449
400
super .feedbackOffset,
450
- @Deprecated (
451
- 'Use dragAnchorStrategy instead. '
452
- 'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". '
453
- 'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". '
454
- 'This feature was deprecated after v2.1.0-10.0.pre.' ,
455
- )
456
- super .dragAnchor,
457
401
super .dragAnchorStrategy,
458
402
super .maxSimultaneousDrags,
459
403
super .onDragStarted,
@@ -539,18 +483,7 @@ class _DraggableState<T extends Object> extends State<Draggable<T>> {
539
483
return null ;
540
484
}
541
485
final Offset dragStartPoint;
542
- if (widget.dragAnchorStrategy == null ) {
543
- switch (widget.dragAnchor) {
544
- case DragAnchor .child:
545
- dragStartPoint = childDragAnchorStrategy (widget, context, position);
546
- break ;
547
- case DragAnchor .pointer:
548
- dragStartPoint = pointerDragAnchorStrategy (widget, context, position);
549
- break ;
550
- }
551
- } else {
552
- dragStartPoint = widget.dragAnchorStrategy !(widget, context, position);
553
- }
486
+ dragStartPoint = widget.dragAnchorStrategy (widget, context, position);
554
487
setState (() {
555
488
_activeCount += 1 ;
556
489
});
0 commit comments