dart - 有没有办法将高度设置为抽屉页眉?

我正在寻找一种将高度设置为抽屉 header 的方法。 我有这个抽屉:

DrawerHeader(
  child: Text('Categories', style: TextStyle(color: Colors.white)),
    decoration: BoxDecoration(
      color: Colors.black
    ),
    margin: EdgeInsets.all(0.0),
  )
)

,但我看不到将高度设置为抽屉的方法,这太大了。

最佳答案

你用 SizedBox 小部件包装它。

const SizedBox(
   height: 64.0,
   child: DrawerHeader(
       child: Text('Categories', style: TextStyle(color: Colors.white)),
       decoration: BoxDecoration(color: Colors.black),
       margin: EdgeInsets.all(0.0),
       padding: EdgeInsets.all(0.0),
    ),
);

https://stackoverflow.com/questions/51768740/

相关文章:

dart - 在 Dart 中将字符串转换为 map

visual-studio-code - 用于 flutter 的 VSCode 热重载

Flutter - 隐藏 FloatingActionButton

dart - 如何根据另一个值验证表单字段?

android - Flutter 的 Multidex 问题

dart - 如何在 Flutter 中设置 AlertDialog Actions 的样式

ios - 文本字段在 iOS 模拟器上不显示键盘

flutter - 如何从 flutter 中获取 .apk 和 .ipa 文件?

dart - 在 Flutter 中向父 Widget 发送数据

dart - 如何在我的 Flutter 应用程序中从 JWT 获取声明