i want when i click on one expansion tile the other to close
StatefulBuilder(
builder: (BuildContext context, StateSetter setInternalState,){
return ListView( children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(height: 2,color: Colors.grey,),
),
ExpansionTile(
initiallyExpanded: true,
maintainState: false,
shape: Border(),
title: Text('Описание на продукта',
style: TextStyle(fontWeight: FontWeight.w500),
),
children:[
htmlView
] ),
ExpansionTile(
shape: Border(),
title: Text('Описание на продукта 2',
style: TextStyle(fontWeight: FontWeight.w500),
),
children:[
Text('12'),
Text('12'),
Text('12'),
Text('12'),
] ),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(height: 2,color: Colors.grey,),
),
]
);
}
)
i tried using a gesture detector with on tap
2
Answers
You can use two
ExpansionTileController
for your case.and you can call Y controller on X expand.
Second panel
You can manage the expansion state of
ExpansionTile
using theExpansionTileController
.ExpansionTileController
.ExpansionTileController
to each correspondingExpansionTile
.onExpansionChanged
callback.For example: