responsive 0.2.3+4

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

responsive #

build status Pub support

Provide a easy way to make responsive UI for Flutter Applications in mobile, desktop and web, allow different widget size for each screen size and device orientation..

Made by Marvin Quevedo and Víctor Guardiola of FlutterEs Community.

Este paquete ha sido creado por la comunidad de Flutter en Español, si deseas ser parte de nosotros, puedes visitar cualquiera de estos links:

Facebook

Slack

Twitter

www.flutter-es.io

Telegram

portrait view

landscape view

Video example

Add dependency #

dependencies:
  responsive: 0.2.3+4

Usage #

You have two ways of use it:

You can use the ReponsiveRow widget and the FlexResponsive widget to make the layout

or

you can use the static method Responsive.calcColumns to assign the correct number of columns to a widget like a GridView.

Easy to use #

import 'package:flutter/material.dart';
import 'package:responsive/flex_widget.dart';
import 'package:responsive/responsive_row.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Responsive Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(),
        body: ListView(
          children: <Widget>[
            ResponsiveRow(
              columnsCount: 12,
              crossAxisAlignment: WrapCrossAlignment.center,
              children: <Widget>[
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.amber,
                  ),
                  xs: 4,
                  xsOffset: 2,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  xsLandOffset: 0,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.red,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.indigo,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.lime,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.teal,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.green,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.deepOrange,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.amber,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.grey,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.black,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.brown,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
                FlexWidget(
                  child: Container(
                    height: 100,
                    color: Colors.cyan,
                  ),
                  xs: 6,
                  sm: 3,
                  md: 2,
                  lg: 1,
                  xsLand: 4,
                  smLand: 2,
                  mdLand: 1,
                  lgLand: 1,
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}

[0.2.3+4] - adding export to responsive.dart file #

[0.2.3+3] - Healing package #

- little changes

[0.2.3+2] - Healing package #

- Maintantaince of package

[0.2.3] - Healing package #

[0.2.2] - cleaning help files #

[0.2.1] - cleaning help files #

[0.2.0] - New components #

-  Refactoring with some changes

[0.2.0] - New components #

- Refactoring with some name changes
- Add new Responsive class to calc Size, Offset or number of columns
- Redo example app and remove examples dir
- More documentation and add some media

[0.1.5] - Cleanup #

[0.1.4] - Refactoring of the FlexibleWidget #

[0.1.3] - Little change #

[0.1.2] - Very Changes #

- quit some logs

[0.1.1] - Very Changes #

- add documentation

[0.1.0] - Very Changes #

- add different configurations for landscape and portrait
- add Offset configurations.
- add Offsets for landscape and portrait too.

[0.1.0] - Very Changes #

- add different configurations for landscape and portrait
- add Offset configurations.
- add Offsets for landscape and portrait too.

[0.0.9] - Comments corrections #

- Little  corrections

[0.0.8] - Comments corrections #

[0.0.7] - Comments corrections #

- Little comments correct 

[0.0.5] - Example Readme correction #

[0.0.4] - Example Readme correction #

[0.0.3] - Example Readme correction #

[0.0.2] - Example Readme correction #

[0.0.1] - initial release #

- Allow to make responsive UI with Flutter easily

example/lib/main.dart

import 'package:flutter/foundation.dart' show debugDefaultTargetPlatformOverride;
import 'package:flutter/material.dart';

import 'flexibe_row_demo.dart';
import 'responsive_galery.dart';
import 'responsive_gridview.dart';

void main() {
  debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Responsive Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      routes: <String, WidgetBuilder>{
        '/flexiwidget': (BuildContext context) => FlexibleRowDemo(),
        '/gallery': (BuildContext context) => ResponsiveGallery(),
        '/gridview': (BuildContext context) => ResponsiveGridview(),
      },
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Responsive Demo App'),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              color: Colors.orangeAccent,
              onPressed: () {
                Navigator.of(context).pushNamed('/flexiwidget');
              },
              child: Text('Flexi Widget Demo'),
            ),
            RaisedButton(
              color: Colors.blueAccent,
              onPressed: () {
                Navigator.of(context).pushNamed('/gallery');
              },
              child: Text('Image Galery Demo'),
            ),
            RaisedButton(
              color: Colors.redAccent,
              onPressed: () {
                Navigator.of(context).pushNamed('/gridview');
              },
              child: Text('GridView Demo'),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  responsive: ^0.2.3+4

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

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [responsive] that is in a package requiring null.

Health suggestions

Fix lib/responsive_row.dart. (-0.50 points)

Analysis of lib/responsive_row.dart reported 1 hint:

line 195 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: Documenting responsive... Initialized dartdoc with 512 libraries in 89.9 seconds Generating docs for library flex_widget from package:responsive/flex_widget.dart... Generating docs for library responsive from package:responsive/responsive.dart... Generating docs for library responsive from package:responsive/responsive_row.dart... Validating docs... Documented 3 public libraries in 17.6 seconds stderr: warning: responsive has no library level documentation comments, from responsive: (file:///tmp/pub-dartlang-dartdocVWYYZM/pkg/lib/responsive_row.dart:5:9) error: failed to write file at: responsive/responsive-library.html for symbol responsive: (file:///tmp/pub-dartlang-dartdocVWYYZM/pkg/lib/responsive_row.dart:5:9) conflicting with file already generated by responsive: (file:///tmp/pub-dartlang-dartdocVWYYZM/pkg/lib/responsive.dart:1:1) Dartdoc generates a path and filename to write to for each symbol. responsive conflicts with another symbol in the generated path, and therefore can not be written out. Changing the name, library name, or class name (if appropriate) of one of the conflicting items can resolve the conflict. Alternatively, use the @nodoc tag in one symbol's documentation comments to hide it. found 1 warning and 1 error Unhandled exception: dartdoc encountered 1 errors while processing. #0 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:225:9)

Package is getting outdated. (-3.29 points)

The package was last published 53 weeks ago.

Dependencies

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