OpenFlutter / flutter_screenutil

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

The getter 'physicalGeometry' isn't defined for the type 'FlutterView'. #548

Closed ankitmiyantechspian closed 2 months ago

ankitmiyantechspian commented 4 months ago

After upgrading flutter package stopped working.

The getter 'physicalGeometry' isn't defined for the type 'FlutterView'.

Screenshot 2024-02-19 at 4 49 11 PM
ankitparmar007 commented 4 months ago

I am facing the same issue

ankitmiyantechspian commented 4 months ago

Replace the code with this in screen_util package.

static Future ensureScreenSize([ ui.FlutterView? window, Duration duration = const Duration(milliseconds: 10), ]) async { final binding = WidgetsFlutterBinding.ensureInitialized(); binding.deferFirstFrame();

await Future.doWhile(() {
  if (window == null) {
    window = binding.platformDispatcher.implicitView;
  }

  if (window == null || window!.physicalSize.isEmpty) {
    return Future.delayed(duration, () => true);
  }

  return false;
});

binding.allowFirstFrame();

}

ski96277 commented 4 months ago

### This version solved my issue flutter_screenutil: ^5.9.0

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 2 months ago

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