在我的 android 应用程序中,我使用 flutter ExpansionTileCard 列出了一个项目列表及其子元素。我的问题是 ExpansionTileCard 中的前导和尾随区域占用了太多空间,因此标题区域获得了最小区域来显示内容,我也是在前导上没有任何可显示的内容。另外,我如何更改尾随图标以及最小化尾随空格。我应该如何自定义 ExpansionTileCard 来做到这一点??
注意:我尝试在尾随上应用
SizedBox()
并在transform
上应用title
属性但没有任何效果。
要求:
1.完全删除前导空格。 2.缩短尾部区域并更改尾部图标 3.将剩余区域完全用于标题部分
pubspec.yml:
expansion_tile_card: ^2.0.0
下面是我的代码:
ListView.builder(
itemCount: taskList!.length,
itemBuilder: (context, index) {
return Card(
elevation: 6,
margin: const EdgeInsets.all(2),
child: ExpansionTileCard(
baseColor: index % 2 == 0 ? shade10 : shade20,
leading: SizedBox(),
title: Container(
color: Colors.yellow,
transform: Matrix4.translationValues(-70, 0, 0),
child: Text(taskList![index]['task']['heading'],
maxLines: 1,
),
),
subtitle: Container(
color: Colors.orange,
transform: Matrix4.translationValues(-50, 0, 0),
child: Row(
children: [
Text(dateFormat.format(dateFormat.parse(taskList![index]['task']['date']))),
SizedBox(width: 20,),
Text(dateFormat.format(dateFormat.parse(taskList![index]['task']['user']))),
],
),
),
children: <Widget>[
Divider(
thickness: 1.0,
height: 1.0,
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 4.0,
),
child: Text(taskList![index]['task']['message'],
style: Theme.of(context)
.textTheme
.bodyText2!
.copyWith(fontSize: 16),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ButtonBar(
alignment: MainAxisAlignment.spaceAround,
buttonHeight: 40.0,
buttonMinWidth: 90.0,
children: <Widget>[
ElevatedButton(
onPressed: () {
},
child: Text(''),
),
ElevatedButton(
onPressed: () {
},
child: Text(''),
),
ElevatedButton(
onPressed: () {
},
child: Text(''),
),
ElevatedButton(
onPressed: () {
},
child: Text(''),
),
],
),
),
],
trailing: const SizedBox(),
),
);
},);