Skip to content

Commit

Permalink
Ensure the provided startYear and endYear in DateTime are used …
Browse files Browse the repository at this point in the history
…properly (#637)
  • Loading branch information
bdlukaa authored Dec 1, 2022
2 parents 2273483 + f37b5a2 commit 4184c6f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [next]

- Ensure the provided `startYear` and `endYear` in `DateTime` are used properly ([#627](https://github.com/bdlukaa/fluent_ui/issues/627))
- Fix left arrow key not moving to parent item on collapsed `TreeViewItem` ([#632](https://github.com/bdlukaa/fluent_ui/issues/632))

## 4.1.0

- Fixed `TreeView` selection state behavior for items that are not expanded ([#578](https://github.com/bdlukaa/fluent_ui/issues/578))
Expand All @@ -8,7 +13,6 @@
- Ensure the TabView scroll controller has clients before using it ([#615](https://github.com/bdlukaa/fluent_ui/issues/615))
- TabView now waits a time to resize after closed ([#617](https://github.com/bdlukaa/fluent_ui/issues/617))
- `ToggleButton` border width is uniform ([#610](https://github.com/bdlukaa/fluent_ui/issues/610))
- Fix left arrow key not moving to parent item on collapsed `TreeViewItem` ([#632](https://github.com/bdlukaa/fluent_ui/issues/632))

## 4.0.3+1

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ packages:
path: ".."
relative: true
source: path
version: "4.2.0"
version: "4.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand Down
10 changes: 7 additions & 3 deletions lib/src/controls/form/pickers/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class DatePicker extends StatefulWidget {
/// If null, the order is based on the current locale.
///
/// See also:
///
/// * [getDateOrderFromLocale], which returns the order of the fields based
/// on the current locale
final List<DatePickerField>? fieldOrder;
Expand All @@ -158,7 +159,10 @@ class DatePicker extends StatefulWidget {
..add(ObjectFlagProperty.has('focusNode', focusNode))
..add(
FlagProperty('autofocus', value: autofocus, ifFalse: 'manual focus'))
..add(DoubleProperty('popupHeight', popupHeight));
..add(DoubleProperty('popupHeight', popupHeight,
defaultValue: kPickerPopupHeight))
..add(DiagnosticsProperty<Locale>('locale', locale))
..add(IterableProperty<DatePickerField>('fieldOrder', fieldOrder));
}
}

Expand All @@ -170,8 +174,8 @@ class _DatePickerState extends State<DatePicker> {
FixedExtentScrollController? _yearController;

int get startYear =>
((widget.startYear ?? DateTime.now().year) - 100).toInt();
int get endYear => ((widget.endYear ?? DateTime.now().year) + 25).toInt();
(widget.startYear ?? (DateTime.now().year - 100)).toInt();
int get endYear => (widget.endYear ?? (DateTime.now().year + 25)).toInt();

int get currentYear {
return List.generate(endYear - startYear, (index) {
Expand Down

0 comments on commit 4184c6f

Please sign in to comment.