这是我的 AppBar Tittle 代码,但它不起作用
Widget build(BuildContext context){
return new Scaffold(
appBar: new AppBar(
title: new Padding(
padding: const EdgeInsets.only(left: 20.0),
child: new Text("App Name"),
),
),
);}
Run Code Online (Sandbox Code Playgroud)
Transform 是用于在 xyz 维度中强制转换小部件的小部件。
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0.0,
title: Transform(
// you can forcefully translate values left side using Transform
transform: Matrix4.translationValues(-20.0, 0.0, 0.0),
child: Text(
"HOLIDAYS",
style: TextStyle(
color: dateBackgroundColor,
),
),
),
),
);
Run Code Online (Sandbox Code Playgroud)
小智 8
默认情况下,AppBar 标题位于中心位置。要使文本位于左侧,您应该将属性 centerTitle 设置为 false,如下所示:
Widget build(BuildContext context){
return new Scaffold(
appBar: new AppBar(
centerTitle: false
title: new Padding(
padding: const EdgeInsets.only(left: 20.0),
child: new Text("App Name"),
),
),
);
}
Run Code Online (Sandbox Code Playgroud)
只需将centerTile属性设置为false在 AppBar 小部件中。
AppBar(
...
centerTitle: false,
title: Text("App Name"),
...
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7977 次 |
| 最近记录: |