o1298098 / Flutter-Movie

😎 🎬 A Flutter movie app build with Fish-Redux and The Movie DB api.
Apache License 2.0
720 stars 220 forks source link

in release app some elements not show #9

Closed twocolors closed 3 years ago

twocolors commented 4 years ago

in release app some elements not show, Adapt.screenW() - return 0

o1298098 commented 4 years ago
class Adapt {
    static MediaQueryData mediaQuery = MediaQueryData.fromWindow(window);
    static double _width = mediaQuery.size.width;
    static double _height = mediaQuery.size.height;
    static double _topbarH = mediaQuery.padding.top;
    static double _botbarH = mediaQuery.padding.bottom;
    static double _pixelRatio = mediaQuery.devicePixelRatio;
    static var _ratio;
    static init(int number){
        int uiwidth = number is int ? number : 750;
        _ratio = _width / uiwidth;
    }
    static px(number){
        if(!(_ratio is double || _ratio is int)){Adapt.init(750);}
        return number * _ratio;
    }
    static onepx(){
        return 1/_pixelRatio;
    }
    static screenW(){
        return _width;
    }

this issue is caused by MediaQueryData.fromWindow(window).size.width. I will fix it later. the same issue here:https://github.com/flutter/flutter/issues/25827

o1298098 commented 4 years ago

this issue should be fixed now