搜尋套件、儲存庫與 APP 分類

popup_menu 封面
套件詳情v2.1.0

popup_menu

一個 Flutter 氣泡式選單。使用純 Dart 編寫,支援 iOS 與 Android。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2440
喜歡數
157
Pub 分數
135

安裝套件

flutter pub add popup_menu

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個使用純 Dart 建構的 Flutter 標籤式選單套件,提供在 iOS 與 Android 上一致且可自訂的下拉選單體驗。支援所有主要平台,包含 Web、macOS、Windows 與 Linux,非常適合跨平台應用程式。此選單輕巧且易於整合,提供類原生互動,無需撰寫平台特定程式碼。設計簡潔且彈性十足,讓開發者能快速為其介面加入情境相關選項。

適用情境

  • 應用介面中的上下文操作
  • 快速存取設定或選項
  • 表單欄位增強
  • 部分內的導航
  • 用戶偏好選擇

主要特色

  • 跨平台相容性
  • 純 Dart 實現
  • 可自定外觀
  • 與現有小部件的輕鬆整合
  • 對多個平台的支援

適合對象

  • 開發跨平台應用的開發者
  • 需要一致選單的UI設計師
  • 需要輕量級彈出功能的應用程式
  • 避免原生平台代碼的 Teams
  • 注重簡單性和性能的項目

使用建議

  • 僅限基本菜單操作
  • 除了標準轉換外,沒有內建動畫
  • 可能需要自訂樣式才能實現複雜設計
  • 不適合大型或嵌套的選單結構
  • 依賴外部相依性以實現進階功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pub package

This project was written completely in dart, and it supports both iOS and Android.

Screenshots

Todo

  • [ ] show/hide animation

Usage

You can find the demo at the 'example' folder.

First, you should set the context at somewhere in you code. Like below:

PopupMenu.context = context;
PopupMenu menu = PopupMenu(
      items: [
        MenuItem(title: 'Copy', image: Image.asset('assets/copy.png')), 
        MenuItem(title: 'Home', image: Icon(Icons.home, color: Colors.white,)), 
        MenuItem(title: 'Mail', image: Icon(Icons.mail, color: Colors.white,)), 
        MenuItem(title: 'Power', image: Icon(Icons.power, color: Colors.white,)),
        MenuItem(title: 'Setting', image: Icon(Icons.settings, color: Colors.white,)), 
        MenuItem(title: 'Traffic', image: Icon(Icons.traffic, color: Colors.white,))], 
      onClickMenu: onClickMenu, 
      onShow: onShow,
      onDismiss: onDismiss);

menu.show(rect: rect);


or

PopupMenu menu = PopupMenu(
        backgroundColor: Colors.teal,
        lineColor: Colors.tealAccent,
        maxColumn: 3,
        items: [
          MenuItem(title: 'Copy', image: Image.asset('assets/copy.png')),
          MenuItem(
              title: 'Home',
              textStyle: TextStyle(fontSize: 10.0, color: Colors.tealAccent),
              image: Icon(
                Icons.home,
                color: Colors.white,
              )),
          MenuItem(
              title: 'Mail',
              image: Icon(
                Icons.mail,
                color: Colors.white,
              )),
          MenuItem(
              title: 'Power',
              image: Icon(
                Icons.power,
                color: Colors.white,
              )),
          MenuItem(
              title: 'Setting',
              image: Icon(
                Icons.settings,
                color: Colors.white,
              )),
          MenuItem(
              title: 'PopupMenu',
              image: Icon(
                Icons.menu,
                color: Colors.white,
              ))
        ],
        onClickMenu: onClickMenu,
        onDismiss: onDismiss);
    menu.show(widgetKey: btnKey2);

所屬分類

原始碼儲存庫

使用此套件的專案