Firstly, I am sorry for my poor english.
I am trying success to extract a very complex widget as package and use it on different projects. For this reason, I need to use ScreenUtil package (for responsive design.) in that widget-package.
So in the end, I succeed the extract my widget as a package but I am confused some point because as you know, screen_util package requires to be initialized like;
ScreenUtilInit(
designSize: const Size(750, 1334),
builder: () => const MyApp(),
)
So my question, how can I success to initialize the screen_util package correctly for my usage ? (I don't have any builder function because my widgets created like class MyWidget extends SizedBox(important not like stateless or statefull widget!)) so,
I added a function for initializing operation like ;
void myComponentInitializer({
required BuildContext context
}){
ScreenUtil.init(
BoxConstraints(
maxWidth: MediaQuery.of(context).size.width,
maxHeight: MediaQuery.of(context).size.height
),
context: context,
designSize: const Size(750, 1334),
minTextAdapt: true
);
ScreenUtil.setContext(context);
}
and before using the package, I am calling that function but I can't be sure, is it a best way to initialize screen_util for my widget or not. If it is not the right way, can you show me the right way ?
So I am open any idea for this.
Thanks a lot.