我正在尝试将flutter_tagging实现在AppBar
中。我使用下面的代码成功地将标记的TextField
添加到了AppBar
中,并使用PreferredSize
小部件来调整AppBar
的大小:
return PreferredSize(
preferredSize: Size.fromHeight(110),
child: AppBar(
backgroundColor: HexColor('171551'),
leading: const BackButton(),
flexibleSpace: Padding(
padding: const EdgeInsets.only(top: 48.0, left: 10, right: 10),
child: buildTaggedSearch(),
),
title: Container(),
actions: _buildActions(),
),
);
这是结果:
我无法解决的问题是,当用户输入太多标签并且标签移到第二行时会发生什么,如下图所示:
我对Flutter还不是很熟悉,也许我错过了什么,但我应该如何解决此问题并使AppBar
根据标签内容调整大小。我查看了大部分在这里谈论AppBar调整大小的问题,它们都使用我在这里使用的PreferredSize
小部件。那么,是否还有其他选项?