我想在扩展图块时删除灰色分隔符,使用主题分隔线颜色,但分隔线采用外部颜色而不是图块和扩展之间的线。
我曾经使用两种不同的方法来删除它,但都不起作用
return Theme(
data: Theme.of(context)
.copyWith(dividerColor: Colors.yellow,),
child: Column(
children: [
ExpansionTile(
shape: Border.all(color: Colors.yellow),
// shape: Border(),
backgroundColor: CoreColor.neutral0,
collapsedBackgroundColor: CoreColor.neutral0,
tilePadding: const EdgeInsets.only(
left: 16, right: 16, bottom: 8),
title: Text(
faq.question!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.neutral900),
),
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.only(
left: 16, right: 16, bottom: 8),
child: Text(
faq.answer!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.neutral600),
),
),
],
),
const Divider(
color: CoreColor.dangerMain,
height: 0,
),
],
),
);
return ExpansionTile(
backgroundColor: CoreColor.neutral0,
collapsedBackgroundColor: CoreColor.neutral0,
tilePadding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 16,
),
shape: Border.all(color: Colors.red),
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.neutral900),
),
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
child: Text(
faq.answer!,
style: CoreTextStyle.mRegular
.copyWith(color: CoreColor.neutral600),
),
),
],
);
[截图](https://i.sstatic.net/9QL1vSMK.png)
我想删除瓷砖和扩展之间的灰色分隔线
从代码中删除一些分隔符,如下所示:
Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent,
),
child: Column(
children: [
ExpansionTile(
tilePadding:
const EdgeInsets.only(left: 16, right: 16, bottom: 8),
title: Text(
'faq.question!',
),
onExpansionChanged: (value) {},
children: [
Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: Text(
' faq.answer!',
),
),
],
),
ExpansionTile(
tilePadding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 16,
),
onExpansionChanged: (value) {},
title: Text(
' faq.question!',
),
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
child: Text(
'faq.answer!',
),
),
],
),
],
),
),