Flutter如何在导航抽屉中添加可扩展菜单项? [英] Flutter how to add a Expandable menu item inside navigation drawer?

查看:116
本文介绍了Flutter如何在导航抽屉中添加可扩展菜单项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向抽屉项目添加可扩展菜单。我如何才能在颤振中实现此功能。如果有任何示例或博客,请直接指出正确的方向。

I want to add expandable menu to drawer items of flutter. How can I achieve this functionality in flutter. Please just point me in the correct direction if there is any example or blog.

推荐答案

您必须将抽屉子属性传递给ListView,然后在该ListView中使用ExpansionTile。看起来像这样:

You have to pass the drawers child property a ListView, and in that ListView you can then use an ExpansionTile. That would look something like this:

Drawer(
  child: ListView(
    children: <Widget>[
      ExpansionTile(
        title: Text("Expansion Title"),
        children: <Widget>[Text("children 1"), Text("children 2")],
      )
    ],
  ),
);

这篇关于Flutter如何在导航抽屉中添加可扩展菜单项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