fields 0.0.2
fields: ^0.0.2 copied to clipboard
An object editor.
Fields #
An object editor. Also known as an 'object inspector' or a 'property grid'.
[object editor]
Status (Dart SDK r24285) #
The examples work in Dartium.
The examples compile with dart2js and run in Chrome. However, the fields are
read-only because dart2js currently returns dynamic for all
VariableMirror.type calls.
Issues that you can star to improve this project are:
- issue 5505: ClassMirror override
==andhashCode - issue 6433: InstanceMirror get reflectedType;
- issue 10682: InstanceMirror : request for
Stream onFieldChangedmember - issue 11186: Add
typedef bool Predicate<E>(E element)to dart:core - issue 11345: Generic type parameter as literal in the VM.
Use #
Create an ObjectEditor #
import 'dart:html';
import 'package:fields/object_editor.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 Type. However, sometimes you want to tell us
more about your fields and you may do this by applying annotations from the
fields.meta library:
import 'package:fields/meta.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 #
[light][dark]
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.
