Skip to content

Commit 59aa5ba

Browse files
fix: Sort date pair on range close in ThemedDateTimeRangePicker (#137)
When the range was picked in reverse order (later day first, earlier day second), startDate/endDate were kept in selection order and only sorted at save time. Times entered in the Time tab were glued to the wrong endpoint, so the saved [start, end] list had each time pointing at the opposite date. Sort the date pair the moment the second tap closes the range, so the Time tab always shows Start = earlier day, End = later day, and each time stays aligned with its intended date. chore: Bump version to 7.5.31 in pubspec.yaml and .claude/plugin.json docs: Add 7.5.31 entry to CHANGELOG.md
2 parents 77eec4a + 395efcd commit 59aa5ba

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

.claude/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "layrz-theme",
33
"description": "Claude Code skills for layrz-theme Flutter widget library",
4-
"version": "7.5.30",
4+
"version": "7.5.31",
55
"author": {
66
"name": "Golden M, Inc.",
77
"url": "https://github.com/goldenm-software"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 7.5.31
4+
5+
- Fixed `ThemedDateTimeRangePicker` swapped times when the date range was picked in reverse order: selecting the later date first and the earlier date second caused the times entered in the Time tab to be glued to the wrong endpoint, because `startDate`/`endDate` were left in selection order while only the final save sorted the resulting `DateTime`s. The dialog now sorts `startDate`/`endDate` the moment the second tap closes the range, so the Time tab always shows "Start" for the earlier day and "End" for the later one and the returned `[start, end]` list keeps each time aligned with its intended date.
6+
37
## 7.5.30
48

59
- Fixed incorrect deprecation of `ThemedTableAvatar`: the class is used by `ThemedScaffoldView.avatarBuilder` in the scaffolds module and is not exclusive to `ThemedTable`. Consumers using `ThemedScaffoldView` were receiving a false `deprecated_member_use` warning.

lib/src/inputs/src/pickers/datetime/range.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,12 @@ class _ThemedDateTimeRangeDialogState extends State<ThemedDateTimeRangeDialog> w
420420

421421
endDate = newDate;
422422
tempDate = null;
423-
filledDates = _fillDates(
424-
[startDate, endDate]..sort((a, b) {
425-
return a.compareTo(b);
426-
}),
427-
);
423+
if (endDate.isBefore(startDate)) {
424+
final swap = startDate;
425+
startDate = endDate;
426+
endDate = swap;
427+
}
428+
filledDates = _fillDates([startDate, endDate]);
428429
setState(() {});
429430
},
430431
),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: layrz_theme
22
description: Layrz standard styling library for Flutter. Widget library following the Material Design 3 guidelines, with a focus on reliavility and functionality.
3-
version: "7.5.30"
3+
version: "7.5.31"
44
homepage: https://theme.layrz.com
55
repository: https://github.com/goldenm-software/layrz_theme
66

0 commit comments

Comments
 (0)