pixel_fix

Last updated:

0 purchases

pixel_fix Image
pixel_fix Images
Add to Cart

Description:

pixel fix

pixel_fix #

Plugin for adapting Android and iOS screen size.
Usage: #
Add dependency: #
dependencies:
pixel_fix: ^0.0.1
copied to clipboard
Add import: #
import 'package:pixel_fix/pixel_fix.dart';
copied to clipboard
init: #
void main() {
InnerWidgetsFlutterBinding.initPixel(1242, 3);
}
copied to clipboard
use: #
void main() {
InnerWidgetsFlutterBinding.ensureInitialized()
..attachRootWidget(MyApp())
..scheduleWarmUpFrame();
}
copied to clipboard
原理:
​基于修改系统的缩放值来实现改变系统绘制的大小。
具体实现:
重写主要是createViewConfiguration这个方法
优缺点:
1、不能动态设置ratio值,即不能根据屏幕宽高和设计稿的比例获取真实比例(不能兼容不同设计稿)
2、用法简单:在使用是没有任何要求,与flutter原生相同。开发人员无感知
3、因为手动重写了gestures/binding.dart的一些方法,随着Flutter版本的升级,需要不断修改InnerWidgetsFlutterBinding的代码。

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.