Rationalise the Key API.

Add a way of having keys based on numeric types or DateTimes by having a ValueKey<T> class.
Remove the redundant ways of declaring things, except for leaving one shorthand -- you can say `new Key(s)` instead of `new ValueKey<String>(s)`.
This commit is contained in:
Hixie
2015-08-28 10:52:23 -07:00
parent 12e3897f40
commit 9047830c2e
14 changed files with 25 additions and 28 deletions

View File

@@ -13,7 +13,7 @@ void main() {
new Mimicable(
key: globalKey,
child: new Container(
key: new Key.stringify('inner'),
key: new Key('inner'),
height: 10.0,
width: 10.0
)
@@ -50,13 +50,13 @@ void main() {
tester.pumpFrame(() {
return new Flex([
new Container(
key: new Key.stringify('outer'),
key: new Key('outer'),
height: 10.0,
width: 10.0,
child: new Mimicable(
key: globalKey,
child: new Container(
key: new Key.stringify('inner'),
key: new Key('inner'),
height: 10.0,
width: 10.0
)

View File

@@ -14,7 +14,7 @@ void main() {
Widget buildPage(int page) {
return new Container(
key: new StringKey(page.toString()),
key: new ValueKey<int>(page),
width: pageSize.width,
height: pageSize.height,
child: new Text(page.toString())