Code Monkey home page Code Monkey logo

responsive_helper's Introduction

responsive_helper

ResponsiveHelper package helps you to make your Flutter app responsive. Just import the package and then use it to make your app responsive.

Usage

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Wrap with LayoutBuilder: It will give us the screen height and width
    return LayoutBuilder(
      builder: (context, constraints) {
        // Wrap with OrientationBuilder if you want your app to be landscape and portrait:
        return OrientationBuilder(
          builder: (context, orientation) {
            // Initialize the ResponsiveHelper
            ResponsiveHelper().init(constraints, orientation);
            return MaterialApp(
              theme: AppTheme.theme,
              title: 'ResponsiveHelper Package Examples',
            );
          },
        );
      },
    );
  }
}
  - use textSizeMultiplier to set the Text size
  - use imageSizeMultiplier to set the Image and Icon size
  - use heightMultiplier to set height size
  - use widthMultiplier to set weight size

  Example:
    If you want to set the text size to 28
    Divide 28 to 7.9 (because it's text, so we use 'Vertical Block Size')
    and then multiply it to textSize Multiplier
    Or
    If you want to set the width to 200
    Divide 200 to 4.1 (because it's horizontal, so we use 'Horizontal Block Size')
    and then multiply it to imageSizeMultiplier or widthMultiplier

if you need more examples, See setSizeExample.dart.

Notice: In this example I used Google Pixel 3 XL as the main device to config the block sizes.So the Vertical Block Size: 7.9 and the Horizontal Block Size: 4.1 is. But, you can use any devices you want.

responsive_helper's People

Contributors

yrlp98 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.