flutter_screenutil
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'dart:ui'; main()=>runApp(MaterialApp(
home: MyApp(),
)); class MyApp extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return MyAppState();
}
} class MyAppState extends State<MyApp> { c(DragDownDetails x){
var a = 750 * x.globalPosition.dx/350.0;
var b = 1334 * x.globalPosition.dy/672;
print('a:$a, b:$b');
} @override
Widget build(BuildContext context) { print(MediaQuery.of(context).size);
ScreenUtil.instance = ScreenUtil(width: 750, height: 1334, allowFontScaling: true)..init(context);
var t = MediaQuery.of(context).padding.top;
print('t: $t'); var s = ScreenUtil.statusBarHeight;
print('s: $s'); var wx = window.physicalSize;
print('wx: $wx'); var wp = window.padding;
print('wp: $wp'); var ss = window.devicePixelRatio;
print('ss: $ss'); var su = ScreenUtil.pixelRatio;
print('su: $su'); return Scaffold(
// appBar: AppBar(title: Text('abc'),),
body: Container(
width: ScreenUtil().setWidth(750.0),
height: ScreenUtil().setHeight(1334),
color: Colors.red,
child: GestureDetector(
onPanDown: (v){
c(v);
},
child: Text('HELLO', style: TextStyle(color: Colors.white),),
),
),
);
}
}
flutter_screenutil的更多相关文章
- flutter插件汇总2
作者:知乎用户链接:https://www.zhihu.com/question/307594373/answer/568969429来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载 ...
- flutter插件汇总
audio_recorder: any #录音.播放 flutter_sound: ^#录音 dropdown_menu: ^#下拉菜单 simple_permissions:#权限获取 easy_a ...
- flutter 列表展示
内容: 1.列表展示 2.轮播图 3.其他 本次的内容也是在上一节的基础上进行操作 我们就搞这个story模块. 目录: story.dart story主页面 import 'package:fl ...
- flutter屏幕适配
现在的手机品牌和型号越来越多,导致我们平时写布局的时候会在个不同的移动设备上显示的效果不同, 比如我们的设计稿一个View的大小是300px,如果直接写300px,可能在当前设备显示正常,但到了其他设 ...
- flutter 常用插件
audio_recorder: any #录音.播放 flutter_sound: ^1.1.5#录音 dropdown_menu: ^1.1.0#下拉菜单 simple_permissions:#权 ...
- Flutter实战视频-移动电商-34.列表页_小BUG的修复
34.列表页_小BUG的修复 当高粱酒的子类没有数据返回的时候就会报错. 解决接口空数据报错的问题 没有数据的时候,给用户一个友好的提示, 我们没有数据的时候还要告诉用户,提示一下他没有数据,在我们的 ...
- Flutter实战视频-移动电商-11.首页_屏幕适配方案讲解
11.首页_屏幕适配方案讲解 国人写的屏幕适配插件: https://github.com/OpenFlutter/flutter_screenutil 最新版本是0.5.1 在pubspec.yam ...
- Flutter实战视频-移动电商-12.首页_GridView类别导航制作
12.首页_GridView类别导航制作 首页导航区的制作 外面用一个gridview来写.里面单独提出来 新建导航组件 还是在home_page.dart里面写代码 新建一个静态的组件: 快捷键写组 ...
- Flutter实战视频-移动电商-13.首页_广告Banner组件制作
13.首页_广告Banner组件制作 主要是做这个小广告条. 其实就是读取一个图片做一个widget放到这里 使用stlessW快速生成 定义一个变量存放图片的url地址: 这样我们的广告条就写完了 ...
随机推荐
- ubuntu下Vim安装失败
sudo apt-get install vim Reading package lists... Done Building dependency tree Reading state inform ...
- 织梦Dedecms后台登陆密码忘记怎么办?
有时候长期不登陆后台或则初次建站的新手常常忘记后台登陆密码,不过不用着急,早就有人写好了密码重设工具. 下载解压为radminpass.php, 通过FTP传到网站根目录,然后访问 http:// ...
- pyzbar 安装
什么是ZBar? ZBar是一个开源库,用于扫描.读取二维码和条形码.支持的二维码包括:EAN/UPC,QR等. 1.windows 下直接pip 安装: pip install pyzbar 2.u ...
- 【Laravel基础】laravel基础之相关概念,自定义服务提供者:Contracts, ServiceContainer, ServiceProvider, Facades关系
Contracts, ServiceContainer, ServiceProvider, Facades关系 概念 Contracts 合同,契约,也就是接口,定义一些规则,每个实现此接口的都要实现 ...
- vmware ubuntu16 启动蓝屏屏幕闪
vmware ubuntu16 启动蓝屏屏幕闪 虚拟机安装了ubuntu16 desktop,没有关闭自动更新: 结果关机虚拟机时出现等5秒更新,类似win10关机更新: 再开机发现就蓝屏了,多次重启 ...
- deformable conv
在原feature map上经过卷积生成与原feature map一样w.h大小的feature map,但是channel变为2倍,即2N.2N代表的是每个像素x.y两个方向的偏移量. 这个偏移量生 ...
- VUE-012-图表 v-charts 学习(一)饼图展示状态
软件质量平台中需要输出各种各样的图表数据,以 v-charts 中的饼图为例,记录图表使用实现过程. v-charts :https://github.com/ElemeFE/v-charts doc ...
- 关于怎么提取m3u8地址
摘自: https://blog.51cto.com/4373601/1920758 很长时间没有写博客了,这一段时间比较忙,接下来的日子要坚持写博客了,后期抽空会把这一年多的测试心得补上来,写博客其 ...
- 【NPDP笔记】第五章 工具与度量
5.1 创意工具 Ideation 创意开发 创意工具 Scamper Substitute Combine Adapter Modify Put to another use Eliminate ...
- Windows Server 2008 R2 IIS7.5配置FTP图文教程
本文为大家分享了IIS 配置FTP 网站的具体过程,供大家参考,具体内容如下 说明:服务器环境是Windows Server 2008 R2,IIS7.5. 1. 在 服务器管理器的Web服务器(II ...