Skip to content

ReorderableListView throws errors when containing only one draggable item #136331

Closed

Description

@TuragNikandam

Is there an existing issue for this?

Steps to reproduce

  1. Create Column
  2. Create Flexible Widget as child
  3. Create ReorderableListView as child
  4. Set shrinkWrap of ReorderableListView to true
  5. Set onReorder
  6. Set Children as ReorderableDragStartListener
  7. Start run & debug on mobile android emulator (tested with Pixel 6 Pro API 29 and 34)
  8. 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!

Activity

  1. dam-ease commented on Oct 11, 2023

    @dam-ease

    Hi @TuragNikandam. Thanks for filing this. I can reproduce this on the latest master and stable channels. I see this is peculiar to Android as I'm unable to reproduce this on iOS.

    stable, master flutter doctor -v

    [✓] Flutter (Channel stable, 3.13.6, on macOS 13.0 22A380 darwin-arm64, locale
        en-NG)
        • Flutter version 3.13.6 on channel stable at
          /Users/damilolaalimi/sdks/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ead455963c (2 weeks ago), 2023-09-26 18:28:17 -0700
        • Engine revision a794cf2681
        • Dart version 3.1.3
        • DevTools version 2.25.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/damilolaalimi/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/damilolaalimi/Library/Android/sdk
        • Java binary at: /Applications/Android
          Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14E300c
        • CocoaPods version 1.12.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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-17.0.6b802.4-9586694)
    
    [!] Android Studio (version unknown)
        • Android Studio at /Users/damilolaalimi/Downloads/Android Studio
          Preview.app/Contents
        • 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
        ✗ Unable to determine Android Studio version.
        • Java version OpenJDK Runtime Environment (build
          17.0.7+0-17.0.7b1000.6-10550314)
    
    [✓] VS Code (version 1.82.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.50.0
    
    [✓] Connected device (4 available)
        • sdk gphone64 arm64 (mobile) • emulator-5556                        •
          android-arm64  • Android 14 (API 34) (emulator)
        • iPhone XS (mobile)          • 3CFD1268-0D52-486E-A12E-6E136E972D94 • ios
          • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
        • macOS (desktop)             • macos                                •
          darwin-arm64   • macOS 13.0 22A380 darwin-arm64
        • Chrome (web)                • chrome                               •
          web-javascript • Google Chrome 117.0.5938.149
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.16.0-10.0.pre.17, on macOS 13.0 22A380 darwin-arm64, locale en-NG)
        • Flutter version 3.16.0-10.0.pre.17 on channel master at /Users/damilolaalimi/fvm/versions/master
        ! Warning: `flutter` on your path resolves to /Users/damilolaalimi/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/damilolaalimi/fvm/versions/master. Consider adding /Users/damilolaalimi/fvm/versions/master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/damilolaalimi/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/damilolaalimi/fvm/versions/master. Consider adding /Users/damilolaalimi/fvm/versions/master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 94f748388e (2 hours ago), 2023-10-11 01:48:21 -0400
        • Engine revision cb0dabd3b3
        • Dart version 3.3.0 (build 3.3.0-6.0.dev)
        • DevTools version 2.28.1
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/damilolaalimi/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • ANDROID_HOME = /Users/damilolaalimi/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14E300c
        • CocoaPods version 1.12.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • 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-17.0.6b802.4-9586694)
    
    [!] Android Studio (version unknown)
        • Android Studio at /Users/damilolaalimi/Downloads/Android Studio Preview.app/Contents
        • 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
        ✗ Unable to determine Android Studio version.
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    
    [✓] VS Code (version 1.82.3)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.50.0
    
    [✓] Connected device (4 available)
        • sdk gphone64 arm64 (mobile) • emulator-5556                        • android-arm64  • Android 14 (API 34) (emulator)
        • iPhone XS (mobile)          • 3CFD1268-0D52-486E-A12E-6E136E972D94 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
        • macOS (desktop)             • macos                                • darwin-arm64   • macOS 13.0 22A380 darwin-arm64
        • Chrome (web)                • chrome                               • web-javascript • Google Chrome 117.0.5938.149
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 2 categories.
    

  2. added
    platform-androidAndroid applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-designOwned by Design Languages team
    f: scrollingViewports, list views, slivers, etc.
    and removed
    in triagePresently being triaged by the triage team
    on Oct 11, 2023
  3. changed the title [-]ReorderableListView throws errors when containing only one dragable item[/-] [+]ReorderableListView throws errors when containing only one draggable item[/+] on Oct 11, 2023
  4. added
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on Oct 11, 2023
  5. MeatCheatDev commented on Dec 20, 2023

    @MeatCheatDev

    I am encountering the same issue as described in #136331. The exception occurs when interacting with an Image widget in a Flutter web application. My widget tree:
    -Material app
    --SelectionArea
    ---Scaffold
    ----PageView
    -----Stack
    ------This:

     SizedBox(
                     height: 100,
                     child: IgnorePointer(
                           child: AspectRatio(
                                aspectRatio: 16 / 9,
                                child: Image.memory(
                                        base64Decode(selectedValue.imageURL!.split(',').last),
                                      ),
                                    ),
                                  ),
                                ),
    

    The exception is thrown as soon as the image is interacted with, e.g. simply by clicking on it.
    I have attempted to mitigate the issue by using IgnorePointer and adjusting the AspectRatio, but these attempts have not resolved the error. It appears to be a persistent issue, also in the Flutter web environment.

    Error: Assertion failed: file:///D:/..../scrollable_helpers.dart:237:7
    globalRect.size.width >= _dragTargetRelatedToScrollOrigin.size.width &&

    globalRect.size.height >= _dragTargetRelatedToScrollOrigin.size.height
    "Drag target size is larger than scrollable size, which may cause bouncing"
    dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:3 throw
    dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 35:3 assertFailed
    ...

    Best Regards.

  6. xSILENCEx commented on Dec 31, 2023

    @xSILENCEx

    Platform windows has the same problem

  7. 2 remaining items

  8. gxsham commented on Aug 26, 2024

    @gxsham

    Considering this happens because you have only one element, and (it makes sense) you cannot reorder one element, I am checking the size of my list and setting enabled to false:

    ReorderableSliverList( enabled: myList.length > 1, ... )

  9. 26sameer commented on Dec 18, 2024

    @26sameer

    Quick Fix (Only for list items without interactions):
    You can wrap the ReorderableListView with the AbsorbPointer widget and set absorbing (bool) to:
    absorbing: list.length == 1? true : false

    This allows for dragging the items only if the list has more than 1 item

  10. elogir commented on Dec 18, 2024

    @elogir

    @26sameer That's a fix that works only if your item has no interactivity, as AbsorbPointer will... Absorb the pointer.

  11. fdwl commented on Jan 13, 2025

    @fdwl

    Issue: ReorderableListView drag detection area mismatch when wrapped in Transform.scale

    Description

    When wrapping a ReorderableListView inside a Transform.scale (or when it's a child of scaled widgets), the drag detection area doesn't match the visual representation. This causes the drag handles to respond to touch events at the wrong locations.

    Current Setup

    /dart InteractiveViewer( child: Transform( transform: Matrix4.identity()..scale(scale), child: ReorderableListView( children: [...], ), ) , )

    Expected Behavior

    The drag detection area should match the visually scaled items, making the drag interaction feel natural and accurate.

    Actual Behavior

    The drag detection area remains at the original size and position, while the visual elements are scaled, causing a mismatch between where users touch and where the system detects the touch.

    Reproduction Steps

    1. Create a ReorderableListView with multiple items
    2. Wrap it in a Transform.scale with a scale factor less than 1.0
    3. Try to drag items using the drag handles
    4. Notice that the touch areas don't align with the visual elements

    Example Code

    ···
    dart
    class MyWidget extends StatefulWidget {
    @OverRide
    State createState() => MyWidgetState();
    }
    class MyWidgetState extends State {
    @OverRide
    Widget build(BuildContext context) {
    return Transform.scale(
    scale: 0.5, // Any scale factor less than 1.0 will demonstrate the issue
    child: ReorderableListView(
    children: List.generate(
    5,
    (index) => ListTile(
    key: ValueKey(index),
    title: Text('Item $index'),
    ),
    ),
    onReorder: (oldIndex, newIndex) {
    // Reorder logic
    },
    ),
    );
    }
    }
    ···

    Platform

    • Flutter version: [your Flutter version]
    • Affects: Android, iOS, Windows (possibly all platforms)

    Additional Context

    • This issue becomes particularly problematic in applications that need to scale content dynamically, such as image editors or responsive layouts
    • The problem appears to be related to how Flutter handles hit testing for ReorderableListView when transform matrices are involved
    • Current workarounds (using CompositedTransform or custom drag handling) add complexity and may introduce other issues

    Possible Solutions

    1. Flutter could update the hit testing logic for ReorderableListView to account for ancestor transforms
    2. Add a built-in way to handle scaled drag areas in ReorderableListView
    3. Provide official documentation for handling such cases

    Related Issues

    • #136331 - Similar issue with ReorderableListView and transforms
  12. Zuckjet commented on Jul 1, 2025

    @Zuckjet
    Contributor

    I have encountered the same problem and have submitted a PR to fix it. I hope someone can help take a look at this PR.

  13. added
    r: fixedIssue is closed as already fixed in a newer version
    on Aug 1, 2025
  14. github-actions commented on Aug 15, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  15. locked as resolved and limited conversation to collaborators on Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectf: scrollingViewports, list views, slivers, etc.found in release: 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions