我有一个问题。我使用的是带有responvewrapper的易加载包。但是我不能把它们放在一起,请帮帮我。
建设者: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(),
},
);
});
}
生成器参数必须返回一个小部件。如果您希望初始化或返回两个小部件,则必须自己将它们嵌套在构建器中:
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;
}
或者你应该尝试使用ResponsiveWrapper的第二种方式。例如:
builder: EasyLoading.init(builder: ResponsiveWrapper.builder(/*your required code here*/)),