搜索插件、代码仓与 APP 分类

插件详情v1.0.0-beta

navigation_drawer_menu

Flutter Material Design 导航抽屉菜单。此包为您提供 NavigationDrawerMenu 小部件,其行为类似于 ListView。示例实现了完整的导航抽屉。

近 30 天下载
27
喜欢数
27
Pub 分数
60

安装插件

flutter pub add navigation_drawer_menu

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,提供符合 Material Design 规范的 NavigationDrawerMenu 小部件,其功能类似于导航抽屉中的 ListView。它简化了完整导航抽屉的实现,内置样式和布局逻辑,遵循 Material Design 原则。该包包含一个完整的示例,演示典型用例,使开发者能够轻松地将直观的导航集成到应用中。专为跨平台的简单性和一致性而设计。

适合场景

  • 在移动应用中实现侧边导航
  • 使用可折叠菜单创建响应式布局
  • 使用分层导航构建管理仪表板
  • 在各个屏幕之间添加一致的导航模式

主要特点

  • 符合 Material Design 的用户界面
  • 抽屉内的 ListView 类行为
  • 内置示例,便于快速集成
  • 菜单项配置的简单 API
  • 支持动态内容渲染

适合对象

  • Flutter 初学者学习导航模式
  • 寻求快速抽屉实现的开发者
  • 需要标准 Material Design 导航的应用程序
  • 需要轻量级导航解决方案的项目

使用建议

  • 超出基础样式的有限自定义
  • 不支持嵌套导航的内置支持
  • 可能需要额外的逻辑来处理复杂的路由
  • 未针对大型菜单项列表进行优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

navigation_drawer_menu

Flutter Material Design Navigation Drawer Menu

Navigation drawer is a common UI pattern for adaptive menus. The Material Design documentation formalizes the behavior of the menu but this pattern is not peculiar to Material Design. The pattern includes a basic Hamburger menu but isn't limited to small screens. The menu pattern suits all screen sizes. On larger width screens you see the icon and text, smaller screens will display icons only, and on phones, the menu will disappear during normal use and slide in with the hamburger icon.

Hamburger Menu

Beta

This widget is in beta and the public interface is likely to change

Example

The example aims to implement the Navigation Drawer pattern documented above. This is a work in progress and conformance to the behavior in the Material Design documentation is the long term aim. Pull requests to fix behavior are welcome. The example works on all form factors: desktop and tablet (landscape, portrait), phone, and web. Try resizing the width of the window to see how the behavior changes. Most of the behavior exists in the example. the aim is to create a new widget which will replace Scaffold and allow you to spin up new apps with this functionality very quickly.

Note: if you're just looking for a simple drawer menu that doesn't adapt to the screen, check out this.

Hamburger Menu

Hamburger Menu

Hamburger Menu

Run the Example
  • Open the root folder in Visual Studio Code
  • Open a terminal window
  • Add platforms by running these commands in the root folder (not example folder)
  • Click Run -> Start Debugging
flutter create example --platforms=windows,macos,linux

flutter create --platforms=web

flutter create --platforms=android

NavigationDrawerMenu

This is a widget that basically functions like a ListView. However, it exists to remove some of the boilerplate code necessary for constructing the menu, and allows you to put arbitrary sized spacers and headings inside the menu. The example uses this set of definitions. If you don't want to use this widget, you can use ListView instead.

final Map<Key, MenuItemContent> menuItems = {
  alarmValueKey: MenuItemContent(
      menuItem: MenuItemDefinition("Alarm", alarmValueKey,
          iconData: Icons.access_alarm)),
  todoValueKey: MenuItemContent(
      menuItem: MenuItemDefinition("Todo", todoValueKey,
          iconData: Icons.ad_units_rounded)),
  photoValueKey: MenuItemContent(
      menuItem: MenuItemDefinition("Photo", photoValueKey,
          iconData: Icons.add_a_photo_outlined))
};

所属分类

依赖

依赖清单 1 项

  • material^1.0.0+2

源码仓库

使用此插件的项目

暂无相关数据。