flutter_screenutil icon indicating copy to clipboard operation
flutter_screenutil copied to clipboard

Error when keyboard shows up

Open ElshiatyTube opened this issue 4 years ago • 7 comments

The following assertion was thrown building _MediaQueryFromWindow(state: _MediaQueryFromWindowState#a1453): 'package:flutter/src/widgets/framework.dart': Failed assertion: line 5356 pos 14: '() { // check that it really is our descendant Element? ancestor = dependent._parent; while (ancestor != this && ancestor != null) ancestor = ancestor._parent; return ancestor == this; }()': is not true.

ElshiatyTube avatar Apr 28 '22 20:04 ElshiatyTube

Duplicate of https://github.com/OpenFlutter/flutter_screenutil/issues/380#issue-1218521381

lianfanghua avatar Apr 29 '22 02:04 lianfanghua

I fixed it temporarily by using 5.0.0+2 version and setting MaterialApp builder context to ScreenUtil, something like this:

ScreenUtilInit(
          builder: (_)=>MaterialApp(
            builder: (context, widget) {
              ScreenUtil.setContext(context);
              return widget!;
            },
            title: appName,
          )
      ),

Hope to fix the issue in the latest version

ElshiatyTube avatar Apr 29 '22 21:04 ElshiatyTube

@ElshiatyTube @lianfanghua , Please try with master branch and tell us if it works with you so we can ship a stable version in pub.dev.

dependencies:

  flutter_screenutil:
    git:
      url: https://github.com/OpenFlutter/flutter_screenutil
      branch: master

Mounir-Bouaiche avatar Apr 30 '22 23:04 Mounir-Bouaiche

@Mounir-Bouaiche Great, it works fine.

ElshiatyTube avatar Apr 30 '22 23:04 ElshiatyTube

@ElshiatyTube Thank you my friend for your feedback.

Mounir-Bouaiche avatar May 01 '22 00:05 Mounir-Bouaiche

Hi @ElshiatyTube , I have recently published the new version of the library. Go check it out and if it works fine for you please close this issue, or else drop error log here. Thank you.

Mounir-Bouaiche avatar May 01 '22 21:05 Mounir-Bouaiche

@Mounir-Bouaiche v 5.5.1 works as expected, Thanks

ElshiatyTube avatar May 01 '22 22:05 ElshiatyTube