ios – Flutter: methods to override the non-public state implementation of a Cupertino widget?


I’ll first give a little bit of background of my drawback after which ask the precise query which I’m attempting to realize:


I posted this earlier query about stopping rows from disappearing as quickly as they entered the padding space of the CupertinoScrollbar’s father or mother Padding widget:

Flutter Padding on CupertinoScrollbar – methods to forestall row from disappearing as quickly as they enter the padding space?

I’ve found out a workaround resolution which entails eradicating the father or mother Padding widget solely and as an alternative wrapping the SliverList solely in SliverPadding which achieves the padding on the listing. Nonetheless, this makes the scrollbar begin on the high as it is the father or mother of the SliverPadding and thus does not know the padding for the internal SliverList.

I’ve found out an answer for this drawback. I can edit the supply code of the CupertinoScrollbar and modify the next line within the updateScrollbarPainter methodology:

..padding = MediaQuery.of(context).padding

to what I would like.


This updateScrollbarPainter is a part of the non-public state implementation _CupertinoScrollbarState, so I can not entry it outdoors from my app.

Is there a workaround for this?

If not, is the one doable resolution to switch the padding there may be to repeat the whole supply code from this file into my app after which modify it there? It appears a bit sophisticated for modifying a single line of code no?

Here is the road I can modify:

enter image description here


Leave a Reply