philip-brink / DragAndDropLists

Flutter package for drag-and-drop reordering of two-level lists
BSD 3-Clause "New" or "Revised" License
253 stars 128 forks source link

Sliver List Cannot be Empty #28

Open justinsunyt opened 3 years ago

justinsunyt commented 3 years ago

When DragAndDropLists is a sliver list and its children is empty, I get this error: A RenderSliverPadding expected a child of type RenderSliver but received a child of type RenderPositionedBox.

Digging through the source code, the problem seems to be that when children is empty, it returns this:

return Center(
  child: Column(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      widget.contentsWhenEmpty ?? Text('Empty'),
      dragAndDropListTarget,
    ],
  ),
);

Instead of Center, it should render a sliver.