【发布时间】:2021-08-19 09:05:09
【问题描述】:
所以我在我的颤振应用程序中构建了一个抽屉(我第一次使用它),然后有些事情困扰着我。因此,当您将图像放入抽屉标题时,图像本身不会到达屏幕顶部。
图片:
这是我的抽屉代码:
drawer: Drawer(
child: ListView(
children: <Widget>[
DrawerHeader(
padding: EdgeInsets.zero,
decoration: BoxDecoration(
color: Colors.blue,
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/images/fighters.jpg")),
),
child: Center(
child: Text(
"Menu",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
)
],
),
),
我没有为代码添加任何填充
请帮我解决这个问题,感谢任何帮助,谢谢!
【问题讨论】:
-
尝试使用 BoxFit.fill 或 fitHeight。此外,将drawerheader 放在listview 中也是不明智的。而是使用 column 然后 listview。
标签: android ios flutter dart flutter-layout