可扩展的 AppBar (onPressed)

Expandable AppBar (onPressed)

如何实现这种效果?我想在点击日期后展开我的 AppBar。

最简单的方法是切换一个变量,然后更改 bottom 小部件的高度。

Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        actions: [IconButton(icon: Icon(Icons.place),onPressed: (){
          setState((){
            isOpen = !isOpen;
          });
        })],
        bottom: PreferredSize(child: isOpen? Container(color:Colors.red, height: 100):Container(),preferredSize:Size.fromHeight(isOpen? 100:0) ,)
      ),)