super_widgets 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

Build Status Pub GitHub license

super_widgets #

Make Flutter widgets' code becomes shorter and richer.

This project is an attempt to combine multiple Flutter widgets into single widget - the single one will inherit almost all properties of the original widgets. For example, instead of creating a Stack with padding and color by having Container > Stack, we can use SuperStack.

Installation #

In your pubspec.yaml file within your Flutter Project:

dependencies:
  super_widgets: ^1.0.0

(Get latest version in Pub. See more information how to install this package in pubspec.dev)

Then import it:

import 'package:super_widgets/super_widgets.dart';

Widgets #

List of SuperWidgets is:

SuperStack #

Is the combination of Container > Stack

Before:

Container(
  color: Colors.blueAccent,
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.all(20),
  alignment: Alignment.bottomCenter,
  child: Stack(
    fit: StackFit.loose,
    alignment: Alignment.centerRight,
    children: <Widget>[
      Container(color: Colors.red, width: 200, height: 200),
      Container(color: Colors.green, width: 100, height: 100),
      Text('SuperStack demo'),
    ],
  ),
)

After

SuperStack(
  color: Colors.blueAccent,
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.all(20),
  alignment: Alignment.bottomCenter,
  childAlignment: Alignment.centerRight,
  fit: StackFit.loose,
  children: <Widget>[
    Container(color: Colors.red, width: 200, height: 200),
    Container(color: Colors.green, width: 100, height: 100),
    Text('SuperStack demo'),
  ],
)

SuperIndexedStack #

Is the combination of Container > IndexedStack

SuperIndexedStack(
  color: Colors.blueAccent,
  padding: EdgeInsets.all(20),
  alignment: Alignment.bottomCenter,
  childAlignment: Alignment.centerRight,
  sizing: StackFit.loose,
  index: 1,
  children: <Widget>[
    Container(color: Colors.red, width: 200, height: 200),
    Container(color: Colors.green, width: 100, height: 100),
    Text('SuperStack demo'),
  ],
)

SuperRow #

Is the combination of Container > Row

SuperRow(
  color: Colors.grey,
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.all(5),
  height: 300,
  alignment: Alignment.centerRight,
  childKey: Key('SuperRow'),
  mainAxisAlignment: MainAxisAlignment.spaceAround,
  mainAxisSize: MainAxisSize.max,
  crossAxisAlignment: CrossAxisAlignment.stretch,
  children: <Widget>[
    Container(color: Colors.red, width: 50),
    Container(color: Colors.green, width: 100),
    Container(color: Colors.blue, width: 75),
  ],
)

SuperColumn #

Is the combination of Container > Column

SuperColumn(
  color: Colors.grey,
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.all(5),
  width: 300,
  alignment: Alignment.centerRight,
  childKey: Key('SuperColumn'),
  mainAxisAlignment: MainAxisAlignment.spaceAround,
  mainAxisSize: MainAxisSize.max,
  crossAxisAlignment: CrossAxisAlignment.stretch,
  children: <Widget>[
    Container(color: Colors.red, height: 50),
    Container(color: Colors.green, height: 100),
    Container(color: Colors.blue, height: 75),
  ],
)

SuperRaisedButton #

Is the combination of Container > RaisedButton

SuperRaisedButton(
  color: Colors.grey[200],
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.all(10),
  width: 200,
  height: 60,
  alignment: Alignment.centerRight,
  childKey: Key('SuperRaisedButton'),
  onPressed: () {
    print('Touch on SuperRaisedButton');
  },
  childText: Text(
    'Support us!',
    style: TextStyle(fontSize: 18, color: Colors.red, fontWeight: FontWeight.bold),
  ),
)

SuperIcon #

Is the combination of Container > Icon

SuperIcon(
  color: Colors.grey[300],
  margin: EdgeInsets.all(10),
  padding: EdgeInsets.only(right: 20),
  alignment: Alignment.centerRight,
  childKey: Key('SuperIcon'),
  childColor: Colors.red,
  icon: Icons.backup,
  size: 80,
)

SuperText #

Is the combination of Container > Text

  • Normal text
SuperText(
  padding: EdgeInsets.all(10),
  textData: 'SuperText',
  color: Colors.green,
  style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.pink),
)
  • Text with Span
SuperText(
  margin: EdgeInsets.all(5),
  style: TextStyle(fontSize: 16, fontWeight: FontWeight.w900, color: Colors.black),
  textSpan: TextSpan(children: [
    TextSpan(
      text: 'Super ',
    ),
    TextSpan(
      text: 'Text Span',
      style: TextStyle(color: Colors.blue, fontSize: 24),
    ),
  ]),
  color: Colors.yellow,
)

SuperInkWell #

Is the combination of InkWell > Container

SuperInkWell(
  padding: EdgeInsets.all(10),
  width: 200,
  height: 50,
  alignment: Alignment.center,
  childText: Text(
    'SuperInkWell with size',
    style: TextStyle(fontSize: 16),
  ),
),

SuperScrollViewContainer #

Is the combination of SingleChildScrollView > Container

