Skip to content

Commit

Permalink
fix: submitting date time text field makes it flash
Browse files Browse the repository at this point in the history
  • Loading branch information
richardshiue committed Nov 6, 2024
1 parent 8ae6805 commit 33762ee
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,11 @@ class DesktopAppFlowyDatePickerState

@override
void onDateTimeInputSubmitted(DateTime value) {
refreshStartTextFieldNotifier.refresh();
if (isRange) {
DateTime end = endDateTime ?? value;
if (end.isBefore(value)) {
(value, end) = (end, value);
refreshEndTextFieldNotifier.refresh();
refreshStartTextFieldNotifier.refresh();
}

widget.onRangeSelected?.call(value, end);
Expand All @@ -255,15 +254,14 @@ class DesktopAppFlowyDatePickerState

@override
void onEndDateTimeInputSubmitted(DateTime value) {
refreshEndTextFieldNotifier.refresh();
if (isRange) {
if (endDateTime == null) {
value = combineDateTimes(value, widget.endDateTime);
}
DateTime start = startDateTime ?? value;
if (value.isBefore(start)) {
(start, value) = (value, start);
refreshStartTextFieldNotifier.refresh();
refreshEndTextFieldNotifier.refresh();
}

widget.onRangeSelected?.call(start, value);
Expand Down

0 comments on commit 33762ee

Please sign in to comment.