如何在颤动中单击(关闭)按钮时关闭抽屉?

Gau*_*mar 2 flutter flutter-layout

如果单击抽屉右上角创建的关闭按钮,是否有关闭抽屉的方法。

模拟抽屉:

抽屉模拟

Tin*_*son 7

只需调用 Navigator.of(context).pop();

例子:

ListTile(
  title: Text('Item 1'),
  onTap: () {
    // Update the state of the app.
    // ...
    // Then close the drawer.
    Navigator.pop(context);
  },
),
Run Code Online (Sandbox Code Playgroud)

参考