SuperScrollViewContainer(
  color: Colors.grey[300],
  padding: EdgeInsets.all(10),
  child: Text(
    'This\n\nis\n\nSuper\n\nScroll\n\nView'
    '\n\nContainer\n\nvertical\n\npage',
    style: TextStyle(
      fontSize: 24,
      fontWeight: FontWeight.bold,
      color: Colors.red,
    ),
  ),
),

SuperScrollViewColumn #

Is the combination of SingleChildScrollView > Column

var textStyle = TextStyle(fontWeight: FontWeight.bold, fontSize: 48);
SuperScrollViewColumn(
  crossAxisAlignment: CrossAxisAlignment.start,
  padding: EdgeInsets.all(10),
  children: <Widget>[
    Text('This', style: textStyle),
    Text('...', style: textStyle),
    Text('is', style: textStyle),
    Text('...', style: textStyle),
    Text('the', style: textStyle),
    Text('...', style: textStyle),
    Text('Super', style: textStyle),
    Text('...', style: textStyle),
    Text('ScrollView', style: textStyle),
    Text('...', style: textStyle),
    Text('Column', style: textStyle),
    Text('...', style: textStyle),
    Text('demo', style: textStyle),
  ],
);

SuperScrollViewRow #

Is the combination of SingleChildScrollView > Row

var textStyle = TextStyle(fontWeight: FontWeight.bold, fontSize: 32);
SuperScrollViewRow(
  crossAxisAlignment: CrossAxisAlignment.start,
  padding: EdgeInsets.all(10),
  children: <Widget>[
    Text('This', style: textStyle),
    Text('...', style: textStyle),
    Text('is', style: textStyle),
    Text('...', style: textStyle),
    Text('the', style: textStyle),
    Text('...', style: textStyle),
    Text('Super', style: textStyle),
    Text('...', style: textStyle),
    Text('ScrollView', style: textStyle),
    Text('...', style: textStyle),
    Text('Row', style: textStyle),
    Text('...', style: textStyle),
    Text('demo', style: textStyle),
  ],
);

Example #

A sample app can be found in the example/ folder.

Authors #

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased] #

1.0.0 - First stable release - Aug 8, 2019 #

Added #

  • Introduce new widgets: SuperInkWell, SuperScrollViewContainer, SuperScrollViewColumn and SuperScrollViewRow

0.2.0 - Aug 2, 2019 #

Added #

  • Introduce new widgets: SuperIcon, SuperText and SuperRaisedButton

0.1.0 - Jul 31, 2019 #

Added #

  • Introduce new widgets: SuperIndexedStack, SuperRow and SuperColumn
  • Add widget testing for all widgets

Changed #

  • Now all widgets extend Container instead our own SuperBaseContainer

0.0.1 - Jul 27, 2019 #

Added #

  • First release with SuperStack widget.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'super_column_page.dart';
import 'super_icon_page.dart';
import 'super_indexed_stack_page.dart';
import 'super_inkwell_page.dart';
import 'super_raised_button_page.dart';
import 'super_row_page.dart';
import 'super_scrollview_column_page.dart';
import 'super_scrollview_container_page.dart';
import 'super_scrollview_row_page.dart';
import 'super_stack_page.dart';
import 'super_text_page.dart';

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

/// This widget is the root of your application.
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter SuperWidgets Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

/// Main page with list of entries inside
class MyHomePage extends StatelessWidget {
  /// List of <screen name, widget name>
  final Map<String, Widget> mapScreens = {
    'SuperStack': SuperStackPage(),
    'SuperIndexedStack': SuperIndexedStackPage(),
    'SuperRow': SuperRowPage(),
    'SuperColumn': SuperColumnPage(),
    'SuperRaisedButton': SuperRaisedButtonPage(),
    'SuperIcon': SuperIconPage(),
    'SuperText': SuperTextPage(),
    'SuperInkWell': SuperInkWellPage(),
    'SuperScrollViewContainer': SuperScrollViewContainerPage(),
    'SuperScrollViewColumn': SuperScrollViewColumnPage(),
    'SuperScrollViewRow': SuperScrollViewRowPage(),
  };

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter SuperWidgets Demo'),
      ),
      body: Center(
        child: ListView.builder(
          itemCount: mapScreens.length,
          itemBuilder: (BuildContext context, int index) {
            final title = mapScreens.keys.elementAt(index);
            return ListTile(
              title: Text(title, style: TextStyle(fontSize: 16)),
              onTap: () {
                print('MyHomePage: click on: $index: $title');
                gotoScreen(context, mapScreens[title]);
              },
            );
          },
          padding: EdgeInsets.all(10),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          print('Touch on FAB');
        },
        tooltip: 'Info',
        child: Icon(Icons.info),
      ),
    );
  }

  /// Go to destination screen (widget)
  void gotoScreen(BuildContext context, Widget screen) {
    Navigator.push(
      context,
      MaterialPageRoute<Widget>(builder: (context) => screen),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  super_widgets: ^1.0.0

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:super_widgets/super_widgets.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
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]
67
Learn more about scoring.

We analyzed this package on Apr 4, 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
pedantic ^1.4.0