I have a widget that returns showModalBottomSheet, which is inside of void. I call it inside of initState class. But when I change values inside of showModalBottomSheet with setState, it is not displayed even though values changes.
initState()
@override
void initState() {
Future.delayed(Duration.zero, () {
showModal();
});
super.initState();
}
showModalBottomSheet void
void showModal() {
showModalBottomSheet<void>(
isDismissible: false,
context: context,
builder: (BuildContext context) {
return SingleChildScrollView(
I'm changing value
child: GestureDetector(
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
color: color,
borderRadius: BorderRadius.circular(50.0),
),
height: MediaQuery.of(context).size.width / 10,
width: MediaQuery.of(context).size.width / 10,
),
onTap: () => showModalBottomSheet(
context: context,
builder: (_) {
return Container(
height: 300,
child: ColorPickerWidget(this.callbackColor),
);
}),
),
void callbackColor(Color color) {
setState(() {
this.color = color;
});
}