Here I create two ExpansionTile they automatically create space between them
SizedBox(
height: 500,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: ExpansionTile(
title: const Text('developer'),
children: List.generate(
successState.developerList.length,
(index) => EmployeeTileWidget(
employee: successState.developerList[index]),
),
),
),
),
Expanded(
child: SingleChildScrollView(
child: ExpansionTile(
title: const Text('testerList'),
children: List.generate(
successState.testerList.length,
(index) => EmployeeTileWidget(
employee: successState.testerList[index]),
),
),
),
),
],
),
),
flutter```
`the two ExpansionTile will automatically generate space `
I try to create two expand and collapse widget if one open the another stay on the bottom of the SizedBox. but in my case the one ExpansionTile will open the another one will go the end of the list so if need to scroll the end of the list to open the another ExpansionTile
I need to create if one ExpansionTile will open the another one will stay the bottom of the SizedBox if the if one ExpansionTile close then the another one will go back to the normal position
>Solution :
wrap your parent widget with scrollable widget and let the children has it own height.
see the code
SizedBox(
height: 500,
child: Column(children: [
ConstrainedBox(
constraints: BoxConstraints(maxHeight: 300),
child: SingleChildScrollView(
child: ExpansionTile(
title: const Text('testerList'),
children: List.generate(
3,
(index) => Text("ssdasdas"),
),
)),
),
ExpansionTile(
title: const Text('testerList'),
children: List.generate(
7,
(index) => Text("ssdasdas"),
),
),
]),
)
cant attach any image, since Stackoverflow error. you can check this plyaground.
result:
https://dartpad.dev/?id=c3f0c6f4dcc5d0705d32b7ba10f4a429