Flutter plugin for auto resize widgets to get then "responsives".

Overview

Responsive Widgets

pub package

This plugin helps to create responsive widgets, that makes auto-size with the proportion between reference screen size (width, height) 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.

Important notes

Since the version 2.0.0, we started to use the package ScreenUtils (flutter_screenutils) to calculate all, have so many breaking changes, so if you used this package on the past, you will need stop using ResponsiveWidgets.getSize() and use the ScreenUtils that is inside of this package. For more informations about the use of this package, view the original docs of the package: https://pub.dev/packages/flutter_screenutil.
Basically now this package turned in a helper of this other package, helping to use more fast in the widgets and helping with the web version using the LayoutBuilder automatically when used ResponsiveWidgets.builder()

If you want use the previous version of the package, use the version 1.1.0 and in your pubspec.yaml: responsive_widgets: 1.1.0

Features

Feature / Working with Progress
Android
iOS
Smartphones
5.5 inch screens
Vertical mode
Horizontal mode
Tablet
Tablet on vertical mode
Tablet on horizontal mode
Support for web

Getting Started

First of all you need to use the code ResponsiveWidgets.init(context) to make the plugin works. Use ResponsiveWidgets.builder(child: ), to recalculate the proportion every time the sizes of device changes. Inclusive when the device turned to left/right... 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,
		    height: 1920, // Optional
		    width: 1080, // Optional
			allowFontScaling: true, // Optional
	    );
	    
	    return  ResponsiveWidgets.builder(
			height: 1920, // Optional
		    width: 1080, // Optional
			allowFontScaling: true, // Optional
	        child: Scaffold(
                    body: Container()
                ),
	    );
	}
}

Widgets

ContainerResponsive

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

SizedBoxResponsive

SizedBoxResponsive(
    child: Widget,
    height: double, // Responsive height
    width: double, // Responsive width
)

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

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

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 that will return the correct value to the screen.


------- Copyed from flutter_screenutils docs. --------

Pass the px size of the design draft:

Adapted to screen width: ScreenUtil().setWidth(540),

Adapted to screen height: ScreenUtil().setHeight(200),

If your dart sdk>=2.6, you can use extension functions:

example:

instead of :

Container(
width: ScreenUtil().setWidth(50),
height:ScreenUtil().setHeight(200),
)

you can use it like this:

Container(
width: 50.w,
height:200.h
)

Adapter font:

//Incoming font size,the unit is pixel, fonts will not scale to respect Text Size accessibility settings
//(AllowallowFontScaling when initializing ScreenUtil)
ScreenUtil().setSp(28)    
     
//Incoming font size,the unit is pixel,fonts will scale to respect Text Size accessibility settings
//(If somewhere does not follow the global allowFontScaling setting)
ScreenUtil().setSp(24, allowFontScalingSelf: true)

//for example:

Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                    'My font size is 24px on the design draft and will not change with the system.',
                    style: TextStyle(
                      color: Colors.black,
                      fontSize: ScreenUtil().setSp(24),
                    )),
                Text(
                    'My font size is 24px on the design draft and will change with the system.',
                    style: TextStyle(
                        color: Colors.black,
                        fontSize: ScreenUtil()
                            .setSp(24, allowFontScalingSelf: true))),
              ],
            )

------- End of copy --------


Examples

Mixed, responsive and normal, respectively

Mixed, responsive and normal, respectively

Not responsive page

Not responsive page

Responsive page

Responsive page

You might also like...

A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

flutter_carousel_widget A customizable carousel slider widget in Flutter. Features Infinite Scroll Custom Child Widget Auto Play Horizontal and Vertic

Nov 26, 2022

An HTTP file downloader packed with many features - resumable downloads, multiple connections, buffering, auto-retry, etc.

An HTTP file downloader packed with many features - resumable downloads, multiple connections, buffering, auto-retry, etc. Features Resumable downloa

Feb 2, 2022

Demo app with continuous integration setup for auto across android/iOS app stores

demo_flutter_ci A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Dec 25, 2021

Auto route lib - Personal customized use to increase CupertinoRoute transition duration

Auto route lib - Personal customized use to increase CupertinoRoute transition duration , auto route 1.0.0-beta.10 base, so i have to reupload from .pub-cache instead fork it

Jan 4, 2022

This is a mostly auto-generated library for using the mattermost api from Dart.

Mattermost API Client in Dart This is an implementation of a Mattermost API client in dart. It is not the only one, but it has significant advantages

Jun 15, 2022

Asset manager helps you auto-generate the assets code and add it to your pubspec.yaml .

Asset manager helps you auto-generate the assets code and add it to your pubspec.yaml .

Asset Manager Asset manager helps you auto-generate the assets code and add it to your pubspec.yaml . Quick start dart pub global activate asset_manag

Nov 1, 2022

SurrealDB client written in pure dart. auto reconnect, typed functions

