resposiveness 1.0.0

  • Readme
  • Changelog
  • Installing
  • 60

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!

[1.0.0] - 26/02/2020. #

  • Initial release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  resposiveness: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:resposiveness/resposiveness.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and resposiveness.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test