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

smooth_sheets 封面
套件詳情v1.3.1

smooth_sheets

具有平滑動畫和優異彈性的表單小部件。同時支援以指令式與宣告式兩種方式進行巢狀導航。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5.8萬
喜歡數
658
Pub 分數
160

安裝套件

flutter pub add smooth_sheets

套件介紹

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

Smooth Sheets 是一個 Flutter 套件,提供高度可自訂的底部彈出面板元件,具備平滑動畫與流暢動作。支援指令式與宣告式嵌套導航,非常適合複雜的 UI 流程。透過與 Android、iOS、Web、macOS、Windows 及 Linux 的無縫整合,為開發者提供設計響應式底部面板的彈性。該套件透過優化的過渡效果與直覺的互動,提升使用者體驗,適用於對話方塊、側邊選單與動態內容覆蓋層。

適用情境

  • 動態底部面板
  • 嵌套導航流程
  • 帶動畫的模態對話框
  • 側邊菜單實作
  • 互動式覆蓋層
  • 響應式 UI 組件

主要特色

  • 平滑運動動畫
  • 宣告式與命令式導航
  • 跨平台支援
  • Flexible widget 自訂
  • 嵌套導航處理
  • 無縫過渡效果

適合對象

  • 開發互動式 UI 的開發者
  • 需要複雜底部抽屜邏輯的應用
  • 重視順暢使用者體驗的團隊
  • 跨平台 Flutter 項目
  • 尋求動畫豐富的組件的設計人員

使用建議

  • 需要了解 Flutter 的導航系統
  • 可能會稍微增加封裝大小
  • 最適合頻繁使用底部抽屜的應用程式
  • 深度嵌套結構中的潛在複雜性
  • 在複雜流程中需要仔細的狀態管理

原始 README

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

smooth_sheets

GitHub Repo stars Pub Version Pub Likes Pub Points

smooth_sheets offers modal and persistent sheet widgets for Flutter apps. The key features are:

  • Smooth motion: The sheets respond to user interaction with smooth, graceful motion.
  • Highly flexible: Not restricted to a specific design. Both modal and persistent styles are supported, as well as scrollable and non-scrollable widgets.
  • Supports nested navigation: A sheet is able to have multiple pages and to navigate between the pages with motion animation for transitions.
  • Works with imperative & declarative Navigator API: No special navigation mechanism is required. The traditional ways such as Navigator.push is supported and it works with Navigator 2.0 packages like go_router as well.
  • iOS flavor: The modal sheets in the style of iOS 15 are supported.

Showcases

AI Playlist Generator

An AI assistant that helps create a music playlist based on the user's preferences. See the cookbook for more details.

Key components:

  • PagedSheet
  • ModalSheetPage
  • PagedSheetPage
  • SheetDismissible

Safari app

A practical example of ios-style modal sheets. See the cookbook for more details.

Key components:

  • CupertinoStackedTransition
  • CupertinoModalSheetRoute

Airbnb mobile app clone

A partial clone of the Airbnb mobile app. The user can drag the house list down to reveal the map behind it. See the cookbook for more details.

Key components:

  • Sheet
  • SheetViewport
  • SheetPhysics
  • SheetSnapGrid
  • SheetController
  • SheetOffsetDrivenAnimation

Todo List

A simple Todo app that shows how a sheet handles the on-screen keyboard. See the cookbook for more details.

Used components:

  • Sheet
  • SheetContentScaffold
  • SheetKeyboardDismissBehavior
  • SheetDismissible
  • BottomBarVisibility

Why use this?

There are few packages on pub.dev that supports nested navigation with motion animation for page transitions. One of the great choices for this usecase is wolt_modal_sheet, which this package is inspired by. Although smooth_sheet has similar features with wolt_modal_sheet, it is not intended to be a replacement of that package. Here is some differences between those 2 packages:

wolt_modal_sheet smooth_sheets
Design Based on Wolt's design guideline Not restricted to a specific design, fully customizable
Navigation mechanism Manage the page index in ValueNotifier Works with built-in Navigator API (both of imperative and declarative)
Scrollable content Supported Supported
Persistent sheets Not supported Supported
Screen size adaptation The sheet appears as a dialog on large screens Not supported

Usage

Several resources are available for learning the functionalities of this package.


Ingredients

This section provides descriptions for each core component and links to related resources for further learning.


SheetOffset

SheetOffset represents a position of the sheet within the SheetViewport where the sheet is rendered. It's used in various situations, e.g., specifing the initial position of the sheet or defining a set of positions to which the sheet should snap.


Sheet

The basic sheet widget that can be dragged and scrollled. It can also size itself based on its content or stretched to fill available space.

See also:


PagedSheet
`PagedSheet` manages a stack of pages within a single sheet, enabling navigation between them with transitions. It works seamlessly with Flutter's Navigator API, both imperative (`Navigator.push`) and declarative (go_router, auto_route, etc...). Each page is defined using `PagedSheetPage`, which can have its own specific configuration like `initialOffset`, `snapGrid`, or `scrollConfiguration`. Transitions between pages default to the application's theme but can be customized per-page.

That navigation is built on navigator_resizable. Use that package directly if you want the same paged or dialog navigation without a sheet.

See also:


Modal Sheets

A sheet can be displayed as a modal sheet using ModalSheetRoute for imperative navigation, or ModalSheetPage for declarative navigation.

Furthermore, the modal sheets in the style of iOS 15 are also supported. For imperative navigation, use CupertinoModalSheetRoute, and for declarative navigation, use CupertinoModalSheetPage, respectively.

See also:


SheetPhysics

A physics determines how the sheet will behave when over-dragged or under-dragged, or when the user stops dragging. This is independent of the snapping behavior, which is configured via SheetSnapGrid. There are 2 predefined physics:

See also:


SheetSnapGrid

Determines how the sheet snaps to certain offsets when the user stops dragging or when an animation completes.

There are several predefined snap grid types:

See also:


SheetController

Like ScrollController for scrollable widget, the SheetController can be used to animate or observe the offset (position) of a sheet.

See also:


SheetContentScaffold

Simillar to the Scaffold, it offers the slots for a topBar (like AppBar) and a bottomBar (like BottomNavigationBar).

See also:


SheetOffsetDrivenAnimation

Formerly SheetPositionDrivenAnimation, this allows creating animations driven by the sheet's offset. It's a special kind of Animation whose value changes (typically from 0 to 1) as the sheet's offset moves between specified startOffset and endOffset values (defined using SheetOffset). This is useful for synchronizing UI changes (like fades, slides, or color changes) with the sheet's movement.

See also:


SheetNotification

A sheet dispatches a SheetNotification when its offset changes. This can be used to observe the offset and other metrics (like min/max offset, viewport size) of a descendant sheet from an ancestor widget using a NotificationListener.

NotificationListener<SheetNotification>(
  onNotification: (notification) {
    // Access sheet metrics via notification.metrics (e.g., offset, minOffset, maxOffset)
    debugPrint('Current offset: ${notification.metrics.offset}');
    return false; // Return true to stop the notification from bubbling up
  },
  child: SheetViewport( // Required for non-modal sheets
    child: Sheet(
      // ... sheet configuration
    ),
  ),
),

See also:


SheetKeyboardDismissBehavior

SheetKeyboardDismissBehavior determines when the sheet should dismiss the on-screen keyboard when dragged. This feature is similar to ScrollViewKeyboardDismissBehavior for scrollable widgets. This behavior is configured via the Sheet.keyboardDismissBehavior property.

Although it is easy to create custom behaviors by implementing the SheetKeyboardDismissBehavior interface, there are predefined behaviors available as static constants for convenience:

See also:


Others

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案