SurrealDB Client For Dart & Flutter SurrealDB client for Dart and Flutter. Quick Start import 'package:surrealdb/surrealdb.dart'; void main(ListStri

Dec 18, 2022

Recipes app in flutter using API to get data. Amazing Recipes app UI in Flutter using dart with simple widgets.

Recipes app in flutter using API to get data. Amazing Recipes app UI in Flutter using dart with simple widgets.

Food Recipe App In Flutter Using API'S Recipe App in Flutter Subscribe Our YouTube Channel. Visit Website Demo OutPut Images ## 🔗 Links Getting Start

Dec 26, 2022

A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.

A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.

photo_manager Photo/Assets management APIs for Flutter without UI integration, you can get assets (image/video/audio) from Android, iOS and macOS. 提供相

Jan 4, 2023
Comments
  • 2.0.0 breaks ui drastically

    2.0.0 breaks ui drastically

    Hi,

    It was good library before 2.0.0 now you have removed IconResponsive and getSize method too and after changing the library version in my project the ui looks very smaller than before.

    May i know the reason for such drastic changes?

    opened by Faiyyaz 2
  • Please upgrade to null-safety

    Please upgrade to null-safety

    I'm running Flutter with these information:

    Flutter 2.0.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 4d7946a68d (11 days ago) • 2021-03-18 17:24:33 -0700 Engine • revision 3459eb2436 Tools • Dart 2.12.2

    Please take time to migrate your package that supports null-safety. Thank you so much!

    opened by the-great-tao 0
  • BoxConstraints NaN issue

    BoxConstraints NaN issue

    I am getting NaN error on app start if the device is locked while installing the build via adb.

    ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    The following assertion was thrown building RawMaterialButton(dirty, state:
    _RawMaterialButtonState#77fbf):
    BoxConstraints has NaN values in maxWidth and maxHeight.
    The offending constraints were:
      BoxConstraints(0.0<=w<=NaN, 0.0<=h<=NaN; NOT NORMALIZED)
    
    The relevant error-causing widget was:
      RawMaterialButton
      file:///home/faiyyaz/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/responsive_widgets-2.0.1/lib/widgets/raised_button_responsive_widget.dart:165:12
    

    and this is how i see the UI on mobile Screenshot_2020-09-17-10-07-19-46_bfec114022d4ec32295108acb110ca7d

    opened by Faiyyaz 2
Releases(2.0.0)
  • 2.0.0(Mar 30, 2020)

    • Improved all Widgets and removed all unnecessary codes
    • Added SizedBoxResponsive
    • Breaking changes:
      • Changed the calculation of responsiveness to use the flutter_screenutils.
      • Removed ResponsiveWidgets.getSize()
      • IconResponsive and IconButtonResponsive excluded, because Screen utils does not support(Will be reviewed this question)
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Mar 30, 2020)

    Breaking change: Fixed imports to be only one: import 'package:responsive_widgets/responsive_widgets.dart';, all other imports won't work more

    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Mar 30, 2020)

Owner
Lucas Henrique Polazzo
Mobile developer in love with Flutter! https://gitlab.com/LucazzP
Lucas Henrique Polazzo
A Flutter plugin to rotate, resize, move, delete text, photo or any other widget.

sticker_view A Flutter plugin to rotate, resize, move, delete any text, image or any other widget. Available Features ✅ Rotate ✅ Resize ✅ Move ✅ Layer

Gopal Dhola 14 Nov 26, 2022
A Flutter plugin for fetching Firestore documents with read from cache first then server.

Firestore Cache A Flutter plugin for fetching Firestore documents with read from cache first then server. This plugin is mainly designed for applicati

null 22 Nov 24, 2022
Access app version and git informations from auto-generated and configurable widgets

This is a proof of concept and WIP Feedback and ideas welcome !! Access your pubspec and git commit informations like versions and commit status from

Robert Felker 15 Jul 7, 2021
A flutter package uses native implementations to resize an image

fast_image_resizer This package uses native implementations to resize an image.

Soeren Schoenbrod 0 Dec 20, 2021
A flutter app for image and text, rotate, resize and flip

image_demo A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

null 0 Jan 4, 2022
ABC of Flutter widgets. Intended for super beginners at Flutter. Play with 35+ examples in DartPad directly and get familiar with various basic widgets in Flutter

Basic Widgets Examples This is aimed for complete beginners in Flutter, to get them acquainted with the various basic widgets in Flutter. Run this pro

Pooja Bhaumik 815 Jan 3, 2023
Learn how to build a tensorflow model on Techable Machine and then run it on flutter app.

Ml With Flutter Learn how to build a tensorflow model on Techable Machine and then run it on flutter app. Youtube Tutorial Show Support Recommend Me O

Sanskar Tiwari 133 Jan 3, 2023
From then on, developers only need to master one Button component, which is enough.

FButton From then on, developers only need to master one Button component, which is enough. Support corners, borders, icons, special effects, loading

Fliggy Mobile 198 Nov 22, 2022
Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation with a minimum password strength required.

password_strength_checker Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation wit

Dario Varriale 6 Aug 8, 2023