-
Notifications
You must be signed in to change notification settings - Fork 0
LayrzDateInput
Picker-style input that collects a single date value via a calendar dialog.
-
Mirrors:
ThemedDatePickerfrom layrz_theme - Phase: M4 (Pickers)
- Domain: Pickers
-
Composes:
LayrzTextInput(read-only mode)
DERIVED from layrz_theme, NOT confirmed by the team. This page synthesizes the current Themed API. Every detail here awaits review and sign-off. See Input Contract for the shared contract all inputs conform to.
LayrzDateInput conforms to the Layrz*Input contract defined in Input Contract:
-
Field identification:
labelTextandplaceholder - Prefix/suffix: Mutually exclusive icon/widget pairs with callbacks
-
Help affordance:
helpTitleTextandhelpContentText -
Interactivity:
onChanged,onSubmit,onTap(opens calendar),readOnly -
Focus/lifecycle:
focusNode,controller(dispose pattern specified) -
Layout:
paddingfrom M1 spacing tokens - Value display: Formatted date and optional visual affordance
-
Value type:
DateTime?(nullable) - Selection surface: Calendar dialog with month/year navigation
-
Display format: Formatted date string (default pattern:
%Y-%m-%d; customizable viadatePattern)
// Design sketch — illustrative only
class LayrzDateInput extends LayrzTextInput {
/// The currently selected date, or null if no selection.
final DateTime? value;
/// Callback invoked when the user commits a date selection.
final void Function(DateTime)? onChanged;
/// Format pattern for displaying the selected date.
///
/// Uses strftime-style format codes (e.g., `%Y-%m-%d` for YYYY-MM-DD).
/// Default: `%Y-%m-%d`.
final String datePattern;
/// Earliest date the user can select.
///
/// Any date before this is disabled in the calendar.
/// If null, no lower bound is applied.
final DateTime? firstDay;
/// Latest date the user can select.
///
/// Any date after this is disabled in the calendar.
/// If null, no upper bound is applied.
final DateTime? lastDay;
/// List of specific dates to disable.
///
/// Each date in this list is shown as unselectable in the calendar.
final List<DateTime> disabledDays;
// ... inherited from LayrzTextInput
}-
Disabled dates: Three mechanisms to restrict selection:
-
firstDay/lastDay— range bounds -
disabledDays— specific dates (e.g., weekends, holidays)
-
-
Custom formatting:
datePatternallows caller-supplied strftime-style format (default sensible). -
Localisation implications: Date formatting and calendar UI (month names, weekday headers) need localisation. See Open Questions.
As of layrz_theme source, ThemedDatePicker exposes:
class ThemedDatePicker extends StatefulWidget {
final DateTime? value;
final void Function(DateTime)? onChanged;
// Labels and placeholder
final String? labelText;
final Widget? label;
final String? placeholder;
// Prefix
final String? prefixText;
final IconData? prefixIcon;
final Widget? prefixWidget;
final VoidCallback? onPrefixTap;
// Custom child and styling (Material-specific, likely deprecated)
final Widget? customChild;
final Color hoverColor;
final Color focusColor;
final Color splashColor;
final Color highlightColor;
final BorderRadius borderRadius;
// Error and layout
final List<String> errors;
final bool hideDetails;
final EdgeInsets? padding;
final bool disabled;
// Date constraints
final DateTime? firstDay;
final DateTime? lastDay;
final List<DateTime> disabledDays;
// Formatting and localisation
final String pattern; // strftime-style
final Map<String, String> translations;
final bool overridesLayrzTranslations;
const ThemedDatePicker({
// ... parameters
});
}Notes:
-
disabledstate is distinct fromreadOnly. - Color parameters (
hoverColor, etc.) are Material-specific and will not carry forward to layrz_ui. - Translations are provided as a map; layrz_ui will align with the localization strategy TBD.
-
patternuses strftime codes; layrz_ui will retain this or adopt a new scheme per design decisions.
- LayrzTextInput (M3) — must ship first; LayrzDateInput composes it.
- Calendar widget (hand-rolled or SDK-based) — to display month/year grid with navigation.
-
Dialog routing —
showGeneralDialogor equivalent (SDK providesRawDialogRoute,Overlay,OverlayPortal).
-
M1 spacing tokens — padding and inner spacing via
design-tokens.md. - Tooltip component (M2) — for help affordance.
- Material-free selection controls — if LayrzTextInput has not resolved text selection (see flutter-347-audit.md).
- Localisation infrastructure — month names, calendar UI labels. Strategy TBD.
-
Localisation: How are month names, weekday headers ("Mon", "Tue", etc.), and button labels ("Cancel", "Save") translated?
- layrz_theme uses
LayrzAppLocalizationsand atranslationsmap parameter. - layrz_ui has no localisation strategy yet. Should we use
intlpackage, context-based lookups, or defer to the app?
- layrz_theme uses
-
Date formatting: Adopt strftime codes like layrz_theme, or use Dart's
DateFormat(fromintl)?- Strftime is familiar but minimal;
intlis more powerful but adds a dependency.
- Strftime is familiar but minimal;
-
Disabled state: Is
disableddistinct fromreadOnly?- layrz_theme has both;
disabledprevents interaction,readOnlyshows value without editing. - Does layrz_ui collapse these, or retain both?
- layrz_theme has both;
-
Disabled days UI: How are disabled dates shown in the calendar?
- Strikethrough? Grayed out? Invisible? Theme-configurable?
-
Today indicator: Should the calendar highlight today's date?
- layrz_theme has a "Today" button; should we support that, or just highlight the date?
-
Keyboard navigation: Can the user navigate the calendar with arrow keys?
- Opens up accessibility but adds interaction complexity.
- Input Contract — shared contract for all Layrz*Input components
- Component Catalog — mapping of layrz_theme to layrz_ui components
- Design Tokens — M1 spacing and theme tokens
- Flutter 347 Audit — SDK dependency audit
- Decisions — D5 (naming: LayrzInput replaces LPicker)
Made with ❤️ by Golden M, Inc.
- LayrzTextInput
- LayrzSelectableAction
- LayrzSelectionToolbar
- LayrzTextSelectionControls
- LayrzSelectionMagnifier
- LayrzSelectionHandlePainter
- LayrzTextAreaInput
- LayrzComboBoxInput
- LayrzNumberInput
- LayrzPasswordInput
- LayrzCheckboxInput
- LayrzRadioInput
- LayrzSelectInput
- LayrzMultiSelectInput
- LayrzSearchInput
- LayrzDualListInput
- LayrzDurationInput