AppBar 标题带有图像抖动

Hud*_*uda 2 appbar dart flutter

我有附加的 AppBar,我想在标题旁边添加图像,而不是操作图标,仅添加图像,我该如何处理这个问题?

appBar: AppBar(
            title: Text('Title'),
            actions: <Widget>[
              new IconButton(
                icon: new Icon(Icons.refresh),
                onPressed: () {
                  setState(
                    () {
                      widget.athkarCategory.reset();
                    },
                  );
                },
              ),
            ],
          ),
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Ste*_*tta 6

title的属性接受AppBara Widget,这意味着它们的任意组合。

例如,如果您想要标题旁边有一个图像,您可以简单地将其包装在一个Row小部件中,然后将Image下一个添加到Text将包含您的标题的图像中。

这是您想要完成的代码示例:https://dartpad.dev/b6409e10de32b280b8938aa75364fa7b

相关代码部分是这样的:

      appBar: AppBar(
        title: Row(
          children: <Widget>[
            Text(widget.title),
            Image.network("https://i.ytimg.com/vi/Uk1RPEQI8mI/maxresdefault.jpg", width: 50, height:50)
          ],
        ),
      ),
Run Code Online (Sandbox Code Playgroud)