패키지, 저장소 및 앱 카테고리 검색

flutter_menu 표지
패키지 상세v0.4.1

flutter_menu

웹 및 데스크톱용 반응형 UI 프레임워크 - 상단 메뉴, 반응형 마스터/세부 정보 패널 및 키보드 단축키가 있는 컨텍스트 메뉴.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
69
좋아요
123
Pub 점수
140

패키지 설치

flutter pub add flutter_menu

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter Menu는 웹 및 데스크톱 애플리케이션을 위한 반응형 UI 프레임워크로, 최상위 메뉴, 적응형 마스터/디테일 레이아웃, 키보드 단축키를 지원하는 컨텍스트 메뉴를 제공합니다. 크로스플랫폼 호환성을 고려하여 개발되어 Android, iOS, Web, macOS, Windows, Linux에서 사용자 상호작용을 향상시킵니다. 다양한 화면 크기와 입력 방식에 자연스럽게 대응하는 직관적이고 사용자 정의 가능한 컴포넌트를 통해 복잡한 탐색 패턴을 간소화합니다. 구조적이고 접근성 있는 인터페이스가 필요한 생산성 앱과 대시보드에 이상적입니다.

사용 사례

  • 웹 및 데스크톱 대시보드
  • 반응형 마스터/세부 보기
  • 키보드 기반 탐색
  • 단축키가 있는 컨텍스트 메뉴
  • 다중 플랫폼 UI 일관성
  • 복잡한 탐색 패턴

주요 기능

  • 드롭다운이 있는 상단 메뉴
  • 반응형 마스터/세부 정보 패널
  • 키보드 지원이 있는 컨텍스트 메뉴
  • 크로스 플랫폼 호환성
  • 사용자 정의 가능한 UI 테마
  • 적응형 레이아웃 동작

적합한 대상

  • 데스크톱 애플리케이션 개발자
  • 웹 기반 관리 패널
  • 생산성 소프트웨어
  • UI 중심 애플리케이션
  • 다양한 플랫폼을 대상으로 하는 개발자
  • 일관된 탐색이 필요한 팀

고려 사항

  • 신중한 상태 관리가 필요합니다
  • 맞춤형 디자인을 위해 추가 스타일링이 필요할 수 있습니다
  • 더 큰 애플리케이션에 가장 적합
  • 제한된 모바일 전용 최적화
  • 플랫폼 고유의 입력 처리에 의존합니다
  • 간단한 단일 화면 앱에는 적합하지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_menu

This is a responsive UI framework developed for Web and Desktop.

Try it out: http://www.flutter.psychtech.mitspace.dk/

The package gives you a desktop like experience on web (responsive to touch and desktop displays). It gives you the following:

Example

  • [x] Menu with list items (with icon, title and keyboard shortcuts)

  • [x] Keyboard shortcuts for menu items

  • [x] Master, detail views (Left pane, right pane)

  • [x] Pane sizes can be changed by user (or not - you choose).

  • [x] Context menu (right click) for Master, Detail and widgets

  • [x] Longpress for contextmenu (for touch displays). Centered and animated

  • [x] Choose between touch UI or desktop UI (can be change by user)

  • [x] Drawer (small or large)

  • [x] Pane sizes is set by a flex factor for the UI to stay nice and responsive.

  • [ ] different menu in compact mode (to be responsive)

  • [ ] More predefined contextmenus to choose from

  • [ ] Scrollbar

  • [ ] More callbacks on change

  • [ ] Extra topbar to be used as toolbar or information bar

  • [ ] Fullscreen dialogs

All siblings down the widget tree has access to the AppScreen functionality.

This is a beta release and breaking changes will come soon!

Get support, announcements and share knowledge: https://discord.gg/pmXCFZUxxC

How to install

On web:

The Flutter App has to have control over the right click (contextmenu). To take control you have to include the following in your index.html file in the web folder:

<body oncontextmenu="return false;"></body>
On desktop:

Nothing has to be changed.

How to use

You can access all variables and functions through the buildContext, and for your convenience we have made an extention for easy access:

context.appScreen

the AppScreen has to be in a parent BuildContext (and not the current context). This is why panes has to be a Builder function and not just a Widget. To prevent you from making misconceptional errors.

Menus

The menu can have several menuItems and each menuItem has its own menuListItems.

Each menuItem decides width and height of the menuItemList widget and can be set as active or not.

MenuListItem can be a MenuListDivider() or a MenuListItem.

MenuListItems can have icons, shortcuts and have a callback function: onPressed().

See example.

Programmably you can control:

context.appScreen.hideMenu(); // hides the menu from the screen. Keyboard shortcuts is still active
context.appScreen.showMenu(); // shows the menu on the screen
context.appScreen.openMenu(); // opens the active menuitem
context.appScreen.closeMenu(); // close a open menuitem (if any)

You have access to current variables:

