flutter_form_builder icon indicating copy to clipboard operation
flutter_form_builder copied to clipboard

feat: allow the date picker dialog to be opened programmatically (closes #1477)

Open geronimol opened this issue 8 months ago • 3 comments

Connection with issue(s)

Close #1477

Solution description

Making FormBuilderDateTimePickerState public allows calling the showPicker method programatically. We can access it like so:

final dateTimePickerKey = GlobalKey<FormBuilderDateTimePickerState>();
...
FormBuilderDateTimePicker(key: dateTimePickerKey),
...
dateTimePickerKey.currentState?.showPicker();

Screenshots or Videos

To Do

  • [x] Read contributing guide
  • [x] Check the original issue to confirm it is fully satisfied
  • [x] Add solution description to help guide reviewers
  • [x] Add unit test to verify new or fixed behaviour
  • [x] If apply, add documentation to code properties and package readme

geronimol avatar Mar 13 '25 16:03 geronimol

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.88%. Comparing base (483f02f) to head (76f0a02). Report is 2 commits behind head on main.

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Mar 13 '25 16:03 codecov[bot]

Thanks for PR!

This is a sustancial change. I think that need to think more about the consequences of this, as the ones I explain here https://github.com/flutter-form-builder-ecosystem/flutter_form_builder/issues/1132#issuecomment-1295897916

deandreamatias avatar Mar 14 '25 18:03 deandreamatias

@deandreamatias I wasn't sure about this either, but I saw the Flutter team is using this behavior in other widgets, such as PaginatedDataTable. You can see they left the PaginatedDataTableState as public, so you can access the pageTo method to dynamically change the page.

geronimol avatar Mar 14 '25 18:03 geronimol