OpenFlutter / flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
https://pub.dartlang.org/packages/flutter_screenutil
Apache License 2.0
3.87k stars 493 forks source link

[flutter-web] In the newest flutter, it will cause flutter to show nothing #462

Closed yingshaoxo closed 1 year ago

yingshaoxo commented 1 year ago

Flutter 3.7.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision 12cb4eb7a0 (3 days ago) • 2023-03-01 10:29:26 -0800 Engine • revision ada363ee93 Tools • Dart 2.19.3 • DevTools 2.20.1


await ScreenUtil.ensureScreenSize(); will block the main process on web client.

lizhuoyuan commented 1 year ago

I'm not sure if this is the cause of the plugin,

yingshaoxo commented 1 year ago

Did you tried to create a web client project, and run the code to see if it really blocks it?

import 'package:get/get.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  () async {
    await ScreenUtil.ensureScreenSize();

    runApp(GetMaterialApp(
      initialRoute: RoutesMap.login,
      getPages: [
        GetPage(
            name: RoutesMap.location_management,
            page: () => const LocationManagementHomePage()),
        GetPage(name: RoutesMap.login, page: () => const LoginPage()),
      ],
      theme: ThemeData(
        primarySwatch: Colors.blue,
        ),
      ),
    ));
  }();
}

On Fri, Mar 10, 2023 at 2:23 PM LiZhuoyuan @.***> wrote:

I'm not sure if this is the cause of the plugin,

— Reply to this email directly, view it on GitHub https://github.com/OpenFlutter/flutter_screenutil/issues/462#issuecomment-1463333444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDE7LJXVROYY6K55CFL6ADW3LCHLANCNFSM6AAAAAAVPOU7K4 . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

n0n1 commented 1 year ago

Anybody solved that? When ScreenUtil.ensureScreenSize() called, we don't have value to FlutterView and app show nothing.

n0n1 commented 1 year ago
image
n0n1 commented 1 year ago
image
n0n1 commented 1 year ago

https://docs.flutter.dev/release/breaking-changes/window-singleton

dudodv commented 1 year ago

any update?

kashiflab commented 1 year ago

did anyone find a solution? I'm stuck. I am using GoRoute, and need to check the size for web & mobile before passing routes in Material.route

lizhuoyuan commented 1 year ago

I tried to execute flutter run(on web) in the example, and the problem was not reproduced. There is no problem in the release environment. Can you provide a minimal example?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

sittingbool commented 1 year ago

This is still an issue. The main function just stops here on web