Smooth Sheets는 부드러운 애니메이션과 유연한 움직임을 갖춘 고도로 사용자 정의 가능한 바텀 시트 위젯을 제공하는 Flutter 패키지입니다. 명령형 및 선언형 중첩 탐색을 모두 지원하여 복잡한 UI 흐름에 이상적입니다. Android, iOS, Web, macOS, Windows, Linux와의 원활한 통합을 통해 개발자가 반응형 바텀 패널을 설계할 때 유연성을 제공합니다. 정교한 전환 효과와 직관적인 상호작용을 통해 사용자 경험을 향상시키며, 모달, 사이드 메뉴, 동적 콘텐츠 오버레이에 적합합니다.
사용 사례
동적 하단 패널
중첩된 탐색 흐름
애니메이션 포함 모달 다이얼로그
사이드 메뉴 구현
인터랙티브 오버레이
반응형 UI 컴포넌트
주요 기능
스무스한 모션 애니메이션
선언적 및 명령형 탐색
크로스 플랫폼 지원
Flexible 위젯 사용자 정의
중첩 탐색 처리
무결점 전환 효과
적합한 대상
인터랙티브 UI를 구축하는 개발자
복잡한 바텀 시트 로직을 필요로 하는 앱
부드러운 UX를 우선시하는 팀
다중 플랫폼 Flutter 프로젝트
애니메이션 풍부한 컴포넌트를 찾는 디자이너
고려 사항
Flutter의 네비게이션 시스템에 대한 이해가 필요합니다
패키지 크기가 약간 증가할 수 있습니다
자주 하단 시트를 사용하는 앱에 가장 적합
심층 중첩 구조에서의 잠재적 복잡성
복잡한 흐름에서는 주의 깊은 상태 관리가 필요합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
smooth_sheets
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:
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.
`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.
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:
SwipeDismissSensitivity, which can be used to tweak the sensitivity of the swipe-to-dismiss action.
showcase/todo_list, which uses SheetDismissible to show a confirmation dialog when the user tries to discard the todo editing sheet without saving the content.
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:
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.
airbnb_mobile_app.dart, which shows how SheetOffsetDrivenAnimation can be used to hide/show UI elements based on the sheet's drag position.
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}');
returnfalse; // Return true to stop the notification from bubbling up
},
child: SheetViewport( // Required for non-modal sheets
child: Sheet(
// ... sheet configuration
),
),
),
SheetUpdateNotification, which is dispatched when the sheet offset is updated by other means (e.g., animation, controller).
SheetOverflowNotification, which is dispatched when the user tries to drag the sheet beyond its draggable bounds but the sheet has not changed its offset because its SheetPhysics does not allow it to be.
NotificationListener, which can be used to listen for the notifications in a subtree.
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: