Reputation: 61
I have a problem. I'm using the easyloading package with responsivewrapper. but i can't put them together please help me
builder: EasyLoading.init(context, child) =>
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(360, 690),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return MaterialApp(
initialRoute: '/',
builder: EasyLoading.init(context, child) => ResponsiveWrapper.builder(child,
defaultScale: true,
breakpoints: [
ResponsiveBreakpoint.resize(480, name: MOBILE),
ResponsiveBreakpoint.autoScale(800, name: TABLET),
ResponsiveBreakpoint.resize(1000, name: DESKTOP),
],
background: Container(color: Color(0xFFF5F5F5))),
debugShowCheckedModeBanner: false,
routes: <String, WidgetBuilder>{
'/': (BuildContext context) => MainPage(),
'/CusSearchAtcp': (BuildContext context) => const CusSearchAtcp(),
},
);
});
}
Upvotes: 0
Views: 1186
Reputation: 349
The builder parameter must return one widget. If you like to do initialization or return two widgets, you've to nest them yourself inside the builder:
builder: (context, child) {
// do your initialization here
child = EasyLoading.init(); // assuming this is returning a widget
child = ResponsiveWrapper.builder(/*your required code here*/);
return child;
}
Or you should try to use 2nd way by ResponsiveWrapper.builder or EasyLoading such as:
builder: EasyLoading.init(builder: ResponsiveWrapper.builder(/*your required code here*/)),
Upvotes: 1