please is there a way i can make a list items in an expanded panel scrollable. i tried to achieved that in the bellow code but i am getting bottom overflow error when i expand the first panel . thanks
ExpansionPanelList(
children: [
ExpansionPanel(
isExpanded: _isOpen[0],
headerBuilder: (context, isOpen) {
return Text("Activities");
},
body: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_myListView(),
// _myListView(),
],
),
),
),
ExpansionPanel(
isExpanded: _isOpen[1],
headerBuilder: (context, isOpen) {
return Text("Ports");
},
body: Text("Test!!!"),
)
],
expansionCallback: (i, isOpen) {
setState(() {
_isOpen[i] = !isOpen;
});
},
)
here is my myListView function,
Widget _myListView() {
return MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView(
shrinkWrap: true,
children: List1.keys.map((String key) {
return new CheckboxListTile(
title: new Text(key),
value: List1[key],
activeColor: Colors.black,
checkColor: Colors.white,
onChanged: (bool? value) {
setState(() {
List1[key] = value!;
});
},
);
}).toList(),
),
);
}
CodePudding user response:
Wrap your column SingleChildScrollView
SingleChildScrollView(
child: Column(
children: [
// your ExpansionPanelList
],
),
),
And also add physics: ScrollPhysics(),
in _myListView()
widget
Widget _myListView() {
return MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView(
shrinkWrap: true,
physics: ScrollPhysics(),
children: List1.keys.map((String key) {
return new CheckboxListTile(
title: new Text(key),
value: List1[key],
activeColor: Colors.black,
checkColor: Colors.white,
onChanged: (bool value) {
setState(() {
List1[key] = value;
});
},
);
}).toList(),
),
);
}