sup 0.1.1

sup

A Flutter widget which displays an image, a title, and a subtitle for errors, empty states, or just fancy custom messages.

Getting Started #

Follow the installation instructions.

QuickSup #

Use QuickSup to quickly show standard errors and empty states, fast and easy.

Ideal for when you want to avoid spending time on your UI messages but want a bit more than a Text widget.

QuickSup.error(
  title: 'Nope',
  subtitle: 'That didn\'t work, son.',
  onRetry: () {},
);
QuickSup.empty(
  subtitle: 'No items in this list',
);

SupConfigurator #

If you want to customize, one place to do that is SupConfigurator.

This is an InheritedWidget that hosts a default SupConfig wherever you place it in your widget tree. Sup widgets then access the nearest SupConfigurator and render themselves accordingly.

MaterialApp(
  title: 'My App',
  home: SupConfigurator(
    defaults: SupConfig(
      alignment: SupAlignment.start,
    ),
    child: myAppContent
  ),
);

Sup.from (Config/Templates) #

If you are going to have different Sup configurations, such as specific errors, specific empty states, hints, etc., this is for you.

Define a SupConfig instance somewhere in your codebase, then pass it to Sup using Sup.from. That's all. You can pass specific override params too.

Sup.from(MySupConfigs.sendError);
Sup.from(
  MySupConfigs.noSearchResults,
  subtitle: 'No results found for $query',
);
Sup.from(MySupConfigs.notEnoughEncouragement);

Sup Constructor #

Finally, you can also just create a new Sup instance using the constructor.

Sup(
  image: Image(...),
  title: Text('Hey'),
  subtitle: Text('Welcome to the app'),
  ...
);

Configuration Priority #

The priority in which Sup applies configurations is the following:

  1. Package defaults (see SupDefaults)
  2. User defaults (SupConfigurator)
  3. Sup.from
  4. Sup parameters

License #

Copyright (C) 2019 İhsan Işık

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

GPL v3 (LICENSE)

[0.1.1] - December 16, 2019

Publish to update README

[0.1.0] - December 6, 2019

Initial release.

example/README.md

example #

Sup example app.

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:
  sup: ^0.1.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:sup/sup.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
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 Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

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

Analysis of lib/sup.dart reported 1 hint:

line 74 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: Sup._config

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

Analysis of lib/sup_configurator.dart reported 1 hint:

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <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