static_dom 2.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 39

static_dom #

A simple static HTML DOM builder library for Dart

Usage #

A simple usage example:

Future updatePics() async {
  final JsonResponse resp = await client.getJson('/api/pics');
  print(resp.body);
  List<String> body = resp.body;
  Div divEl = div().forEach<String>(
      data,
      (String text) => div(classes: ['item'])
        ..add(img('/data/img/$text', classes: ["item-img"]))
        ..add(t(text, classes: ["item-txt"])));
  print(div.render());
  picHolder.setInnerHtml(div.render());
}

Changelog #

0.1.1 #

  • Added Pre element

0.1.0 #

  • Removed events
  • Added more components
  • New style and CSS system

0.0.2 #

  • Checkbox input element

0.0.1 #

  • Basic elements: Div, Text, Image
  • ItemMaker for children

example/static_dom_example.dart

// Copyright (c) 2017, teja. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:static_dom/static_dom.dart';

main() {
  final data = <String>['messi.jpg', 'neymar.jpg'];
  Div divEl = div().forEach<String>(
      data,
      (String text) => div(classes: ['item'])
        ..add(img('/data/img/$text', classes: ["item-img"]))
        ..add(t(text, classes: ["item-txt"])));
  print(divEl.render());
}

Use this package as a library

1. Depend on it

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


dependencies:
  static_dom: ^2.0.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:static_dom/static_dom.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
85
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
69
Overall:
Weighted score of the above. [more]
39
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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:static_dom/static_dom.dart.

Health suggestions

Fix lib/src/dom.dart. (-6.31 points)

Analysis of lib/src/dom.dart reported 13 hints, including:

line 64 col 21: Use = to separate a named parameter from its default value.

line 131 col 23: Use = to separate a named parameter from its default value.

line 132 col 21: Use = to separate a named parameter from its default value.

line 133 col 22: Use = to separate a named parameter from its default value.

line 134 col 27: Use = to separate a named parameter from its default value.

Fix lib/src/div.dart. (-2.96 points)

Analysis of lib/src/div.dart reported 6 hints, including:

line 12 col 29: Use isNotEmpty instead of length

line 52 col 21: Use = to separate a named parameter from its default value.

line 53 col 19: Use = to separate a named parameter from its default value.

line 54 col 20: Use = to separate a named parameter from its default value.

line 55 col 25: Use = to separate a named parameter from its default value.

Fix lib/src/input/checkbox.dart. (-2.48 points)

Analysis of lib/src/input/checkbox.dart reported 5 hints:

line 29 col 21: Use = to separate a named parameter from its default value.

line 30 col 19: Use = to separate a named parameter from its default value.

line 31 col 20: Use = to separate a named parameter from its default value.

line 32 col 25: Use = to separate a named parameter from its default value.

line 34 col 20: Use = to separate a named parameter from its default value.

Fix additional 6 files with analysis or formatting issues. (-3.99 points)

Additional issues in the following files:

  • lib/src/outer.dart (3 hints)
  • lib/src/heading.dart (2 hints)
  • lib/src/table.dart (2 hints)
  • lib/src/css/css.dart (1 hint)
  • lib/src/dom_backed.dart (Run dartfmt to format lib/src/dom_backed.dart.)
  • lib/src/text.dart (Run dartfmt to format lib/src/text.dart.)

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/tejainece/static_dom was unreachable.

The package description is too short. (-11 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ulid ^1.0.0 1.0.2
Dev dependencies
test any