resposiveness 1.0.0

Flutter Android iOS web

A Flutter package to deal with responsiveness along many device's resolution

Responsiveness #

A Flutter package to deal with the major screen's resolutions out there.

This package manages to adapt your UI to a responsive format defined by you/your designer on a project

Example #

Imagine your screen's dimensions got a resolution of 1920x1080, you'll need to adapt all your design screen to this resolution. You can with this package, just simply pass the height and width argument on designHeight and designWidth parameter.

double responsiveHeight(BuildContext context, double value,
    {double designHeight}) {
  final double _designHeight = designHeight ?? 736;
  final double _height = MediaQuery.of(context).size.height;
  final double _magicNumber = value / _designHeight;
  return _magicNumber * _height;
}

double responsiveWidth(BuildContext context, double value,
    {double designWidth}) {
  final double _designWidth = designWidth ?? 414;
  final double _width = MediaQuery.of(context).size.width;
  final double _magicNumber = value / _designWidth;
  return _magicNumber * _width;
}

Don't worry if you don't pass any argument, I've got your back with a default value for both height and width.

What about fontSize? #

We've got that too!

double responsiveFont(BuildContext context, double value, {double dividedBy}) {
  final double _magic = MediaQuery.of(context).size.width / (dividedBy ?? 400);
  return _magic * value;
}

Why using 400? Well, 400 was a number that we found when you devide your device's width by it, it returns almost 1.0. It's not exactly 1.0 but get close. That's the reason.

Don't worry, if you want to change it, just change.

Hope you enjoy!

2
likes
90
pub points
45%
popularity

A Flutter package to deal with responsiveness along many device's resolution

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

fellipedmmalta@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on resposiveness