styled 0.0.9 copy "styled: ^0.0.9" to clipboard
styled: ^0.0.9 copied to clipboard

A declarative UI tool to simplify the creation of flutter widgets. Pass arguments in positional and without order.

Styled #

pub.dev License Build Status Styled in Github

Features #

A declarative UI tool to simplify the creation of flutter widgets. Pass arguments in positional and without order.

Use this package as a library #

Depend on it #

Run this command:

With Flutter:

 $ flutter pub add styled

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  styled: "^0.0.9"

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it #

Now in your Dart code, you can use:

import 'package:styled/styled.dart';

For help getting started with Flutter, view the online documentation.

Usage #

  • For supported widgets, add a suffix 'd' to the widget name to use the simplified version of it.
  • Named arguments will override positional ones.

For example:

return Scaffoldd(
    AppBard(
      Theme.of(context).colorScheme.inversePrimary,
      Textd(widget.title),
    ),
    Centerd(
      Columnd(
        MainAxisAlignment.center,
        <Widget>[
          Textd('You have pushed the button this many times:'),
          Textd('$_counter'),
          Textd("TextD", 26, 12.5, FontWeight.bold, Colors.red),
        ],
      ),
    ),
    FloatingActionButtond(
        _incrementCounter,
        'Increment',
        const Icon(Icons.add),
    ),
  );

Explained version:

return Scaffoldd(
    AppBard( // `AppBar` => 'appBar' of Scaffold
      Theme.of(context).colorScheme.inversePrimary, // `Color:0` => 'backgroundColor'
      Text(widget.title), // `Widget` => 'title'
      title: Textd("named argument overrides positional one", 20,
          const Color.fromARGB(255, 33, 211, 71)), // override 'title' with named argument
      ),
    ),
    Centerd( // `Widget` => 'body' of Scaffold
      Columnd( // `Widget` => 'child' of Center
        MainAxisAlignment.center,
        <Widget>[ // type of `List<Widget>` => 'children' of Column
          const Text('You have pushed the button this many times:'),
          Textd('$_counter'),
          Textd(
            "TextD", // `String` => text to display
            26,   // 1st of type `int|double` => 'fontSize'
            12.5, // 2nd of type `int|double` => 'letterSpacing'
            FontWeight.bold,
            FontStyle.italic,
            // 1st of type `Color` => 'color'
            Colors.red,
            // 2nd of type `Color` => 'backgroundColor'
            const Color.fromARGB(255, 55, 101, 228),
            // 3rd of type `Color` => 'decorationColor'
            const Color.fromARGB(255, 226, 223, 33),
            // use enum:TextMaxLines to set maxlines
            TextMaxLines.three,
            // override `backgroundColor` with named argument
            backgroundColor: Colors.greenAccent,
          ),
        ],
      ),
    ),
    FloatingActionButtond( // => 'floatingActionButton' of Scaffold
        _incrementCounter,     // `void Function()` => 'onPressed' 
        'Increment',           // `String` => 'tooltip'
        const Icon(Icons.add), // `Widget` => 'child'
    ),
  );

Additional information #

  • Textd: Return a Text widget or a TextStyle if no String type argument is specified.

  • In the hint document, for example, Color: 0:color, 1:backgroundColor, 2: decorationColor, 3:selectionColor means the first Color type argument is treated as 'color', the second is 'backgroundColor', the third is 'decorationColor', and the fourth is 'selectionColor'.

Supported Widgets #

  • Textd
  • Centerd
  • Rowd
  • Columnd
  • Scaffoldd
  • AppBard
  • FloatingActionButtond

Changelog #

Please see the Changelog page.

License #

Styled is distributed under the MIT License. See LICENSE for more information.

2
likes
150
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A declarative UI tool to simplify the creation of flutter widgets. Pass arguments in positional and without order.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on styled