-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Create Column
- Create Flexible Widget as child
- Create ReorderableListView as child
- Set shrinkWrap of ReorderableListView to true
- Set onReorder
- Set Children as ReorderableDragStartListener
- Start run & debug on mobile android emulator (tested with Pixel 6 Pro API 29 and 34)
- Observe that if one item gets added to the list, then dragged over the space / area of the shrinked ReorderableListView, errors get thrown around
Expected results
Even if one item gets added to ReorderableListView with shrinkWrap set to true, the calculation of the area for reordering should still work, without throwing errors. It seems like shirnkWrap isn't working right.
Actual results
Logs
E/flutter ( 5496): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/scrollable_helpers.dart': Failed assertion: line 242 pos 7: 'globalRect.size.width >= _dragTargetRelatedToScrollOrigin.size.width &&
scrollable_helpers.dart:242
E/flutter ( 5496): globalRect.size.height >= _dragTargetRelatedToScrollOrigin.size.height': Drag target size is larger than scrollable size, which may cause bouncing
E/flutter ( 5496): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 5496): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 5496): #2 EdgeDraggingAutoScroller._scroll
scrollable_helpers.dart:242
E/flutter ( 5496): #3 EdgeDraggingAutoScroller.startAutoScrollIfNecessary
scrollable_helpers.dart:227
E/flutter ( 5496): #4 SliverReorderableListState._dragUpdate.<anonymous closure>
reorderable_list.dart:747
E/flutter ( 5496): #5 State.setState
framework.dart:1139
E/flutter ( 5496): #6 SliverReorderableListState._dragUpdate
reorderable_list.dart:744
E/flutter ( 5496): #7 _DragInfo.update
reorderable_list.dart:1275
E/flutter ( 5496): #8 MultiDragPointerState._startDrag
multidrag.dart:145
E/flutter ( 5496): #9 MultiDragGestureRecognizer._startDrag
multidrag.dart:293
E/flutter ( 5496): #10 MultiDragGestureRecognizer.acceptGesture.<anonymous closure>
multidrag.dart:281
E/flutter ( 5496): #11 _ImmediatePointerState.accepted
multidrag.dart:343
E/flutter ( 5496): #12 MultiDragGestureRecognizer.acceptGesture
multidrag.dart:281
E/flutter ( 5496): #13 GestureArenaManager._resolveInFavorOf
arena.dart:281
E/flutter ( 5496): #14 GestureArenaManager._resolve
arena.dart:239
E/flutter ( 5496): #15 GestureArenaEntry.resolve
arena.dart:53
E/flutter ( 5496): #16 MultiDragPointerState.resolve
multidrag.dart:81
E/flutter ( 5496): #17 _ImmediatePointerState.checkForResolutionAfterMove
multidrag.dart:337
E/flutter ( 5496): #18 MultiDragPointerState._move
multidrag.dart:101
E/flutter ( 5496): #19 MultiDragGestureRecognizer._handleEvent
multidrag.dart:254
E/flutter ( 5496): #20 PointerRouter._dispatch
pointer_router.dart:98
E/flutter ( 5496): #21 PointerRouter._dispatchEventToRoutes.<anonymous closure>
pointer_router.dart:143
E/flutter ( 5496): #22 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
E/flutter ( 5496): #23 PointerRouter._dispatchEventToRoutes
pointer_router.dart:141
E/flutter ( 5496): #24 PointerRouter.route
pointer_router.dart:127
E/flutter ( 5496): #25 GestureBinding.handleEvent
binding.dart:465
E/flutter ( 5496): #26 GestureBinding.dispatchEvent
binding.dart:445
E/flutter ( 5496): #27 RendererBinding.dispatchEvent
binding.dart:331
E/flutter ( 5496): #28 GestureBinding._handlePointerEventImmediately
binding.dart:400
E/flutter ( 5496): #29 GestureBinding.handlePointerEvent
binding.dart:363
E/flutter ( 5496): #30 GestureBinding._flushPointerEventQueue
binding.dart:320
E/flutter ( 5496): #31 GestureBinding._handlePointerDataPacket
binding.dart:293
E/flutter ( 5496): #32 _invoke1 (dart:ui/hooks.dart:158:13)
E/flutter ( 5496): #33 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:382:7)
E/flutter ( 5496): #34 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)
Code sample
Minimal code sample to use in "run & debug" mode. Check output in debug console.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final List<String> _selectedOrganizations = ["Org 1"];
final List<String> _unselectedOrganizations = ["Org 2", "Org 3"];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Reorderable List Example")),
body: Column(
children: [
Flexible(
flex: 1,
child: ReorderableListView(
shrinkWrap: true,
onReorder: (int oldIndex, int newIndex) {
setState(() {
if (newIndex > oldIndex) {
newIndex -= 1;
}
final item = _selectedOrganizations.removeAt(oldIndex);
_selectedOrganizations.insert(newIndex, item);
});
},
children: [
for (int index = 0;
index < _selectedOrganizations.length;
index++)
ReorderableDragStartListener(
index: index,
key: ValueKey(_selectedOrganizations[index]),
child: Card(
child: ListTile(
leading: buildOrganizationImage(
_selectedOrganizations[index], const CircleAvatar()),
title: Text(_selectedOrganizations[index]),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: const Icon(Icons.delete_rounded,
color: Colors.red),
onPressed: () {
setState(() {
final organization =
_selectedOrganizations[index];
_selectedOrganizations.removeAt(index);
_unselectedOrganizations.add(organization);
});
},
),
Icon(Icons.drag_handle,
color: Theme.of(context).primaryColor),
],
),
),
),
),
],
),
),
],
),
);
}
Widget buildOrganizationImage(String organization, CircleAvatar avatar) {
// Placeholder
return avatar;
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.10.2, on Microsoft Windows [Version 10.0.22621.2283], locale de-DE)
• Flutter version 3.10.2 on channel stable at C:\Flutter\Installation\flutter_windows_3.10.2-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9cd3d0d9ff (5 months ago), 2023-05-23 20:57:28 -0700
• Engine revision 90fa3ae28f
• Dart version 3.0.2
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at C:\Users\TuragNikandamCanvasR\AppData\Local\Android\sdk
• Platform android-34, build-tools 33.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.6.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
• Visual Studio Professional 2022 version 17.6.33801.468
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[√] VS Code (version 1.83.0)
• VS Code at C:\Users\TuragNikandamCanvasR\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.74.0
[√] Connected device (5 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
• Android SDK built for x86 (mobile) • emulator-5556 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2283]
• Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.150
• Edge (web) • edge • web-javascript • Microsoft Edge 117.0.2045.60
[√] Network resources
• All expected network resources are available.
• No issues found!AmosHuKe, MeatCheatDev, adriank, andrew-ares, Ignacio1110 and 6 more
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team