Closed ArefMozafari closed 4 years ago
I'd recommend maintaining an enum that describes all the states of your panel. When the state is supposed to change, call setState()
and update an enum variable. For example:
enum PanelWidgetState{
WIDGET_ONE,
WIDGET_TWO
}
PanelWidgetState _pws;
Widget build(BuildContext context){
return SlidingUpPanel(
panel: _panel(),
...
);
}
// called whenever the UI is supposed to change
void _onChange(){
setState((){
if(some_condition) _pws = PanelWidgetState.WIDGET_ONE;
...
});
}
Widget _panel(){
if (_pws == PanelWidgetState.WIDGET_ONE) return WidgetOne();
else if ...
}
Thank you
Hi there how can i change the panelBody at the run time? because i'm using the panel for my root widget and for each item that user selected in current screen i need to show different body in the panel