Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
75d8fb36
Unverified
Commit
75d8fb36
authored
Sep 19, 2022
by
Kate Lovett
Committed by
GitHub
Sep 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated drag anchor (#111713)
parent
55ad0ab1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
76 deletions
+7
-76
drag_target.dart
packages/flutter/lib/src/widgets/drag_target.dart
+7
-74
draggable_test.dart
packages/flutter/test/widgets/draggable_test.dart
+0
-2
No files found.
packages/flutter/lib/src/widgets/drag_target.dart
View file @
75d8fb36
...
...
@@ -86,7 +86,7 @@ typedef DragAnchorStrategy = Offset Function(Draggable<Object> draggable, BuildC
/// If feedback is identical to the child, then this means the feedback will
/// exactly overlap the original child when the drag starts.
///
/// This is the default [DragAnchorStrategy]
and replaces [DragAnchor.child]
.
/// This is the default [DragAnchorStrategy].
///
/// See also:
///
...
...
@@ -110,8 +110,6 @@ Offset childDragAnchorStrategy(Draggable<Object> draggable, BuildContext context
/// weird for it to appear offset from the original child if it's anchored to
/// the child and not the finger.)
///
/// This replaces [DragAnchor.pointer], which has been deprecated.
///
/// See also:
///
/// * [DragAnchorStrategy], the typedef that this function implements.
...
...
@@ -120,34 +118,6 @@ Offset pointerDragAnchorStrategy(Draggable<Object> draggable, BuildContext conte
return
Offset
.
zero
;
}
/// Where the [Draggable] should be anchored during a drag.
///
/// This has been replaced by the more configurable [DragAnchorStrategy].
@Deprecated
(
'Use dragAnchorStrategy instead. '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
enum
DragAnchor
{
/// Display the feedback anchored at the position of the original child.
///
/// Replaced by [childDragAnchorStrategy].
@Deprecated
(
'Use childDragAnchorStrategy instead. '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
child
,
/// Display the feedback anchored at the position of the touch that started
/// the drag.
///
/// Replaced by [pointerDragAnchorStrategy].
@Deprecated
(
'Use pointerDragAnchorStrategy instead. '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
pointer
,
}
/// A widget that can be dragged from to a [DragTarget].
///
/// When a draggable widget recognizes the start of a drag gesture, it displays
...
...
@@ -197,14 +167,7 @@ class Draggable<T extends Object> extends StatefulWidget {
this
.
axis
,
this
.
childWhenDragging
,
this
.
feedbackOffset
=
Offset
.
zero
,
@Deprecated
(
'Use dragAnchorStrategy instead. '
'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". '
'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
this
.
dragAnchor
=
DragAnchor
.
child
,
this
.
dragAnchorStrategy
,
this
.
dragAnchorStrategy
=
childDragAnchorStrategy
,
this
.
affinity
,
this
.
maxSimultaneousDrags
,
this
.
onDragStarted
,
...
...
@@ -220,7 +183,8 @@ class Draggable<T extends Object> extends StatefulWidget {
assert
(
feedback
!=
null
),
assert
(
ignoringFeedbackSemantics
!=
null
),
assert
(
ignoringFeedbackPointer
!=
null
),
assert
(
maxSimultaneousDrags
==
null
||
maxSimultaneousDrags
>=
0
);
assert
(
maxSimultaneousDrags
==
null
||
maxSimultaneousDrags
>=
0
),
assert
(
dragAnchorStrategy
!=
null
);
/// The data that will be dropped by this draggable.
final
T
?
data
;
...
...
@@ -276,17 +240,6 @@ class Draggable<T extends Object> extends StatefulWidget {
/// is transformed compared to the child.
final
Offset
feedbackOffset
;
/// Where this widget should be anchored during a drag.
///
/// This property is overridden by the [dragAnchorStrategy] if the latter is provided.
///
/// Defaults to [DragAnchor.child].
@Deprecated
(
'Use dragAnchorStrategy instead. '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
final
DragAnchor
dragAnchor
;
/// A strategy that is used by this draggable to get the anchor offset when it
/// is dragged.
///
...
...
@@ -302,10 +255,8 @@ class Draggable<T extends Object> extends StatefulWidget {
/// * [pointerDragAnchorStrategy], which displays the feedback anchored at the
/// position of the touch that started the drag.
///
/// Defaults to [childDragAnchorStrategy] if the deprecated [dragAnchor]
/// property is set to [DragAnchor.child], and [pointerDragAnchorStrategy] if
/// the [dragAnchor] is set to [DragAnchor.pointer].
final
DragAnchorStrategy
?
dragAnchorStrategy
;
/// Defaults to [childDragAnchorStrategy].
final
DragAnchorStrategy
dragAnchorStrategy
;
/// Whether the semantics of the [feedback] widget is ignored when building
/// the semantics tree.
...
...
@@ -447,13 +398,6 @@ class LongPressDraggable<T extends Object> extends Draggable<T> {
super
.
axis
,
super
.
childWhenDragging
,
super
.
feedbackOffset
,
@Deprecated
(
'Use dragAnchorStrategy instead. '
'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". '
'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". '
'This feature was deprecated after v2.1.0-10.0.pre.'
,
)
super
.
dragAnchor
,
super
.
dragAnchorStrategy
,
super
.
maxSimultaneousDrags
,
super
.
onDragStarted
,
...
...
@@ -539,18 +483,7 @@ class _DraggableState<T extends Object> extends State<Draggable<T>> {
return
null
;
}
final
Offset
dragStartPoint
;
if
(
widget
.
dragAnchorStrategy
==
null
)
{
switch
(
widget
.
dragAnchor
)
{
case
DragAnchor
.
child
:
dragStartPoint
=
childDragAnchorStrategy
(
widget
,
context
,
position
);
break
;
case
DragAnchor
.
pointer
:
dragStartPoint
=
pointerDragAnchorStrategy
(
widget
,
context
,
position
);
break
;
}
}
else
{
dragStartPoint
=
widget
.
dragAnchorStrategy
!(
widget
,
context
,
position
);
}
dragStartPoint
=
widget
.
dragAnchorStrategy
(
widget
,
context
,
position
);
setState
(()
{
_activeCount
+=
1
;
});
...
...
packages/flutter/test/widgets/draggable_test.dart
View file @
75d8fb36
...
...
@@ -3192,8 +3192,6 @@ void main() {
expect
(
const
LongPressDraggable
<
int
>(
feedback:
widget2
,
child:
widget1
),
isA
<
Draggable
<
int
>>());
expect
(
const
LongPressDraggable
<
int
>(
feedback:
widget2
,
child:
widget1
).
child
,
widget1
);
expect
(
const
LongPressDraggable
<
int
>(
feedback:
widget2
,
child:
widget1
).
feedback
,
widget2
);
expect
(
const
LongPressDraggable
<
int
>(
feedback:
widget2
,
child:
widget1
).
dragAnchor
,
DragAnchor
.
child
);
expect
(
const
LongPressDraggable
<
int
>(
feedback:
widget2
,
dragAnchor:
DragAnchor
.
pointer
,
child:
widget1
).
dragAnchor
,
DragAnchor
.
pointer
);
expect
(
LongPressDraggable
<
int
>(
feedback:
widget2
,
dragAnchorStrategy:
dummyStrategy
,
child:
widget1
).
dragAnchorStrategy
,
dummyStrategy
);
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment