Skip to content

Commit

Permalink
fix: NumberBox does not calls a rebuild when it is already building (
Browse files Browse the repository at this point in the history
…Fixes #1064)
  • Loading branch information
bdlukaa committed Jun 23, 2024
1 parent 00c3b19 commit 926f080
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
* fix: Scroll issue in `DatePicker`. ([#1054](https://github.com/bdlukaa/fluent_ui/issues/1054))
* feat: Add `NumberBox.textInputAction` and `NumberBox.onEditingComplete` ([#1063](https://github.com/bdlukaa/fluent_ui/pull/1063))
* fix: `NumberBox` does not calls a rebuild when it is already building ([#1064](https://github.com/bdlukaa/fluent_ui/issues/1064))
* feat: Add `Tab.color`, `Tab.selectedColor` and `Tab.outlineColor` to TabView ([#1068](https://github.com/bdlukaa/fluent_ui/pull/1068))
* feat: Added `NavigationView.onItemPressed` callback, called when the item is on tap ([#1067](https://github.com/bdlukaa/fluent_ui/pull/1067))
* fix: Mark `MenuFlyoutItem` as disabled when `.onPressed` is `null` ([#1074](https://github.com/bdlukaa/fluent_ui/issues/1074))
Expand Down
20 changes: 11 additions & 9 deletions lib/src/controls/form/number_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,18 @@ class NumberBoxState<T extends num> extends State<NumberBox<T>> {
}

if (oldWidget.value != widget.value) {
if (widget.value != null) {
_updateController(widget.value!);
} else {
controller.text = '';
}
}
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.value != null) {
_updateController(widget.value!);
} else {
controller.text = '';
}

if ((oldWidget.min != widget.min && widget.min != null) ||
(oldWidget.max != widget.max && widget.max != null)) {
updateValue();
if ((oldWidget.min != widget.min && widget.min != null) ||
(oldWidget.max != widget.max && widget.max != null)) {
updateValue();
}
});
}
}

Expand Down

0 comments on commit 926f080

Please sign in to comment.