0

我正在尝试在 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,)
            ],
           
          ), 
      ));

这是快照

在此处输入图像描述

4

1 回答 1

1

试试下面的代码希望它对你有帮助

   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),
                  ),
                ],
              ),
            ),
          ),

您的结果屏幕-> 在此处输入图像描述

于 2021-10-12T12:00:40.010 回答