fm_fit 0.0.3 copy "fm_fit: ^0.0.3" to clipboard
fm_fit: ^0.0.3 copied to clipboard

A flutter plugin for adapting screen and font size.Let your UI display a reasonable layout on different screen sizes!

fm_fit #

A flutter plugin for adapting screen and font size. Let your UI display a reasonable layout on different screen sizes!

Usage: #

Add dependency: #

Please check the latest version before installation.

dependencies:
  fm_fit: ^0.0.2

Add the following imports to your Dart code: #

import 'package:fm_fit/fm_fit.dart';

Property #

    // 设计稿宽 The width of the device in the design draft, in px
    double width=750;

    // 缩放比例 scale
    double scale=1.0;

Function #

  • double t(double value)
  • EdgeInsets fromLTRB(double left, double top, double right, double bottom)
  • EdgeInsets all(double value)
  • EdgeInsets only({double left = 0.0,double top = 0.0,double right = 0.0,double bottom = 0.0})

Example #

import 'package:fm_fit/fm_fit.dart';
...
// init width, default 750
fit.init(width:750);
// usage 1:
SizedBox(height: fit.t(120.0))
// usage 2:
Container(
    margin: fit.only(top: 40.0),
    padding: fit.fromLTRB(30, 34, 30, 0),
    child: Text("test")
)
// usage 3:
Text(
    "test",
    textAlign: TextAlign.center,
    style: TextStyle(
        color: Colors.white,
        fontSize: fit.t(34),
        letterSpacing: fit.t(4),
        fontWeight: FontWeight.bold,
    ),
),
0
likes
20
pub points
35%
popularity

Publisher

unverified uploader

A flutter plugin for adapting screen and font size.Let your UI display a reasonable layout on different screen sizes!

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on fm_fit