Skip to content

Conversation

CesareIsHere
Copy link
Contributor

This PR adds support for the readOnly property to FormBuilderDateTimePicker, bringing it in line with other form builder fields and Flutter's native TextField behavior.

Changes Made

  • Added readOnly property to FormBuilderDateTimePicker constructor with default value false
  • Modified the onTap callback to conditionally prevent picker dialogs from opening when readOnly is true
  • Updated documentation for the new property

Behavior

When readOnly: true:

  • ✅ Field displays the current date/time value normally
  • ✅ Date/time picker dialogs do not open when tapping the field
  • ✅ Field maintains normal visual appearance (not grayed out like enabled: false)
  • ✅ Field remains focusable for accessibility
  • ✅ Value is still accessible for form submission and validation
  • ✅ Consistent with other FormBuilder fields API

Usage Example

FormBuilderDateTimePicker(
  name: 'created_date',
  readOnly: true,
  initialValue: DateTime.now(),
  decoration: InputDecoration(
    labelText: 'Creation Date',
    hintText: 'This field is read-only',
  ),
)

Use Cases

  • Displaying creation/modification timestamps
  • Showing calculated dates that shouldn't be modified
  • Form sections that are conditionally editable based on user permissions
  • Confirmation/review screens where data should be visible but not modifiable

Breaking Changes

None - this is a backward-compatible addition with a sensible default value.

@CesareIsHere CesareIsHere changed the title Add readOnly property to FormBuilderDateTimePicker feat: Add readOnly property to FormBuilderDateTimePicker Jun 23, 2025
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.88%. Comparing base (84dbb3f) to head (b73e503).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1496   +/-   ##
=======================================
  Coverage   89.88%   89.88%           
=======================================
  Files          21       21           
  Lines         840      840           
=======================================
  Hits          755      755           
  Misses         85       85           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CesareIsHere CesareIsHere deleted the CesareIsHere-patch-1 branch June 23, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant