Skip to content

Date Picker code structure refactor #69939

@darrenaustin

Description

@darrenaustin

As flagged by @Hixie in material/pickers/pickers.dart:

// TODO(ianh): Not exporting everything is unusual and we should
// probably change to just exporting everything and making sure it's
// acceptable as a public API, or, worst case, merging the parts
// that really must be public into a single file and make them
// actually private.

Which is a valid point, and here is a proposal for how to do that. The current code structure for the date pickers is:

material/pickers
├── calendar_date_picker.dart
├── calendar_date_range_picker.dart
├── date_picker_common.dart
├── date_picker_deprecated.dart
├── date_picker_dialog.dart
├── date_picker_header.dart
├── date_range_picker_dialog.dart
├── date_utils.dart
├── input_date_picker.dart
├── input_date_range_picker.dart
└── pickers.dart

I would like to combine several of these and move everything up to the top level material directory as follows:

File Contents
material/date_picker.dart showDatePicker/RangePicker, date_picker_header and dialogs
material/calendar_date_picker.dart just a move, but possibly re-expose YearPicker
material/calendar_date_range_picker.dart move and make CalendarDateRangePicker public
material/date_picker_deprecated.dart just a move
material/date.dart date utilities from date_utils.dart & date_picker_common.dart
material/input_date_picker_form_field.dart move from input_date_picker.dart

In addition, we should add new test files for the top level components:

test/material/calendar_date_picker_test
test/material/calendar_date_range_picker_test
test/material/input_date_picker_form_field_test.dart

This should bring the code structure for the Date Pickers to be more inline with the rest of the flutter framework, and thus easier for people to follow. This will also remove un-exported public symbols that were still technically available for people to use.

Metadata

Metadata

Assignees

Labels

f: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions