tango 0.1.2+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Tango #

Tango is a flexible build configuration tool that is the perfect partner for your Flutter project. Setup different build variants like paid/free or development/production. Tango handles copying of files, scaling images for different screen resolutions. It makes it super easy to swap out app icons for different build or provide different provisioning files for various distributions.

Tango is 100% written in Dart and should be easy to extend for your needs.

Install #

pub global activate tango

Quick Start #

This creates and runs a new Flutter project with example build configurations.

  • Requires Flutter and Tango installed
flutter create tango_quick_start
cd tango_quick_start
tango --quickstart
tango quick
flutter run

Getting Started #

In your flutter project create json configuration file that tango operate on. The current features are

Copy and Scale:

  • copied - Map of destination location to source location. Path relative to source and destination folder
  • scaledImages - Map of destination location to source location. Path relative to source and destination folder

Platform assets: (Path to image relative to source folder)

  • iosConfig
    • iconImage
    • launchImage
  • androidConfig
    • iconImage
    • launchImage
    • notificationImage
  • macConfig
    • iconImage

Example #

For organizational purposes it is helpful to place your tango variants into a subfolder in you flutter project.

Flutter_Project
 -tango
  -MyApp
   -images
    my_app_image.png
   -lib
    my_app_constants.dart
   -my_app.json
  -YourApp
   -images
    your_app_image.png
   -lib
    your_app_constants.dart
   -your_app.json
{
    "copied": {
        "lib/constants.dart":"files/file1.dart",
        "lib/theme.dart":"files/file2.dart"
    },
    "scaledImages": {
        "assets/logo.jpg":"images/tango.png"
    },
    "iosConfig": {
        "launchImage": "images/tango_launch.png",
        "iconImage": "images/tango_icon.png"
    },
    "androidConfig": {
        "launchImage": "images/tango_launch.png",
        "iconImage": "images/tango_icon.png",
        "notificationImage": "images/tango_notification.png"
    }
}

Usage #

In your flutter project

>tango -s <source_path> <config_name.json>

There are many ways you can setup your project to take advantage of tango. For example:

>tango -s ./variants/halloween_theme base_app.json free_app.json dev_options.json
>tango -s ./variants/chistmas_theme base_app.json paid_app prod_options.json

Add Tango Yaml #

To simplyfy the command line tango can take a yaml file as imput to point it to the source and config files. Take a look at the example. Now the build variants can be setup in the tango.yaml file and the input is the build variant.

>tango free_app
>tango paid_app

0.1.2+1 #

  • Update Readme

0.1.2 #

  • Add quick start

0.1.1 #

  • Fix executable
  • Adds quick start

0.1.0 #

  • Initial release

example/lib/main.dart

import 'package:flutter/material.dart';

import 'constants.dart';

final constants = AppConstants();

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

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

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

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

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

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

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate tango

2. Use it

The package has the following executables:


$ tango

Use this package as a library

1. Depend on it

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


dependencies:
  tango: ^0.1.2+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:tango/tango.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
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]
50
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

47 out of 47 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format bin/tango.dart.

Run dartfmt to format bin/tango.dart.

Format lib/quick_start.dart.

Run dartfmt to format lib/quick_start.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
args ^1.5.2 1.6.0
image ^2.1.12 2.1.12
yaml ^2.2.0 2.2.0
Transitive dependencies
archive 2.0.13
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
meta 1.1.8
path 1.6.4
petitparser 3.0.2
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
xml 3.7.0 4.1.0
Dev dependencies
mockito ^4.1.1
pedantic ^1.9.0
test ^1.6.0