-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大佬,跪求解决 那个初始化无法成功,太迫切了,现在项目每次重新运行就会报错 #209
Comments
我也遇到了这个问题, 查了一下发现新版本是2月4号更新的。 我回滚到4.0.2+3 就没事了,之前是^4.0.2+3。 |
是最新版本有问题 ? |
插件:^4.0.2+3 |
更新到最新版,然后照文档修改一下初始化方法试一试 |
是maxWidth != 0,就会初始化,因为maxWidth为0的时候你的所有尺寸都变成0了,显然这是不对的,而且分母不能为0 |
不行,还是那个报错
你能否说下你现在的版本 |
这是你们的方法,只是我debug走到那一步就不走了,目前还是无法初始化成功 |
不要依赖master, 依赖v4版本 , master是 null safety的 |
can you show initialization code? |
class VIQCoreMaterialApp extends StatelessWidget {
final Key key;
final String initialRoute;
final TransitionBuilder builder;
final VoidCallback onInit;
final VoidCallback onDispose;
final ThemeData theme;
final ThemeData darkTheme;
final ThemeMode themeMode;
final Function(Routing) routingCallback;
final List<GetPage> getPages;
//Screen Utils
final Size designSize;
final bool allowFontScaling;
VIQCoreMaterialApp({
this.key,
this.designSize = ScreenUtil.defaultSize,
this.allowFontScaling = false,
// Widget home,
// Widget login,
//Map<String, WidgetBuilder> routes = const <String, WidgetBuilder>{},
this.initialRoute,
//this.onGenerateRoute,
//this.onGenerateInitialRoutes,
//this.onUnknownRoute,
//this.navigatorObservers = const <NavigatorObserver>[],
this.builder,
//this.translationsKeys,
//Map<String, Map<String, String>> translations,
//String title = '',
//this.onGenerateTitle,
//Color color,
// this.customTransition,
this.onInit,
this.onDispose,
this.theme,
this.darkTheme,
this.themeMode,
// this.locale,
// this.localizationsDelegates,
// this.localeListResolutionCallback,
// this.localeResolutionCallback,
// this.supportedLocales = const <Locale>[Locale('en', 'US')],
// this.debugShowMaterialGrid = false,
// this.showPerformanceOverlay = false,
// this.checkerboardRasterCacheImages = false,
// this.checkerboardOffscreenLayers = false,
// this.showSemanticsDebugger = false,
// this.debugShowCheckedModeBanner = false,
// this.shortcuts,
// this.smartManagement = SmartManagement.full,
// this.initialBinding,
// this.unknownRoute,
this.routingCallback,
// this.defaultTransition,
// // this.actions,
@required this.getPages,
// this.opaqueRoute,
// this.enableLog,
// this.popGesture,
// this.transitionDuration,
// this.defaultGlobalState,
}) : assert(AppAuth == null || getPages.any((x) => x.name == "/login"));
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: designSize,
allowFontScaling: allowFontScaling,
builder: () => buildMaterialApp(context));
}
Widget buildMaterialApp(BuildContext context) {
return GetMaterialApp(
supportedLocales: AppLanguage.locales,
localizationsDelegates: [
FormBuilderLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
key: key,
//locale: LanguageController.to.locale,
debugShowCheckedModeBanner: false,
onInit: onInit,
onDispose: onDispose,
theme: theme,
darkTheme: darkTheme,
themeMode: themeMode ?? AppTheme.themeMode,
initialRoute: initialRoute ?? (App.isLogin ? "/" : "/login"),
routingCallback: routingCallback,
getPages: getPages,
builder: (BuildContext context, Widget child) {
/// make sure that loading can be displayed in front of all other widgets
return UpgradeAlert(
child:
FlutterEasyLoading(child: builder?.call(context, child) ?? child),
);
},
);
}
}
|
change |
you mean like this? Builder buildMaterialApp(BuildContext context) {
return Builder(
builder: (_) => GetMaterialApp(
supportedLocales: AppLanguage.locales,
localizationsDelegates: [
FormBuilderLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
key: key,
//locale: LanguageController.to.locale,
debugShowCheckedModeBanner: false,
onInit: onInit,
onDispose: onDispose,
theme: theme,
darkTheme: darkTheme,
themeMode: themeMode ?? AppTheme.themeMode,
initialRoute: initialRoute ?? (App.isLogin ? "/" : "/login"),
routingCallback: routingCallback,
getPages: getPages,
builder: (BuildContext context, Widget child) {
/// make sure that loading can be displayed in front of all other widgets
return UpgradeAlert(
child: FlutterEasyLoading(
child: builder?.call(context, child) ?? child),
);
},
));
} But I thought we are already using builder here? Why so many builder required? return ScreenUtilInit(
designSize: designSize,
allowFontScaling: allowFontScaling,
builder: () => buildMaterialApp(context));
}
|
The best way is to combine two methods into one,
the reason: |
大哥们,backchange 为什么发小版本? |
不是大小, 那个v5是 null safety的 , 如无必要请用v4 |
No description provided.
The text was updated successfully, but these errors were encountered: