我試圖從 中洗掉默認邊距persistentFooterButtons,但我找不到它,因為它收到了一個小部件串列。
我正在使用extendBody: true中Scaffold。
持久的FooterButtons邊距

persistentFooterButtons: [
Container(
color: const Color.fromRGBO(240, 240, 240, 0.9),
width: double.infinity,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 2),
child: Row(
children: [
Expanded(
child: GestureDetector(
child: Column(
children: [
const Image(
image: AssetImage('assets/images/home.png'),
height: 35,
),
Text(
"Início",
style: TextStyle(
fontSize: 10,
color: Theme.of(context).primaryColor,
),
),
],
),
),
),
],
),
),
)
],
uj5u.com熱心網友回復:
這是來自scaffold.dart. 它是這樣定義的。
child: Container(
alignment: AlignmentDirectional.centerEnd,
padding: const EdgeInsets.all(8), //<-- this
child: OverflowBar(
spacing: 8,
overflowAlignment: OverflowBarAlignment.end,
children: widget.persistentFooterButtons!,
),
),

可以應用另一個技巧,transform但在這種情況下可以實作點擊效果。
Container(
transform: Matrix4.translationValues(0, 8, 0),
.....
或者我會說只使用bottomNavigationBar上Scaffold,而不是persistentFooterButtons
bottomNavigationBar: Container(
color: const Color.fromRGBO(240, 240, 240, 0.9),
width: double.infinity,
height:50, // the one prefered by your view
........
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/359629.html
