Flutter flutter_screenutil 实现屏幕适配

  1. 在pubspec.yaml文件导入:
    flutter_screenutil: ^0.6.0
  2. 初始化:   美工提供的UI设计尺寸ScreenUtil.instance = ScreenUtil(width: 1080, height: 2160)..init(context);
  3. 字体大小: Text( list[index].mallName, style: TextStyle(fontSize: ScreenUtil().setSp(24)), ),
  4. 适配屏幕尺寸:
    height: ScreenUtil().setHeight(80),
    width: ScreenUtil().setWidth(570),

 

 

 

       

 

 

 

           

 

你可能感兴趣的:(Flutter)