values pst first submission
This commit is contained in:
@@ -33,13 +33,31 @@ class _MihNumericStepperState extends State<MihNumericStepper> {
|
|||||||
late int _currentValue;
|
late int _currentValue;
|
||||||
late bool error;
|
late bool error;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
widget.controller.removeListener(_syncCurrentValue);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_currentValue =
|
_currentValue =
|
||||||
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
|
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
|
||||||
widget.controller.text = _currentValue.toString();
|
widget.controller.text = _currentValue.toString();
|
||||||
print("Current Value: $_currentValue");
|
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
|
||||||
|
widget.controller.addListener(_syncCurrentValue);
|
||||||
|
// print("Current Value: $_currentValue");
|
||||||
|
}
|
||||||
|
|
||||||
|
void _syncCurrentValue() {
|
||||||
|
final newValue =
|
||||||
|
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
|
||||||
|
if (newValue != _currentValue) {
|
||||||
|
setState(() {
|
||||||
|
_currentValue = newValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user