So I have this showModalBottomSheet()
and in it I have a couple widgets that require state, so I wrapped with StatefulBuilder()
. Even though the other widgets are updating their data and UI as expected but the RangeSlider()
does not update the UI(slide), it only updates the data.
I've tried wrapping the RangeSlider()
with StatefulBuilder()
but still it does not work(slide). I've also tried other solutions like this
How can I solve this issue.
Here is my code snippet
showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.0),)),
builder:(_){
return StatefulBuilder(builder: (BuildContext context, StateSetter setter){
return SafeArea(
child: Column(
children:[
...
Wrap(
children: List.generate(1, (index) {
final selectable = facets[index];
final facet = selectable.item;
RangeValues _currentRangeValues = RangeValues(0, double.parse(facets.last.item.value));
return SliderTheme(
data: SliderTheme.of(context).copyWith(
showValueIndicator: ShowValueIndicator.always,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 15),
),
child: RangeSlider(
min: 0,
max: double.parse(facets.last.item.value),
activeColor: AppColors.secondaryThemeColor,
inactiveColor: AppColors.fontHeaderColor,
labels: RangeLabels(
_currentRangeValues.start.round().toString().replaceAllMapped(reg, mathFunc),
_currentRangeValues.end.round().toString().replaceAllMapped(reg, mathFunc),
),
values: _currentRangeValues,
onChanged: (value) {
setState(() {
sVal = value.start.round();
sFal = value.end.round();
_currentRangeValues = value;
facetPriceList.toggle(facet.value);
});
},
),
);
}),
) ...
]
)
);
}
}
)
And here is the screenshots