Orientação gerada a partir de informações públicas. Apenas para referência.
Uma biblioteca Flutter que oferece widgets personalizáveis de seleção de data e intervalo com base no Material Design. Suporta todas as principais plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux. O pacote melhora a experiência do usuário com interfaces intuitivas e visualmente consistentes para seleção de datas, alinhadas aos princípios do Material Design. Os desenvolvedores podem facilmente adaptar aparência e comportamento dos seletores para corresponder às temáticas e requisitos do aplicativo. Projetado para flexibilidade e integração fácil, simplifica o manuseio de entradas de data em aplicações Flutter.
Casos de uso
Entrada de data do formulário
Aplicativos de reserva ou agendamento
Ferramentas de planejamento de eventos
Configuração do perfil do usuário
Filtragem de dados por data
Seleção de evento de múltiplos dias
Principais recursos
UI personalizável
Compatibilidade com o Material Design
Suporte para seletor de data em intervalo
Compatibilidade multiplataforma
Integração fácil com formulários
Estilo sensível ao tema
Indicado para
Desenvolvedores de aplicativos com formulários intensos
Aplicativos que exigem seleção de data
Equipes usando o Material Design
Projetos Flutter multiplataforma
soluções de entrada de data centradas na interface do usuário
Considerações
Requer configuração manual do tema para designs não-Material
Personalização limitada além das especificações do Material
Nenhuma validação embutida
Pode ser necessário configurar localização adicional
Não otimizado para lógica de calendário complexa
Depende do pacote Material do Flutter
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Date Picker Plus
A Flutter package with highly customizable Material date and range pickers.
Features
Material 3 friendly out of the box.
Rich theming via one top-level theme object.
Inline widgets and dialog helpers.
Powerful cellBuilder for custom content inside cells.
Use this for a full single-date picker with days, months, and years flow.
RangeDatePicker
Use this when users must select a start and end date. It supports:
onRangeSelected for the final result.
onStartDateChanged and onEndDateChanged for step-by-step tracking.
DaysPicker
Use this if you want day-only selection UI.
MonthPicker
Use this for month-only selection.
YearsPicker
Use this for year-only selection.
showDatePickerDialog and showRangePickerDialog
Use these when you want ready-made dialogs returning:
Future<DateTime?>
Future<DateTimeRange?>
Sizing and Layout
Always give inline pickers a size
In unconstrained layouts (for example inside some Column, Row, or scrollable situations), pickers fall back to internal limits through a LimitedBox (portrait around 328x402, landscape around 328x300). If you need exact behavior, wrap the picker with SizedBox.
If you want to control interaction feel (splash/highlight/focus/hover/radius/border behavior), set inkResponseTheme in the specific picker theme (daysPickerTheme, monthsPickerTheme, yearsPickerTheme, rangePickerTheme). This is useful when your cell shapes are custom and default ripple clipping does not match.
headerPadding controls distance around header content.
arrowButtonsSpace controls spacing between arrow buttons.
forwardButtonWidth / forwardButtonHeight and backward equivalents control button size.
Weekday Row Behavior
Change first day of week
By default, the first day comes from locale (for example many en_GB setups start with Monday while many en_US setups start with Sunday). Override it using startOfWeek (ISO 8601 weekday number: 1 Monday ... 7 Sunday):
cellsPadding is per-cell inner spacing around the decorated cell content.
padding on each picker theme is spacing around the entire grid view.
Defaults worth knowing:
DaysPickerTheme.cellsPadding defaults to EdgeInsets.zero.
MonthsPickerTheme.cellsPadding and YearsPickerTheme.cellsPadding default to EdgeInsets.symmetric(horizontal: 8, vertical: 12).
Non-square cells are supported
Grid cell width and height are not forced to match. If your custom UI needs taller cells (events under the date number, badges, extra lines), this is supported naturally. If you increase vertical cell content heavily, review the range section below for edge-shape behavior.
Custom Cell Builder
cellBuilder gives you precise control over cell UI while preserving picker logic.
What cellBuilder receives
You get a CellData subtype:
WeekDayCell with weekDay (1..7, ISO 8601 weekday number)
DayCell with day (DateTime)
MonthCell with month and year
YearCell with year
data.child is the default decorated content for that cell. You can return it unchanged, wrap it, or fully replace it.
data.state can be:
disabled
enabled
selected
selectedEdge
current
currentAndDisabled
Precedence detail:
If a cell is both current and selected, it is reported as selected.
currentAndDisabled is used when current date exists but is not selectable.
Start/end (or single selected edge): selectedEdgeCellDecoration, selectedEdgeCellTextStyle
Middle range cells: selectedCellsDecoration, selectedCellsTextStyle
Decoration color extraction limitation
When drawing range background behind edge cells, the package tries to extract color from the resolved in-range decoration. It currently extracts only from ShapeDecoration and BoxDecoration:
if (resolvedDecoration caseShapeDecoration(color: final color) || BoxDecoration(color: final color)) {
decorationColor = color;
}
If you use any other Decoration implementation, color cannot be extracted automatically. In that case, provide your own resolvePainter.
Reuse the default painter with your own color
theme: DatePickerPlusTheme(
rangePickerTheme: RangePickerTheme(
selectedCellsDecoration: constMyFancyDecoration(),
resolvePainter: (textDirection, _, start) {
returnRangeSelectionPainter(
textDirection: textDirection,
color: constColor(0xFFCCE5FF), // provide your intended range color
start: start,
);
},
),
)
Non-square edge shape gap
If cells become taller than wide, a circular edge decoration can look visually detached from the full-height range background.
Fix options:
Use OvalBorder or StadiumBorder for edge shape.
Adjust cellsPadding to reduce height/width mismatch.