如何制作一个包含网格项目的下拉菜单



我正在制作一个类别应用程序,其中会有很多下拉列表,点击后应该会在网格视图中显示子类别列表。这里是我想要实现的目标的示例图像。

https://cdn.dribbble.com/users/1502567/screenshots/7147539/media/dbca2b397050acac918164ddfc5820cd.jpg

这个例子看起来不像是一个下拉列表,更像是一个项目网格的容器?我会使用Table来包含所有这些项目。Flutter.dev有关于如何使用它的非常好的文档:https://api.flutter.dev/flutter/widgets/Table-class.html

bool pressed;
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: <Widget>[    
RaisedButton(
child: Text("button"),
onPressed: () {
setState(() {
pressed = true;
});
},
)
// show table if pressed is true, otherwise show an empty widget
pressed ? Table() : SizedBox(), 
],
),
);
}

相关内容

最新更新