flutter_screenutil-爱分乐赚

爱分乐赚网站开发是一个面向开发者的知识分享社区。这里集合了网站开发所需要用到的各类网站开发教程。包括(JavaScript 入门教程,TypeScript 入门教程,Vue 入门教程,Ajax 入门教程,ES6-10 入门教程,Yarn 入门教程,ECharts 入门教程,CSS3 入门教程,雪碧图入门教程,移动端布局教程,Html5 入门教程,Sass 入门教程,HTML 入门教程,uni-app 入门教程,Nginx 入门教程,HTTP 入门教程,Docker 入门教程,Shell 入门教程,Linux 入门教程,Gradle 入门教程,Vim 编辑器教程,RESTful 规范教程,Dreamweaver 教程,Markdown 入门教程,Maven 入门教程,Eclipse 编辑器教程,GitHub 入门教程,Android Studio 编辑器教程,PyCharm 编辑器教程,Sublime Text 使用教程,Postman 教程,Python 原生爬虫教程)

 

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-爱分乐赚
返回顶部

显示

忘记密码?

显示

显示

获取验证码

Close