0

Anyone to help ?

I've been using someone else's project. It seems like the code is outdated as flutter gets updates. Would u guys take a look? Much appreciated.

1 Answer 1

0

You are doing it wrong.

@override
  Widget build(BuildContext context) {
    
    return ScreenUtilInit(
      designSize: const Size(360, 690),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context , child) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'First Method',
          // You can use the library anywhere in the app even in theme
          theme: ThemeData(
            primarySwatch: Colors.blue,
            textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp),
          ),
          home: child,
        );
      },
      child: const HomePage(title: 'First Method'),
    );
  }

In your builder constructor pass context and child first. Then in home pass child. Next, set your HomePage to the child of the ScreenUtilInit. Hope its clear.

2
  • well, the app stuck working, but we have at least solved 1 issue xd
    – Remy Danon
    Jun 12, 2022 at 12:27
  • what did you do now? what error? You should mark it as an answer if it solved your previous error. Jun 13, 2022 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.