I'm using this Flutter widget: HorizontalPicker
as a very sample code here:
HorizontalPicker(
initialValue: Recipe.recipe.portionWeight.toInt(),
height: 70,
minValue: 0,
maxValue: Recipe.recipe.recipeWeight,
divisions: Recipe.recipe.recipeWeight.toInt(),
suffix: " g",
showCursor: false,
backgroundColor: Colors.grey.shade900,
activeItemTextColor: Colors.white,
passiveItemsTextColor: Colors.amber,
onChanged: (value) {
setState(() {
Recipe.recipe.portionWeight = value;
Recipe.calculatePortionGrams();
Speedometers.elaborateKcalNeedlePointer(value);
Recipe.updateRecipe();
});
},
),
Unfortunately this widget does not have a controller. My Users should change realtime the MAX value, however once drawed to the screen the widget does not refresh itself even if I change programmatically the MAX value on SetState. If I change page or hide the widget itself, once returned the value is refreshed.
There is a workaround for this? As for example how can I hide it for a second and display again? Or how can I force the redraw of a widget?