Flutter 设置AppBar为透明
作者:
lczalh | 来源:发表于
2020-09-18 17:25 被阅读0次

C39A7397-C6B5-453E-A87C-2554C5DBE330.png
- 将Scaffold设置extendBodyBehindAppBar为true,
- 将AppBar设置elevation为0以消除阴影,
- backgroundColor根据需要设置AppBar的透明度。
@override
Widget build(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
backgroundColor: Colors.red,
appBar: AppBar(
// backgroundColor: Colors.transparent,
backgroundColor: Color(0x44000000),
elevation: 0,
title: Text("Title"),
),
body: Center(child: Text("Content")),
);
}
本文标题:Flutter 设置AppBar为透明
本文链接:https://www.haomeiwen.com/subject/hxijyktx.html
网友评论