0

Encounter this error if added SingleChildScrollView In my screen it will still have others widgets as well, that's why i need to make my screen scrollable

return SingleChildScrollView(
          child: Column(
            children: [
              Expanded(
                child: ReorderableListView.builder(
                  shrinkWrap: true,
                  scrollController: ScrollController(),
                  physics: ScrollPhysics(),
                  itemCount: object.length,
                  onReorder:onReorder,
                  itemBuilder: (BuildContext context, int index) {
                    return...
                  },),
              ),
            ],
          ),
        );
Choy
  • 452
  • 1
  • 5
  • 19
  • Why not just returning ReordableListView.builder() and forget about the rest? What do you want to achieve? – JayJay Apr 23 '21 at 21:12
  • I want to make my whole screen scrollable, i still have others widgets – Choy Apr 23 '21 at 21:13
  • ok but then you cannot wrap the ReordableListView with an Expanded. Because SibgleChilScrollView has the possibility to go to infinity. Therefore your ReordableListView will be infinite. So tell me you want the ReoradableListview to cover how much of the screen? – JayJay Apr 23 '21 at 21:21

1 Answers1

1

Either set height to your ReorderableListView:

Container(
  height: 100,
  child: ReorderableListView(...
...

Or check this: How to use Expanded in SingleChildScrollView?

Adelina
  • 10,915
  • 1
  • 38
  • 46