Yad*_*adu 8 gradient appbar flutter
这个问题被张贴在这里,因为这里关于堆栈溢出的相关问题只有解决方法,但没有直截了当的方法。
Yad*_*adu 11
这可以通过休闲代码来实现
AppBar(
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.cyan, Colors.yellow], stops: [0.5, 1.0],
),
),
),
),
Run Code Online (Sandbox Code Playgroud)
在 CodePen 上查看yadunandan ( @iamyadunandan )的 Pen bGVBVpz。
对于具有渐变背景和居中标题的简单应用栏,
AppBar(
automaticallyImplyLeading: false, // hides default back button
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.topRight,
colors: [
Color(0xffB1097C),
Color(0xff0947B1),
]),
)),
title: Text("WishList", style: TextStyle(fontSize: 20.0, color: Colors.white)),
centerTitle: true,
),
Run Code Online (Sandbox Code Playgroud)
对于具有渐变背景和操作图标的更复杂的应用栏
AppBar(
automaticallyImplyLeading: false, // hides default back button
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.topRight,
colors: [
Color(0xffB1097C),
Color(0xff0947B1),
]),
)),
title: Text("Welcome guest", style: TextStyle(fontSize: 20.0, color: Colors.white)),
actions: [
IconButton(
icon: SvgPicture.asset("enter svg path",height: 20.0, width: 20.0),
onPressed: () {
print("Icon 1 pressed");
}),
IconButton(
icon: SvgPicture.asset("enter svg path", height: 20.0, width: 20.0),
onPressed: () {
print("Icon 2 pressed");
},
)
],
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2050 次 |
| 最近记录: |