用于移动网页的颤动菜单

问题描述 投票:0回答:1

您好,我最近在Flutter Web上启动了一个项目,在NavBar中实现Mobile Menu视图时遇到问题。Start。单击菜单图标时,这就是我需要的。Onclick

flutter flutter-layout
1个回答
0
投票

您要查找的特定类型的小部件称为抽屉。您可以访问https://flutter.dev/docs/cookbook/design/drawer了解完整详情。让我也给出一个抽屉代码示例。

class Trial extends State<State1> {
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        child: ListView(
          padding: EdgeInsets.zero,
          children: <Widget>[
            DrawerHeader(
              child: Center(
                child: Text(
                  'Choose an Option:',
                  style: TextStyle(
                    fontSize: 30,
                  ),
                ),
              ),
              decoration: BoxDecoration(
                color: Colors.blue,
              ),
            ),
            Padding(
              child: Card(
                child: ListTile(
                  leading: Icon(
                    Icons.add,
                    size: 35,
                  ),
                  title: Text(
                    'Increment by 2',
                    style: TextStyle(
                      fontSize: 20,
                    ),
                    textAlign: TextAlign.center,
                  ),
                  onTap: () {
                    setState(() {
                      increment = 2;
                      Navigator.pop(context);
                    });
                  },
                ),
              ),
              padding: EdgeInsets.all(9.0),
            ),
          ],
        ),
      ),
    );
}

© www.soinside.com 2019 - 2024. All rights reserved.