@@ -1356,6 +1356,55 @@ void main() {
13561356
13571357 expect (tester.takeException (), null );
13581358 });
1359+
1360+ testWidgetsWithLeakTracking (
1361+ 'When creating a new item, be in the correct position' ,
1362+ (WidgetTester tester) async {
1363+ await tester.pumpWidget (
1364+ MaterialApp (
1365+ home: LayoutBuilder (
1366+ builder: (_, BoxConstraints view) {
1367+ // The third one just appears on the screen
1368+ final double itemSize = view.maxWidth / 2 - 20 ;
1369+ return Scaffold (
1370+ body: CustomScrollView (
1371+ scrollDirection: Axis .horizontal,
1372+ cacheExtent: 0 , // The fourth one will not be created in the initial state.
1373+ slivers: < Widget > [
1374+ SliverReorderableList (
1375+ itemBuilder: (BuildContext context, int index) {
1376+ return ReorderableDragStartListener (
1377+ key: ValueKey <int >(index),
1378+ index: index,
1379+ child: Builder (
1380+ builder: (BuildContext context) {
1381+ return SizedBox (
1382+ width: itemSize,
1383+ child: Text ('$index ' ),
1384+ );
1385+ },
1386+ ),
1387+ );
1388+ },
1389+ itemCount: 4 ,
1390+ onReorder: (int fromIndex, int toIndex) {},
1391+ ),
1392+ ],
1393+ ),
1394+ );
1395+ },
1396+ ),
1397+ ),
1398+ );
1399+ final TestGesture drag = await tester.startGesture (tester.getCenter (find.text ('0' )));
1400+ await tester.pump (kLongPressTimeout);
1401+ await drag.moveBy (const Offset (20 , 0 ));
1402+ await tester.pump ();
1403+ expect (find.text ('3' ).hitTestable (at: Alignment .topLeft), findsNothing);
1404+ await drag.up ();
1405+ await tester.pumpAndSettle ();
1406+ },
1407+ );
13591408}
13601409
13611410class TestList extends StatelessWidget {
0 commit comments