Giter Site home page Giter Site logo

johnettphenomtec / scale Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abedalkareem/scale

0.0 0.0 0.0 1.19 MB

A flutter package to help you scale your design on bigger or smaller screens to achieve the same design look.

License: Other

Dart 100.00%

scale's Introduction

A flutter package to help you scale your design on bigger or smaller screens to achieve the same design look.

Screenshot

iPhone 8, iPhone X Max, iPad Pro 12.9

This screenshots from my app, it's available on AppStore and PlayStore

Usage

First of all, in your base widget setup Scale. So, if you have a design with 1280 * 720. You will pass first the context then the design size.

Scale.setup(context, Size(1280, 720));

Scale relative to height

Now to scale a number relative to screen height

final height = Scale.scaleVertically(50);

Or, you can use the extension

final height = 50.sv;

Scale relative to width

To scale a number relative to screen width

final width = Scale.scaleHorizontally(50);

Or, you can use the extension

final width = 50.sh;

Scale font

The font will be scaled relative to screen width, to do that:

final fontSize = Scale.scaleFont(17);

Or, you can use the extension

final fontSize = 17.sf;

Installing

Simply add the following line to your pubspec.yaml file:

dependencies:
  scale: any       # <-- Add this line

scale's People

Contributors

abedalkareem avatar johnettphenomtec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.