Orientação gerada a partir de informações públicas. Apenas para referência.
Smooth Sheets é um pacote Flutter que oferece widgets de painel inferior altamente personalizáveis com animações suaves e movimento fluido. Ele suporta navegação aninhada imperativa e declarativa, tornando-o ideal para fluxos de UI complexos. Com integração perfeita em Android, iOS, Web, macOS, Windows e Linux, fornece aos desenvolvedores flexibilidade ao projetar painéis inferiores responsivos. O pacote aprimora a experiência do usuário por meio de transições refinadas e interações intuitivas, adequadas para modais, menus laterais e sobreposições de conteúdo dinâmico.
Casos de uso
Painéis inferiores dinâmicos
Fluxos de navegação aninhados
Diálogos modais com animação
Implementações de menu lateral
sobreposições interativas
componentes de interface responsiva
Principais recursos
Animações de movimento suave
Navegação declarativa e imperativa
Suporte multiplataforma
Personalização do widget Flexible
Tratamento de navegação aninhada
Efeitos de transição sem problemas
Indicado para
Desenvolvedores de interfaces interativas
Aplicativos que exigem lógica complexa de sheet inferior
Equipes priorizando UX suave
Projetos Flutter multiplataforma
Designers procurando componentes com animações ricas
Considerações
Requer conhecimento do sistema de navegação do Flutter
Pode aumentar ligeiramente o tamanho do pacote
Mais adequado para aplicativos com uso frequente de sheet inferior
Complexidade potencial em estruturas profundamente aninhadas
Requer gerenciamento de estado cuidadoso em fluxos complexos
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
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: