responsive_widgets 0.1.6

  • Readme
  • Changelog
  • Example
  • Installing
  • new83

Responsive Widgets #

pub package

This plugin helps to create responsive widgets, that makes a auto-size with the proportion between reference screen size (width, height and shortest side(dpi)) with the screen that the app is running. The package only changed the original widgets, like "Container" to apply a function that make this calculation.

Features #

Feature / Working withProgress
Android
iOS
Smartphones
5.5 inch screens
Vertical mode
Horizontal mode🔜
Tablet🔜
Tablet on vertical mode🔜
Tablet on horizontal mode🔜

Getting Started #

First of all you need to use the code ResponsiveWidgets().init(context) to make the plugin works. The code need to be placed on the first screen of the app, inside of the build method, like this: See also in code

class  _HomeScreenState  extends  State<HomeScreen> {
    @override
    Widget  build(BuildContext context) {
    
	    ResponsiveWidgets().init(context,
		    referenceHeight: 1920, // Optional
		    referenceWidth: 1080, // Optional
		    referenceShortestSide: 411 // Optional, default = 360
	    );
	    
	    return  Scaffold(
		    body: Container()
	    );
	}
}

ShortestSide is basically the dpi of the device, can be got by this code: MediaQuery.of(context).size.shortestSide; Or be changed in the device in Config>Developer Options>Drawing Section>ShortestSide.

Widgets #

ContainerResponsive #

ContainerResponsive(
    child: Widget,
    height: double, // Responsive wight
    heightResponsive: bool, // Enable/Disable Responsive height
    width: double, // Responsive width
    widthResponsive: , bool// Enable/Disable Responsive width
)

EdgeInsetsResponsive (Can be used in any widget with parameter padding) #

Padding(
    child: Widget,
    padding: EdgeInsetsResponsive.all(50), // EdgeInsets Responsive padding
)

IconResponsive #

IconResponsive(
    icon,
    size: double, // Responsive size
)

IconButtonResponsive #

IconButtonResponsive(
    icon: IconData,
	size: double, // Responsive size,
	onTap: (){}   
)

TextResponsive #

TextResponsive(
    text // Responsive fontSize
)

RaisedButtonResponsive #

RaisedButtonResponsive(
    child: Widget,
    onPressed: (){}
)

Function to recalculate size responsibly #

Have special cases that doesn't have Responsive Widgets created, one of this cases is the Positioned, to solve this problem is simple use this function: ResponsiveWidgets().getSize(double size) that will return the correct value to the screen.

Examples #

Mixed, responsive and normal, respectively #

Mixed, responsive and normal, respectively

Not responsive page #

Not responsive page

Responsive page #

Responsive page

0.1.0 #

  • This plugin helps to create responsive widgets, that makes a auto-size with the proportion between reference Screen Size and the screen that the app is running. The package only changed the original widgets, like "Container" to apply a function that make this calculation.

0.1.1 #

  • Changed description.

0.1.2 #

  • Readme updated.
  • Changed getSizeByDp() to getSize().

0.1.3 #

  • Readme updated.

0.1.4 #

  • Readme updated.
  • Repository url fixed.

0.1.5 #

  • Ios fixed.

0.1.6 #

  • Updated packages

example/README.md

responsive_widgets_example #

Demonstrates how to use the responsive_widgets plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  responsive_widgets: ^0.1.6

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:responsive_widgets/responsive_widgets.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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