码迷,mamicode.com
首页 > 其他好文 > 详细

flutter 适配

时间:2020-01-21 18:05:44      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:fan   ica   ping   class   xxx   导入   pac   text   int   

代码:

ScreenUtil.instance = ScreenUtil(width: 750,height: 1334)..init(context);
print(‘设备像素密度:${ScreenUtil.pixelRatio}‘);
print(‘设备高度:${ScreenUtil.screenHeight}‘);
print(‘设备宽度:${ScreenUtil.screenWidth}‘);
return Container(
height: ScreenUtil().setHeight(333),
width: ScreenUtil().setWidth(750),
总结
 

//插件屏幕适配 flutter_screenutil

 

现在 pubspec.yaml 导入 flutter_screenutil

//初始化

ScreenUtil.instence = ScreenUtil(width:w,height:h)..init(context); //w 和 h  都是UI 按照什么尺寸设计的

 

 

  print(‘设备像素密度:${ScreenUtil.pixelRatio}‘);

    print(‘设备高度:${ScreenUtil.screenHeight}‘);

    print(‘设备宽度:${ScreenUtil.screenWidth}‘);

 

 

控件使用

xxx(

width :ScreenUtil().setWidth(www);

height:ScreenUtil().setHeight(hhh);

)

flutter 适配

标签:fan   ica   ping   class   xxx   导入   pac   text   int   

原文地址:https://www.cnblogs.com/pp-pping/p/12222500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!