0

I think this question is not about PageView, only in my case. I have a PageView wrapped with a Padding like below.

Padding(
   padding : EdgeInsets.symmetric(horizontal : padding),
   child : PageView.builder(...)
)

Each PageView's item has a widget assigned with a GlobalKey. If I keep the same padding value, State update simply assumes that the GlobalKey is used to the same widget, so no problem.

The issue is when padding value is changed. State update considers that the GlobalKey is assigned to new widget, I think because it thinks that the widget tree was changed.

As for now I have to use this ugly workaround.

Row(
   children : [
      if(padding != 0) Container(width : padding),
      Expanded(child : PageView.builder(...)),
      if(padding != 0) Container(width : padding),
   ]
)

So I need to change the padding value without assigning new GlobalKey again to the mistook "new" PageView's item's widget. Sorry, actually the more important is how to make the State update to not consider a change in widget tree in case if it is so.

Thank you.

stackunderflow
  • 1,492
  • 1
  • 23
  • 53

0 Answers0