-
Notifications
You must be signed in to change notification settings - Fork 0
LayrzDateRangeInput
Picker-style input that collects a date range (start and end dates) via a calendar dialog.
-
Mirrors:
ThemedDateRangePickerfrom 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.
LayrzDateRangeInput 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(receives start+end as list),onSubmit,onTap(opens calendar),readOnly -
Focus/lifecycle:
focusNode,controller(dispose pattern specified) -
Layout:
paddingfrom M1 spacing tokens - Value display: Formatted date range string and optional visual affordance
-
Value type:
List<DateTime>(two-element list: [startDate, endDate]) - Selection surface: Calendar dialog with range selection (user taps start date, then end date)
-
Display format: Formatted range string, e.g., "2026-08-01 to 2026-08-31" (customizable via
datePattern)
// Design sketch — illustrative only
class LayrzDateRangeInput extends LayrzTextInput {
/// The currently selected date range.
///
/// Expected format: [startDate, endDate].
/// An empty list means no selection; a single-element list means start only.
final List<DateTime> value;
/// Callback invoked when the user commits a date range selection.
///
/// Receives the full [startDate, endDate] pair.
final void Function(List<DateTime>)? onChanged;
/// Format pattern for displaying selected dates.
///
/// Uses strftime-style format codes (e.g., `%Y-%m-%d`).
/// The display format for the range string is template-based; see Open Questions.
/// Default: `%Y-%m-%d`.
final String datePattern;
/// List of specific dates to disable.
///
/// Each date in this list is shown as unselectable in the calendar.
/// Typically used for holidays or unavailable dates.
final List<DateTime> disabledDays;
// ... inherited from LayrzTextInput
}-
Value representation: A two-element
List<DateTime>rather than a dedicated range type.- Callers must manage [startDate, endDate] tuple semantics themselves.
- Open question: Should layrz_ui use a dedicated
DateRangeclass?
-
Calendar interaction: User selects a start date, then an end date.
- Visual affordance: selected start/end dates highlighted; dates in between shown as selected range.
- No support for swapping start/end if user selects them in reverse order (TBD).
-
Disabled dates: Only
disabledDayslist (nofirstDay/lastDayrange in source).- layrz_theme
ThemedDateRangePickerdoes not exposefirstDay/lastDay; open question whether layrz_ui adds them.
- layrz_theme
As of layrz_theme source, ThemedDateRangePicker exposes:
class ThemedDateRangePicker extends StatefulWidget {
final List<DateTime> value;
final void Function(List<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 List<DateTime> disabledDays;
// Formatting and localisation
final String pattern; // strftime-style
final Map<String, String> translations;
final bool overridesLayrzTranslations;
const ThemedDateRangePicker({
required this.value,
// ... other parameters
});
}Notes:
-
valueis required, not optional (defaults to empty list in constructor). - No
firstDay/lastDayparameters (unlikeThemedDatePicker); onlydisabledDays. - Color and styling parameters are Material-specific and will not carry forward.
- Translations provided as a map.
- LayrzTextInput (M3) — must ship first; LayrzDateRangeInput composes it.
- Calendar widget (hand-rolled or SDK-based) — with range selection highlighting.
-
Dialog routing —
showGeneralDialogor equivalent.
- M1 spacing tokens — padding and inner spacing.
- Tooltip component (M2) — for help affordance.
- Material-free selection controls — if LayrzTextInput has not resolved text selection.
- Localisation infrastructure — for calendar UI labels and translations.
-
Value type: Should
LayrzDateRangeInputuse a dedicatedDateRangeclass, or keep theList<DateTime>approach?- Pros (list): flexible, simple, matches layrz_theme.
- Pros (class): type-safe, explicit semantics, easier to validate.
-
Localisation: Same as LayrzDateInput. How are month names and button labels translated?
-
Range format template: How is the date range displayed as a string?
- Option 1:
{start} to {end}(caller-supplied format string?) - Option 2:
{start} – {end}(fixed en-dash) - Option 3: Locale-specific separator (e.g., "to" in English, "a" in Spanish)?
- Option 1:
-
Disabled dates and ranges: Should certain date ranges be disableable (e.g., "only select ranges < 30 days")?
- Currently only individual dates can be disabled.
-
Start/end validation: If user selects end date before start date, what happens?
- Swap them automatically?
- Reject and show error?
- Allow and let caller handle?
-
Reverse range selection: Allow picking end date first, then start date?
- layrz_theme behavior unclear; needs clarification.
-
firstDay/lastDay support: Should layrz_ui add range bounds like LayrzDateInput?
- layrz_theme does not expose them; design decision needed.
-
Today indicator: Same as LayrzDateInput—highlight today in the calendar?
- Input Contract — shared contract for all Layrz*Input components
- LayrzDateInput — single-date variant for comparison
- 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