我有一个问题,我需要 backButton 和 actionsButtons(左和右)看起来完整。如果没有空格,标题将被剪切,但不会剪切其他按钮。我怎样才能做到这一点? (我在应用栏标题中有所有内容,因为我需要一个宽度更大的自定义后退按钮):
AppBar(
backgroundColor: backgroundColor,
titleSpacing: 0,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_getButtonBackIOS(),
Text(title),
Expanded(
child: Row(
children: actions,
),
),
],
),
actions: [],
automaticallyImplyLeading: false,
leading: null,
)
看起来像:
我想要这个:
最佳答案
尝试下面的代码希望对您有所帮助。将您的文本小部件包装在 Expanded 中的 Row 部分内,引用 here或灵活引用here
AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text('Atras'),
),
Expanded(
child: Text('Filtros offertos'),
),
Expanded(
child: Text('title'),
),
Expanded(
child: Text('titleasdas'),
),
Expanded(
child: Text('title'),
),
Expanded(
child: Text('titlesfsfsdf'),
),
],
),
),
关于flutter - 将宽度设置为行的特定子项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69752451/