flattery 0.1.0 copy "flattery: ^0.1.0" to clipboard
flattery: ^0.1.0 copied to clipboard

outdated

Flattery is a library for building HTML elements using Widgets.

Flattery #

Flattery is a library for building HTML elements using Widgets.

Widgets are just Dart objects whose purpose is to represent some user interface element. They are implemented using the awesome dart:html package, and do not try to hide it - so you can use your HTML/CSS knowledge to enhance existing widgets, and to create your own, type safely.

Usage #

A simple usage example:

/// Simple Counter Model.
class Counter {
  int value = 0;
}

/// A Counter Widget.
class CounterView extends Counter with Widget {
  final text = DivElement();

  CounterView() {
    _update();
  }

  @override
  Element build() => Container(
        children: [
          text,
          ButtonElement()
            ..text = 'Increment'
            ..onClick.listen((e) => value++),
          ButtonElement()
            ..text = 'Decrement'
            ..onClick.listen((e) => value--),
        ],
      ).root;

  @override
  set value(int value) {
    super.value = value;
    _update();
  }

  _update() => text.text = 'The current count is $value';
}

main() => document.getElementById('output').append(CounterView().root);

Building #

pub get

Run the example #

webdev serve example

Running the tests #

Unit tests:

pub run test

Use option -r json or r -expanded to see details.

Browser tests:

pub run test -p chrome

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Dart Test Documentation:

https://github.com/dart-lang/test/tree/master/pkgs/test

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Flattery is a library for building HTML elements using Widgets.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on flattery