kg_density 0.0.1 copy "kg_density: ^0.0.1" to clipboard
kg_density: ^0.0.1 copied to clipboard

auto density util

Additional information #

TODO: Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.

kg_density #

Is a minimalist screen adaptation scheme, which can quickly help the developed project to adapt the screen

Getting started #

dependencies:
  kg_density: ^0.0.1

The following models are from the iPhone 5S

Before login adaptation

After login adaptation

Before chart page adaptation

After chart page adaptation

Before other pages fit

After other pages are adapted

Usage #

  1. Create flutterbinding

class MyFlutterBinding extends WidgetsFlutterBinding with KgFlutterBinding {

  static WidgetsBinding ensureInitialized() {
    if (WidgetsBinding.instance == null) MyFlutterBinding();
    return WidgetsBinding.instance!;
  }
}

  1. MaterialApp configuration

MaterialApp(
              theme: ThemeData(),
              builder: KgDensity.initSize(),

            );

  1. Configuration before startup

    void main() {
      ///初始化
      KgDensity.initKgDensity(375);
      MyFlutterBinding.ensureInitialized();
      ///运行
      runApp(App());
    }

Note:

  1. KgDensity.initSize(builder: ??)

In order to facilitate the configuration of other builders, other builders are specially added to the code

usage method

    builder: KgDensity.initSize(builder: EasyLoading.init()),

  1. KgDensity.initKgDensity(375)

Digital configuration is configured according to the narrowest side of the design manuscript

If you do not use kgdensity for adaptation, do not use init

  1. Get size correctly
    MediaQuery.of(context).size

Please do not use window physicalSize,MediaQueryData. fromWindow(window)

Additional information #

This code base is reconstructed with reference to its principle and part of the code. Thank you https://github.com/niezhiyang/flutter_autosize_screen

1
likes
70
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

auto density util

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on kg_density