How to add footer to ReorderableListView in flutter
If you wrap your ReorderableListView with a Column and an Expanded widget, you can add a Container at the bottom to act as a footer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | Column( children: <Widget>[ Expanded( child: ReorderableListView( header: Container( height: 100, color: Colors.red, ), children: _list .map((item) => Container( padding: EdgeInsets.all(10), key: Key("${(item as Text).data}"), child: Row( children: <Widget>[ Icon(Icons.ac_unit), Expanded( child: item, ) ], ), )).toList(), onReorder: (int start, int current) { // dragging from top to bottom if (start < current) { int end = current - 1; Widget startItem = _list[start]; int i = 0; int local = start; do { _list[local] = _list[++local]; i++; } while (i < end - start); _list[end] = startItem; } // dragging from bottom to top if (start > current) { Widget startItem = _list[start]; for (int i = start; i > current; i--) { _list[i] = _list[i - 1]; } _list[current] = startItem; } setState(() {}); }, ), ), Container( height: 40, alignment: Alignment.center, child: Text('Footer'), color: Colors.orange, ), ], ), |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.