我正在制作一个自定义 AppBar,其高度大于典型 AppBar。我也想调整前导小部件/图标的大小,并利用automaticallyImplyLeading
默认行为(因此菜单图标和后退图标会自动实现)。
这是我认为我会实施的解决方案:
class AppAppBar extends PreferredSize{
AppAppBar(String title) : super(
preferredSize: Size.fromHeight(56.0),
child: AppBar(
centerTitle: true,
title: Text(title, style: textStyle)
)) {
(child as AppBar).leading =
SizedBox(width: 30.0, height: 30.0, child: (child as AppBar).leading);
}
static const textStyle = TextStyle(fontSize: 32.0);
}
Run Code Online (Sandbox Code Playgroud)
但这当然行不通,因为(child as AppBar).leading
是最终的。
因此,在下面的 AppBar 中(为了说明的目的,文本大小显着变大),相比之下,我想让自动添加的汉堡图标变大。
你怎么认为?是否有解决方案或我应该放弃自动图标并自己添加它们?
编辑:添加了一张图片来显示我的意思
flutter ×1