fields 0.1.0
fields: ^0.1.0 copied to clipboard
An object editor for Dart.
Fields #
An object editor for Dart. Also known as an 'object inspector' or a 'property grid'.

Status (Dart SDK r28990) #
The examples work in Dartium.
The examples compile with dart2js. The sunflower example has been made to
work by applying a workaround for issue 12022 and issue 6433. The
workaround consists of annotating all of the fields of model objects with
@RuntimeType. For example:
class Foo {
@RuntimeType(int)
int bar;
}
Issues that you can star to improve this project are:
- issue 6433: InstanceMirror get reflectedType;
- issue 11186: Add
typedef bool Predicate<E>(E element)to dart:core issue 11345: Generic type parameter as literal in the VM.FIXED in r24861issue 11550: Metadata call to constant constructor regression in dart2js.FIXED in r24595- issue 12022: dart2js: VariableMirror.type always returns
dynamic - issue 12287: dart2js: type parameter as literal in constant expression
issue 12319: vm: getting theFIXED in r25982membersof a ClassMirror on 'Null' crash
Documentation #
Please consult the API documentation.
Use #
Create an ObjectEditor #
import 'dart:html';
import 'package:fields/fields.dart';
main() {
var editor = new ObjectEditor();
// Append the editor's element to your document where and when you like.
document.body.append(editor.element);
}
Select an Object #
...
// Select any dart object instance for edition.
editor.selected = new KitchenSink();
...
Annotate Fields #
By default, we do our best to provide a standard editor for each of your
object's fields based on its runtimeType. However, sometimes you want to tell
us more about your fields and you may do this by applying annotations:
import 'package:fields/fields.dart';
// Annotate your model objects to constrain the editor for any field.
class Sunflower {
@UseFieldEditor(ColorEditor)
String color = "#ff8000";
@UseFieldEditor(RangeEditor)
@UseRange(min: 0, max: 1000)
int seeds = 500;
@UseFieldEditor(NumberEditor)
@UseRange(min: 1, max:3)
int seedRadius = 2;
}
Extend #
TODO:
Theme #


Fields uses the MIT license as described in the LICENSE file, and follows semantic versioning.
The default icons were created by glyphicons.com and are released under the Creative Commons Attribution 3.0 Unported.
