the setstate in bottomsheet is not working even using statefulwidget... i want to refresh the display of parent after popping bottomsheet
should i call setstate in void instead? how to do this ?
ElevatedButton(
...
onPressed: () {
BottomSheet(context, id, expiry);
},
...
),
void BottomSheet(BuildContext context, String id, String expiry) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
....
),
),
child: BottomSheetWidget(id, expiry),
),
);
}
class BottomSheetWidget extends StatefulWidget {
....
}
class _BottomSheetWidgetState extends State<BottomSheetWidget> {
..
onTap: () {
setState(() {
updated parent data here.....
});
Navigator.pop(context);
},
....
}
Try using MaterialPageRoute to rebuild the display of the parent page