Want to remove divider between title and children when expanding tile.
Tried two ways but not able to make it transparent, Want divider after the children but not between title and children.
The ways, I have tried
ListView.builder(
itemCount: state.faq?.length,
shrinkWrap: true,
padding: EdgeInsets.all(0),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final faq = state.faq![index];
return Theme(
data: Theme.of(context)
.copyWith(dividerColor: Colors.red),
child: Column(
children: [
ExpansionTile(
shape: Border(),
title: Text(
faq.question!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.black),
),
trailing: state.faq![index].isExpanded
? Assets.coreSvgs.downwardArrow.svg()
: Assets.coreSvgs.forwardArrow.svg(),
onExpansionChanged: (value) {
setState(() {
state.faq![index].isExpanded = value;
});
},
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Text(
faq.answer!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.neutral600),
),
)
],
),
const Divider(
color: CoreColor.neutral200,
height: 0,
)
],
),
);
// 2nd ways
return ExpansionTile(
tilePadding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 16),
shape: Border.all(color: Colors.transparent),
onExpansionChanged: (value) {
setState(() {
state.faq![index].isExpanded = value;
});
},
trailing: state.faq![index].isExpanded
? Assets.coreSvgs.downwardArrow.svg()
: Assets.coreSvgs.forwardArrow.svg(),
title: Text(
faq.question!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.black),
),
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Text(
faq.answer!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.neutral600),
),
)
],
);
},
),
1
Try removing the shape
parameter in your ExpansionTile
s, which according to the docs, controls “The tile’s border shape when the sublist is expanded”, or specifying transparent horizontal borders, similar to what you did here:
ExpansionTile(
tilePadding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 16),
shape: Border.all(color: Colors.transparent),
1