如何使用 Column 添加两个图标 sin 尾随 ListTile
How to add two icon sin trailing of ListTile using Column
我正在尝试在 ListTile 的尾部添加两个图标,然后我想要 i 列但无法修复渲染流程错误,请帮助如何执行此操作。
这是代码
Widget buildBook(Book book) =>Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(
Radius.circular(10),
),),
child:ListTile(
trailing:SizedBox(
height: 100,
child: Column( //here i am doing
children: [
IconButton(icon: Icon(Icons.edit,color: HexColor("#7367f0"),),
onPressed: (){
_getVariantRowInfo(book.id, book.author, book.title);
},),
IconButton(icon: Icon(Icons.delete,color: HexColor("#7367f0"),),
onPressed: (){
_getVariantRowInfo(book.id, book.author, book.title);
},),
],
),
),
title: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 15, 0),
child: Text(" Discounted Price: 90",),
),
horizontalTitleGap: 10,
subtitle:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(" "+book.author,style: GoogleFonts.montserrat(fontSize: 15),),
Text(" "+book.title,style: GoogleFonts.montserrat(fontSize: 15),),
SizedBox(height: 10,)
],
),
));
这是快照
试试下面的代码希望对你有帮助
Card(
color: Colors.cyan[50],
child: ListTile(
title: Text('Your Title'),
subtitle: Text('Your Sub Title'),
trailing: Column(
children: [
InkWell(
onTap: () {
//call your onpressed function here
print('Button Pressed');
},
child: Icon(Icons.edit),
),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
//call your onpressed function here
print('Button Pressed');
},
child: Icon(Icons.delete),
),
],
),
),
),
您的结果屏幕->
我正在尝试在 ListTile 的尾部添加两个图标,然后我想要 i 列但无法修复渲染流程错误,请帮助如何执行此操作。
这是代码
Widget buildBook(Book book) =>Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(
Radius.circular(10),
),),
child:ListTile(
trailing:SizedBox(
height: 100,
child: Column( //here i am doing
children: [
IconButton(icon: Icon(Icons.edit,color: HexColor("#7367f0"),),
onPressed: (){
_getVariantRowInfo(book.id, book.author, book.title);
},),
IconButton(icon: Icon(Icons.delete,color: HexColor("#7367f0"),),
onPressed: (){
_getVariantRowInfo(book.id, book.author, book.title);
},),
],
),
),
title: Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 15, 0),
child: Text(" Discounted Price: 90",),
),
horizontalTitleGap: 10,
subtitle:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(" "+book.author,style: GoogleFonts.montserrat(fontSize: 15),),
Text(" "+book.title,style: GoogleFonts.montserrat(fontSize: 15),),
SizedBox(height: 10,)
],
),
));
这是快照
试试下面的代码希望对你有帮助
Card(
color: Colors.cyan[50],
child: ListTile(
title: Text('Your Title'),
subtitle: Text('Your Sub Title'),
trailing: Column(
children: [
InkWell(
onTap: () {
//call your onpressed function here
print('Button Pressed');
},
child: Icon(Icons.edit),
),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
//call your onpressed function here
print('Button Pressed');
},
child: Icon(Icons.delete),
),
],
),
),
),
您的结果屏幕->