如何修复 Flutter DrawerHeader?

cds*_*enz 2 dart flutter

我正在尝试创建一个 Drawer,但不知何故我找不到任何方法来使其 DrawerHeader 保持固定(而下面的项目继续滚动)。尝试了扩展、Flex 等,但不知何故我错过了一些东西。这是工作代码,但标题将与下面列表视图中的项目一起向上滚动

Widget _drawerList(BuildContext context) {

  return Drawer(
      elevation: 20.0,
      child: ListView(
        children: <Widget>[
          Container(
            height: 120.0,
            child: DrawerHeader(
              decoration: BoxDecoration(color: Colors.orange),
              child: Text('HEADER'),
            ),
          ),
          Column(
            children: <Widget>[
              ListTile(
                title: Text("ITEM 1"),
              ),
              ListTile(
                title: Text("ITEM 2"),
              ),
              ListTile(
                title: Text("ITEM 3"),
              ),
              ListTile(
                title: Text("ITEM 4"),
              ),
              ListTile(
                title: Text("ITEM 5"),
              ),
              ListTile(
                title: Text("ITEM 6"),
              ),
              ListTile(
                title: Text("ITEM 7"),
              ),
              ListTile(
                title: Text("ITEM 8"),
              ),
              ListTile(
                title: Text("ITEM 9"),
              ),
              ListTile(
                title: Text("ITEM 10"),
              ),
              ListTile(
                title: Text("ITEM 11"),
              ),
              ListTile(
                title: Text("ITEM LAST"),
              ),
            ],
          )
         ],
      ),
  );
}
Run Code Online (Sandbox Code Playgroud)

Cop*_*oad 5

在此处输入图片说明

Widget _drawerList(BuildContext context) {
  return Drawer(
    elevation: 20.0,
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: <Widget>[
        SizedBox(
          height: 120,
          child: DrawerHeader(
            decoration: BoxDecoration(color: Colors.orange),
            child: Text('HEADER'),
          ),
        ),
        Expanded(
          child: ListView(...),
        )
      ],
    ),
  );
}
Run Code Online (Sandbox Code Playgroud)