flutter - 在 ListTile 中放置两个尾随图标

我想将两个图标并排放置在 ListTile 的“尾随”一侧。我尝试添加一个带有两个图标的 Row 小部件,但它完全弄乱了整个 ListTile 的布局,使其无法使用。有什么办法可以扩大分配给尾部的空间吗?

代码如下:

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: ListView(
      children: <Widget>[
        ListTile(
          leading: Icon(Icons.play_arrow,),
          title: Text("This is a title"),
          subtitle: Text("This is subtitle"),
          trailing: Row(          
            children: <Widget>[
            Icon(Icons.flight),
            Icon(Icons.flight_land)
          ]),
        )
      ]
    ),
      ),
    );
  }
}

看起来是这样的:

最佳答案

mainAxisSize: MainAxisSize.min 添加到 Row() 实例可解决此问题。

https://stackoverflow.com/questions/54548853/

相关文章:

flutter - 如何用 Flutter 设置文字背景?

dart - Flutter 改变 FloatingActionButton 的子图标颜色

android - 在为 x86 构建的 Android SDK 上启动应用程序时出错

dart - 如何在 flutter 中自定义标签栏宽度?

dart - Flutter:我可以将参数传递给按钮上的 onPress 事件中定义的函数吗?

mobile - 有没有其他方法可以改变脚手架抽屉的宽度?

ios - CocoaPods 找不到 pod "Firebase/Core” 的兼容版本 | cl

firebase - 从 Flutter 中的 Firebase 存储获取下载 URL

flutter - 如何在 flutter 中完成当前 View /事件?

flutter - 如何在终端中打印带有 concat 两个字符串的消息?