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
e0c0321e
Unverified
Commit
e0c0321e
authored
Oct 08, 2020
by
nero
Committed by
GitHub
Oct 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ReorderableListView] Fix item dropping animation (#64140)
parent
30c0fc1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
reorderable_list.dart
packages/flutter/lib/src/material/reorderable_list.dart
+2
-2
reorderable_list_test.dart
packages/flutter/test/material/reorderable_list_test.dart
+52
-0
No files found.
packages/flutter/lib/src/material/reorderable_list.dart
View file @
e0c0321e
...
@@ -381,8 +381,8 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
...
@@ -381,8 +381,8 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
if
(
startIndex
!=
endIndex
)
if
(
startIndex
!=
endIndex
)
widget
.
onReorder
(
startIndex
,
endIndex
);
widget
.
onReorder
(
startIndex
,
endIndex
);
// Animates leftover space in the drop area closed.
// Animates leftover space in the drop area closed.
_ghostController
.
reverse
(
from:
0
.1
);
_ghostController
.
reverse
(
from:
0
);
_entranceController
.
reverse
(
from:
0
.1
);
_entranceController
.
reverse
(
from:
0
);
_dragging
=
null
;
_dragging
=
null
;
});
});
}
}
...
...
packages/flutter/test/material/reorderable_list_test.dart
View file @
e0c0321e
...
@@ -1173,6 +1173,58 @@ void main() {
...
@@ -1173,6 +1173,58 @@ void main() {
));
));
expect
(
tester
.
getCenter
(
find
.
text
(
'A'
)).
dy
,
lessThan
(
tester
.
getCenter
(
find
.
text
(
'B'
)).
dy
));
expect
(
tester
.
getCenter
(
find
.
text
(
'A'
)).
dy
,
lessThan
(
tester
.
getCenter
(
find
.
text
(
'B'
)).
dy
));
});
});
testWidgets
(
'Animation test when placing an item in place'
,
(
WidgetTester
tester
)
async
{
const
Key
testItemKey
=
Key
(
'Test item'
);
final
Widget
reorderableListView
=
ReorderableListView
(
children:
const
<
Widget
>[
SizedBox
(
key:
Key
(
'First item'
),
height:
itemHeight
,
child:
Text
(
'First item'
),
),
SizedBox
(
key:
testItemKey
,
height:
itemHeight
,
child:
Text
(
'Test item'
),
),
SizedBox
(
key:
Key
(
'Last item'
),
height:
itemHeight
,
child:
Text
(
'Last item'
),
),
],
scrollDirection:
Axis
.
vertical
,
onReorder:
(
int
oldIndex
,
int
newIndex
)
{
},
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
SizedBox
(
height:
itemHeight
*
10
,
child:
reorderableListView
,
),
));
Offset
getTestItemPosition
()
{
final
RenderBox
testItem
=
tester
.
renderObject
<
RenderBox
>(
find
.
byKey
(
testItemKey
));
return
testItem
.
localToGlobal
(
Offset
.
zero
);
}
// Before pick it up.
final
Offset
startPosition
=
getTestItemPosition
();
// Pick it up.
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byKey
(
testItemKey
)));
await
tester
.
pump
(
kLongPressTimeout
+
kPressTimeout
);
expect
(
getTestItemPosition
(),
startPosition
);
// Put it down.
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
getTestItemPosition
(),
startPosition
);
// After put it down.
await
tester
.
pumpAndSettle
();
expect
(
getTestItemPosition
(),
startPosition
);
});
// TODO(djshuckerow): figure out how to write a test for scrolling the list.
// TODO(djshuckerow): figure out how to write a test for scrolling the list.
});
});
}
}
...
...
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