0

I need a reorderable list inside an expansion tile, but the ReorderableListView doesn't work unless it's put into a fixed size container or it gets the following errors.

BoxConstraints forces an infinite height.
The relevant error-causing widget was
ReorderableListView 

-

RenderBox was not laid out: RenderStack#77d94 relayoutBoundary=up18 NEEDS-PAINT 

NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
The relevant error-causing widget was
ReorderableListView

-

RenderBox was not laid out: _RenderTheatre#778cd relayoutBoundary=up17 NEEDS-PAINT 

NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
The relevant error-causing widget was
    ExpansionTile-[Thing]

And if I put it inside a fixed box I get the following error when trying to move items.

The following assertion was thrown while handling a gesture:
ScrollController attached to multiple scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
Failed assertion: line 111 pos 12: '_positions.length == 1'
Tristan King
  • 97
  • 13
  • Was, by any chance, your list in a `Column`? See https://stackoverflow.com/questions/52801201/flutter-renderbox-was-not-laid-out – Bondolin Mar 28 '21 at 02:55

2 Answers2

1

I ended up using this awesome package to do it instead of the very limited ReorderableListView.

Then I used the ReorderableColumn widget and it works great. The Flutter team really should update the ReorderableListView so that it’s not so limited.

Tristan King
  • 97
  • 13
-1

Here is an example of working code:

body: Column(
        children: <Widget>[
          Text('哈哈哈'),
          Expanded(
              child: ReorderableListView(
            header: cellManageHead(),
            children: list.map((e) => cellManage(e)).toList(),
            onReorder: _onReorder,
          ))
        ],
      ),
Gilles-Antoine Nys
  • 1,481
  • 16
  • 21
xiguang lu
  • 29
  • 4