Flutter 颤振:设置appbar自定义标题高度
在应用程序栏中,我添加了如下搜索小部件:Flutter 颤振:设置appbar自定义标题高度,flutter,flutter-layout,flutter-appbar,Flutter,Flutter Layout,Flutter Appbar,在应用程序栏中,我添加了如下搜索小部件: return Scaffold( appBar: AppBar( title: Container( margin: EdgeInsets.only(top: 30), decoration: BoxDecoration( color: Color.fromARGB(50, 255, 255, 255), borderRadius: BorderRadius.all(Radius.cir
return Scaffold(
appBar: AppBar(
title: Container(
margin: EdgeInsets.only(top: 30),
decoration: BoxDecoration(
color: Color.fromARGB(50, 255, 255, 255),
borderRadius: BorderRadius.all(Radius.circular(20)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5.0),
child: TextFormField(...
)),
),
),
)
],
),
),
bottom: PreferredSize(
preferredSize: Size.fromHeight(100.0),
child: TabBar(...
返回脚手架(
appBar:appBar(
标题:集装箱(
页边空白:仅限边集(前30页),
装饰:盒子装饰(
颜色:color.fromARGB(50255,255,255),
borderRadius:borderRadius.all(半径圆形(20)),
),
孩子:排(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
扩大(
孩子:填充(
填充:常量边集。对称(水平:5.0),
子项:TextFormField(。。。
)),
),
),
)
],
),
),
底部:首选尺寸(
首选尺寸:尺寸。从高度(100.0),
子项:TabBar(。。。
我从顶部添加了等于30的边距,但搜索部分被裁剪:
如何在appbar中增加默认的
标题
大小?您可以使用flexibleSpace而不是标题
return Scaffold(
appBar: AppBar(
flexibleSpace: Container(....
flexibleSpace
工作正常,但另一种方法是使用PreferredSize
Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(100.0),
child:AppBar(
title:Text("title"),
)
),
body:...
)
使用
PreferredSize
时,您不能使用自定义设置添加标题
height@sayreskabir是的,它只是增加了包装的高度。