tree_force 0.2.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new66

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.

example/main.dart

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() {
  treeForce(
      '#output',
      Opacity(
          opacity: 1.0,
          child: Padding(
              insets: Insets(top: pixel(20)),
              child: Stack(children: [
                Size(
                  width: percentage(100.0),
                  height: pixel(400),
                  child: Row(children: [
//                    Size(
//                        width: pixel(200),
//                        child: Align(
//                          vertical: VerticalAlignment.top,
//                          child: Image(
//                            title: 'Dart',
//                            src: 'dart.svg',
//                          ),
//                        )),
                    Column(children: [
                      SimpleStateless(),
                      SimpleStateful('state'),
                      StreamBuilder<int>(
                          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'),
                      Input(
                        placeholder: 'test',
                        initialValue: 'foo',
                        onInput: (text) => print('value of input: $text'),
                      ),
                    ]),
                    FlexItem(
                        flexGrow: 1,
                        child: Align(
                          vertical: VerticalAlignment.bottom,
                          child: Button.text(
                            text: 'Sign In',
                            classes: ['foo'],
                            onClick: () => print('button was clicked!'),
                          ),
                        )),
                  ]),
                ),
              ]))));
}

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

class SimpleStateful extends StatefulWidget {
  final String prefix;

  SimpleStateful(this.prefix);

  @override
  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++));
  }

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

  @override
  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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
0.2.1 Mar 23, 2019 Go to the documentation of tree_force 0.2.1 Download tree_force 0.2.1 archive
0.2.0 Mar 2, 2019 Go to the documentation of tree_force 0.2.0 Download tree_force 0.2.0 archive
0.1.0 Feb 27, 2019 Go to the documentation of tree_force 0.1.0 Download tree_force 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

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.

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.

Format lib/src/tree_force/html_node.dart.

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

Fix additional 23 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/tree_force/html_tag.dart (Run dartfmt to format lib/src/tree_force/html_tag.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.

Dependencies

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