context.appScreen.isMenuShown(); // returns true if menu is shown on Screen
context.appScreen.isMenuOpen();  // returns true if a MenuItem is shown on Screen

Keyboard shortcuts

It is possible to activate functions with keyboard shortcuts which is good for productibility.

Each MenListItem() can be supplied with a MenuShortcut().

MenuShortcut.key is of type LogicalKeyboardKey and is defined in flutter/services.dart. This should be a normal physical key.

You can then choose which system keys has to be hold down as well: ctrl, alt, shift. Please notice that shift should only be used in combination with other system keys and notice that the browser takes presidence over the app for keyboard shortcuts - so choose with care.

Keyboard Shortcut Overlay

Overlay feature is disabled by default, but can be enabled programmably (se How-to-use section). This can be helpfull under development and as a feature making example videos.

context.appScreen.showShortcutOverlay();  // 2 sec. text overlay will be shown
context.appScreen.hideShortcutOverlay();  // No overlay will be shown

Master/ detail panes

You always have to set the Master pane. If no detail pane is supplied only Master is shown. If you set both Master and detail panes default behavior will be give the user control of a moveable vertical line in the UI to change the size of the detail pane.

In AppScreen() you can set:

  final double masterPaneFlex;      // default=1
  final double detailPaneFlex;      // default=1
  final double masterPaneMinWidth;  // default= 500
  final double detailPaneMinWidth;  // default = 500

The flex sizing is just as in the Expanded() widget. You set the relative size, as for the UI to stay responsive when window size changes. The UI updates with respect for the minimum sizes, and if the detailPane can not stay on screen, only master will be shown.

The user can change the sizes of the master and detail panes, if this is possible within the minium size boundaries.

The Master/detail panes are responsive, and you can set the breakpoint:

desktopBreakpoint (=800) if screen width is under breakpoint value the compact view is shown onBreakPointChange A callback function to update your UI on change (it is automatically delayed to next tick to prevent call under UI build).

You have access to current variables:

context.appScreen.isDesktop() - returns true if Desktop and false if compact context.appScreen.detailIsShown() - returns true if detail is shown

You can get the screen and pane sizes and topleft and bottomright corner position:

context.appScreen.screenDetails
context.masterPaneDetails
context.master
class Detail {
  double height;
  double width;
  double minDx;
  double minDy;
  double maxDx;
  double maxDy;
}

In compact mode you can change master/detail view:

context.appScreen.showOnlyMaster(); //  change UI to show masterPane()
context.appScreen.showOnlyDetail(); // change UI to show detailPane() 

Drawer

The AppScreen has its own drawer, just as the Scaffold() has.

You can choose set only one size of drawer or you can have to different sizes for the user to choose.

class AppDrawer {
  final double smallDrawerWidth;
  final Widget smallDrawer;
  final double largeDrawerWidth;
  final Widget largeDrawer;
  final bool showOnDesktop;
  final bool defaultSmall;
  final bool autoSizing;            // autoSizing is not yet implemented.
  final double edgeDragOpenWidth;
}

default small if true Drawer opens with the small drawer on start.

showOnDesktop if true Drawer will be shown automaticly on Desktop is AppScreen is big enough.

edgeDragOpenWith is for touch users to slide the drawer open. It indicates the zone where dragging is registred. On mobile devices it is set to 20 in the Drawer() of Scaffold(). But in browsers run on mobile devices there can be a sliding function the change webpage. The zone has been made bigger to adjust for this. You might change it according to your needs. If set to 0 drag to Open Drawer will be disabled.

Context menu (right click or longpress)

You can set different context menus for Master & Detail pane, and each individual Widget can have its own context menu.

If contextmenu is activated by a longpress it will be centered and animated. If it is right clicked it will be top left position and no animation.

AppScreen(
  masterContextMenu: ContextMenu(
    width: 150,
    height: 250,
    child: ContextMenuSliver(
      title: 'Master',
      children: [
        masterContextMenuItem(color: 'Red'),
        masterContextMenuItem(color: 'Blue'),
        masterContextMenuItem(color: 'Purple'),
        masterContextMenuItem(color: 'Pink'),
      ],
    ),
  ),
)

This gives us a ContextMenu as shown in the masterPane (it stays within boundaries of the Master Pane).

You just wrap a widget in a ContextMenu() widget and specify the widget. You can use the prebuild ContextMenuSliver() or build your own.

The only requirement is that the ContextMenu() is a sibling to AppScreen().

ContextMenuContainer(
    menu: ContextMenuSliver(title: 'Widget'),
    menuWidth: 200,
    menuHeight: 200,
    child: SizedBox(height: 200, width: 200),
)

This will give you a small empty ContextMenu. You can use ContextMenuSliverItem to build your menu.

Please take a look at the example app for more examples.

More prebuild ContextMenus will come. Feel free to build your own and contribute to the project.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.