问题描述
我使用的flutter_easyloading 和responsive_framework这两个插件都需要在Material中的builder进行初始化。以前的单个写法为
GetMaterialApp(
builder:EasyLoading.init()
)
GetMaterialApp(
builder: (context, child) => ResponsiveBreakpoints.builder(
child: child!,
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
],
),
)
解决办法
final easyload = EasyLoading.init();
MaterialApp(
title: 'xxxx',
builder: (context, child) {
child = easyload(context, child);
child = ResponsiveBreakpoints.builder(
child: child!,
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
],
);
return child;
}
)
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » Flutter在MaterialApp中的builder初始化多个包
发表评论 取消回复