我有一個問題,我需要 backButton 和 actionsButtons(左和右)看起來完整。如果沒有空格,標題將被剪切,但沒有其他按鈕。我怎樣才能做到這一點?(我在 appbar 標題中有所有內容,因為我需要一個寬度更大的自定義后退按鈕):
AppBar(
backgroundColor: backgroundColor,
titleSpacing: 0,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_getButtonBackIOS(),
Text(title),
Expanded(
child: Row(
children: actions,
),
),
],
),
actions: [],
automaticallyImplyLeading: false,
leading: null,
)
看起來像:

我要這個:

uj5u.com熱心網友回復:
試試下面的代碼希望它對你有幫助。將你的 Text 小部件包裹在Expanded 的Row 部分中,請參閱
uj5u.com熱心網友回復:
appBar: AppBar(
backgroundColor: Colors.blue,
titleSpacing: 0,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const Icon(Icons.ac_unit),
const SizedBox(
width: 350,
child: Text(
"BlaBladwpuqontwetqret pqrtqpretoreq;e",
overflow: TextOverflow.ellipsis,
)),
Expanded(
child: Row(children: const [
Icon(Icons.ac_unit),
Icon(Icons.ac_unit),
]),
),
],
),
automaticallyImplyLeading: false,
leading: null,
),

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/340054.html
