tree_force 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

Tree Force #

A web ui framework based on a widget tree inspired by Flutter.

Experimental #

This package is in a proof-of-concept phase and is highly experimental. There is a good chance that the API will break with a new version of the package. Furthermore, don't expect high quality yet.

Roadmap #

  • Replace AngularDart in an internal use case (required features: some layout, images, text inputs, buttons, router, forms)
  • Optimize widget tree rebuild (currently the complete widget tree is rebuild even in the case a single leave has a state change)
  • Introduce keys for widgets in lists
  • Evaluate an in-code alternative for CSS
  • Implement more widgets
  • Tests
  • Documentation

Changelog #

0.1.0 #

  • Initial version

0.2.0 #

  • Added minified version of incremental-dom.
  • Bugfix: Fixed an exception, when tree_force is compiled with dart2js.


import 'dart:async';

import 'package:tree_force/tree_force.dart';
import 'package:tree_force/tree_force_basic.dart';
import 'package:tree_force/tree_force_fx.dart';
import 'package:tree_force/tree_force_layout.dart';

void main() {
          opacity: 1.0,
          child: Padding(
              insets: Insets(top: pixel(20)),
              child: Stack(children: [
                  width: percentage(100.0),
                  height: pixel(400),
                  child: Row(children: [
//                    Size(
//                        width: pixel(200),
//                        child: Align(
//                          vertical:,
//                          child: Image(
//                            title: 'Dart',
//                            src: 'dart.svg',
//                          ),
//                        )),
                    Column(children: [
                          initial: 0,
                          stream: Stream<int>.periodic(Duration(seconds: 2), (count) => count + 1),
                          builder: (state) {
                            return Text(text: 'builder: ${state}');
                      Text(key: 'key1', text: 'E-Mail'),
                      Text(text: 'Nickname'),
                        placeholder: 'test',
                        initialValue: 'foo',
                        onInput: (text) => print('value of input: $text'),
                        flexGrow: 1,
                        child: Align(
                          vertical: VerticalAlignment.bottom,
                          child: Button.text(
                            text: 'Sign In',
                            classes: ['foo'],
                            onClick: () => print('button was clicked!'),

class SimpleStateless extends StatelessWidget {
  Widget build(BuildContext context) {
    return Row(
      children: [
        Text(text: 'Hello'),
          insets: Insets(left: pixel(10)),
          child: Text(text: 'World'),

class SimpleStateful extends StatefulWidget {
  final String prefix;


  State<StatefulWidget> createState() {
    return _SimpleState(this);

class _SimpleState extends State<SimpleStateful> {
  int counter = 0;

  _SimpleState(SimpleStateful widget) : super(widget) {
    Timer.periodic(Duration(seconds: 1), (_) => setState(() => counter++));

  Widget build(BuildContext context) {
    return Text(text: '${widget.prefix}: $counter');

  String toString() {
    return '_SimpleState{counter: $counter}';

Use this package as a library

1. Depend on it

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

  tree_force: ^0.2.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:tree_force/tree_force.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: web

Primary library: package:tree_force/tree_force.dart with components: html, js.

Health issues and suggestions

Document public APIs. (-0.08 points)

460 out of 475 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.

Fix lib/src/tree_force/html_tag.dart. (-0.50 points)

Analysis of lib/src/tree_force/html_tag.dart reported 1 hint:

line 77 col 5: DO use curly braces for all flow control structures.

Format lib/src/tree_force/change_listener.dart.

Run dartfmt to format lib/src/tree_force/change_listener.dart.

Format lib/src/tree_force/framework.dart.

Run dartfmt to format lib/src/tree_force/framework.dart.

Fix additional 23 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/tree_force/html_node.dart (Run dartfmt to format lib/src/tree_force/html_node.dart.)
  • lib/src/tree_force/incremental_dom.dart (Run dartfmt to format lib/src/tree_force/incremental_dom.dart.)
  • lib/src/tree_force/input_listener.dart (Run dartfmt to format lib/src/tree_force/input_listener.dart.)
  • lib/src/tree_force/interaction_listener.dart (Run dartfmt to format lib/src/tree_force/interaction_listener.dart.)
  • lib/src/tree_force/length.dart (Run dartfmt to format lib/src/tree_force/length.dart.)
  • lib/src/tree_force/widget.dart (Run dartfmt to format lib/src/tree_force/widget.dart.)
  • lib/src/tree_force_basic/builder.dart (Run dartfmt to format lib/src/tree_force_basic/builder.dart.)
  • lib/src/tree_force_basic/button.dart (Run dartfmt to format lib/src/tree_force_basic/button.dart.)
  • lib/src/tree_force_basic/checkbox.dart (Run dartfmt to format lib/src/tree_force_basic/checkbox.dart.)
  • lib/src/tree_force_basic/image.dart (Run dartfmt to format lib/src/tree_force_basic/image.dart.)
  • lib/src/tree_force_basic/input.dart (Run dartfmt to format lib/src/tree_force_basic/input.dart.)
  • lib/src/tree_force_basic/label.dart (Run dartfmt to format lib/src/tree_force_basic/label.dart.)
  • lib/src/tree_force_basic/list.dart (Run dartfmt to format lib/src/tree_force_basic/list.dart.)
  • lib/src/tree_force_basic/router.dart (Run dartfmt to format lib/src/tree_force_basic/router.dart.)
  • lib/src/tree_force_basic/style.dart (Run dartfmt to format lib/src/tree_force_basic/style.dart.)
  • lib/src/tree_force_form/form.dart (Run dartfmt to format lib/src/tree_force_form/form.dart.)
  • lib/src/tree_force_form/form_field.dart (Run dartfmt to format lib/src/tree_force_form/form_field.dart.)
  • lib/src/tree_force_layout/align.dart (Run dartfmt to format lib/src/tree_force_layout/align.dart.)
  • lib/src/tree_force_layout/fixed.dart (Run dartfmt to format lib/src/tree_force_layout/fixed.dart.)
  • lib/src/tree_force_layout/flex.dart (Run dartfmt to format lib/src/tree_force_layout/flex.dart.)
  • lib/src/tree_force_layout/scroll_box.dart (Run dartfmt to format lib/src/tree_force_layout/scroll_box.dart.)
  • lib/src/tree_force_layout/stack.dart (Run dartfmt to format lib/src/tree_force_layout/stack.dart.)
  • lib/src/tree_force_redux/store_connector.dart (Run dartfmt to format lib/src/tree_force_redux/store_connector.dart.)

Maintenance suggestions

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
redux ^3.0.0 3.0.0
vector_math ^2.0.8 2.0.8
Dev dependencies
build_runner ^0.9.1
build_web_compilers ^0.4.0