Mat*_* S. 76
查看AppBar构造函数,有一个提升属性,可用于设置应用栏的高度,从而设置阴影投射量.将此值设置为零将删除投影:
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('My App Title'),
elevation: 0.0,
),
body: new Center(
child: new Text('Hello World'),
),
);
}
Run Code Online (Sandbox Code Playgroud)
Yas*_*kar 33
我试过一些可能对你有帮助的东西
AppBar(
backgroundColor: Colors.transparent,
bottomOpacity: 0.0,
elevation: 0.0,
),
Run Code Online (Sandbox Code Playgroud)
看一下这个
Thi*_*oAM 16
如果您想在不重复代码的情况下移除所有应用栏的阴影,只需在您的小部件内为您的应用主题 ( )添加一个AppBarTheme属性:elevation: 0ThemeDataMaterialApp
// This code should be located inside your "MyApp" class, or equivalent (in main.dart by default)
return MaterialApp(
// App Theme:
theme: ThemeData(
// ••• ADD THIS: App Bar Theme: •••
appBarTheme: AppBarTheme(
elevation: 0, // This removes the shadow from all App Bars.
)
),
);
Run Code Online (Sandbox Code Playgroud)
似乎最近的 Flutter 版本(3.3/3.7+)引入了一个名为 的新参数scrolledUnderElevation:
AppBar(
backgroundColor: Colors.transparent,
bottomOpacity: 0.0,
elevation: 0.0,
// New parameter:
scrolledUnderElevation: 0,
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13592 次 |
| 最近记录: |