flutter_flexui 0.1.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

Flutter FlexUI #

Flutter package for build Flexible UI for diference screens

Getting Started #

To use this package, add flutter_flexui as a dependency in your pubspec.yaml file.

dependencies:
  flutter_flexui: ^0.1.0+1

Using #

import 'package:flutter_flexui/flexui.dart';

Example #

FlexRow

  FlexRow(
    colLg: 6,
    colMd: 3,
    colSm: 1,
    colMainAxisAlignment: MainAxisAlignment.spaceEvenly,
    colVerticalDirection: VerticalDirection.down,
    colMainAxisSize: MainAxisSize.max,
    rowMainAxisAlignment: MainAxisAlignment.spaceAround,
    rowVerticalDirection: VerticalDirection.down,
    rowMainAxisSize: MainAxisSize.max,
    children: <Widget>[
      Text('1'),
      Text('2'),
      Text('3'),
      Text('4'),
      Text('5'),
      ],
  );

FlexText

  FlexText(
    "Test",
    styleSm: TextStyle(fontWeight: FontWeight.w200, fontSize: 12),
    styleMd: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
    styleLg: TextStyle(fontWeight: FontWeight.w900, fontSize: 22),
  );

FlexWidget

  FlexWidget(
    sm: Text("Small"),
    md: Text("Meddium"),
    lg: Text("Large"),
  );

Utils #

ScreenSize

  /// @Screen.XS (for phones - screens less than 768px wide)
  /// @Screen.SM (for tablets - screens equal to or greater than 768px wide)
  /// @Screen.MD (for small laptops - screens equal to or greater than 992px wide)
  /// @Screen.LG (for laptops and desktops - screens equal to or greater than 1200px wide)
  ScreenSize.screenSize(context);
  // Get height of status bar
  ScreenSize.statusBarHeight(context);
  // Get height of bottom bar
  ScreenSize.bottomBarHeight(context);
  // Get pixel ratio of screen
  ScreenSize.pixelRatio(context);
  // Get value by screen size
  ScreenSize.getValueByScreen(context, xsObject, smObject, mdObject, lgObject);

FlexUI

  // Returns true if the screen size is similar to a mobile device
  FlexUI.isMobile(context);

Authors #

This project developed by DipDev Studio Team: @Dimoshka

[0.1.0+1] - January 20, 2020. #

Fix getValueByScreen.

[0.1.0] - January 20, 2020. #

Refactoring.

[0.0.3] - January 17, 2020. #

Added new features.

[0.0.2] - January 13, 2020. #

Add FlexText widget.

[0.0.1+1] - January 13, 2020. #

Small fixes of description.

[0.0.1] - January 13, 2020. #

Init project!

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_flexui/flexui.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            FlexRow(
              colLg: 6,
              colMd: 3,
              colSm: 1,
              colMainAxisAlignment: MainAxisAlignment.spaceEvenly,
              colVerticalDirection: VerticalDirection.down,
              colMainAxisSize: MainAxisSize.max,
              rowMainAxisAlignment: MainAxisAlignment.spaceAround,
              rowVerticalDirection: VerticalDirection.down,
              rowMainAxisSize: MainAxisSize.max,
              children: <Widget>[
                FlexText(
                  'You have pushed the button this many times:',
                ),
                FlexText(
                  '$_counter',
                  style: Theme.of(context).textTheme.display1,
                ),
                FlexText(
                  "3",
                  styleSm: TextStyle(fontWeight: FontWeight.w200, fontSize: 12),
                  styleMd: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
                  styleLg: TextStyle(fontWeight: FontWeight.w900, fontSize: 22),
                ),
                FlexText("4"),
                FlexText(
                  "5",
                  styleSm: TextStyle(fontWeight: FontWeight.w200, fontSize: 12),
                  styleMd: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
                  styleLg: TextStyle(fontWeight: FontWeight.w900, fontSize: 22),
                ),
              ],
            ),
            FlexWidget(
              sm: Text(
                  "Is mobile device: ${FlexUI.isMobile(context).toString()}"),
              md: Text("Desktop version!"),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_flexui: ^0.1.0+1

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:flutter_flexui/flexui.dart';
import 'package:flutter_flexui/utils/screen_size.dart';
import 'package:flutter_flexui/widgets/flex_row.dart';
import 'package:flutter_flexui/widgets/flex_text.dart';
import 'package:flutter_flexui/widgets/flex_widget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
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]
76
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

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.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test