Dee*_*oor 2 dart flutter flutter-layout bloc
Scaffold(
// extendBodyBehindAppBar: true,
// extendBody: true,
appBar: AppBar(
centerTitle: false,
brightness: Brightness.light,
leading: IconButton(
icon: const Icon(
Icons.arrow_back,
),
onPressed: () {
Navigator.pop(context);
}),
title: const Text(
'Go back',
),
elevation: 0,
backgroundColor: Colors.transparent,
),
.
.
.
bottomNavigationBar: BottomNavigationWidget()
)//Scaffold;
Run Code Online (Sandbox Code Playgroud)
简单地说,我想在底部导航项更改时更改我的应用程序栏。我无法使用 BlocBuilder<> 包装 AppBar,我该如何实现这一点?
您可以使用内部脚手架小部件
appBar: PreferredSize(
child: CustomAppBar(),
preferredSize: Size.fromHeight(56),
),
Run Code Online (Sandbox Code Playgroud)
并创建另一个函数或类作为 CustomAppBar ,它返回 AppBar
return AppBar(
title: Text(
text ?? "Default Text",
),
);
Run Code Online (Sandbox Code Playgroud)
并将文本作为参数传递,如果它为空,您可以为其设置一些默认文本。
| 归档时间: |
|
| 查看次数: |
3288 次 |
| 最近记录: |