Create flutter_driver key finders using parameterized ValueKey types (#7749)

The finder will only match the widget's ValueKey if both have identical
runtime types
This commit is contained in:
Jason Simmons 2017-01-30 16:52:59 -08:00 committed by GitHub
parent edcab3c340
commit 8ef17e0a6a
2 changed files with 10 additions and 2 deletions

View File

@ -92,6 +92,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
children: <Widget>[
new Expanded(
child: new LazyBlock(
key: new Key('main-scroll'),
delegate: new FancyItemDelegate(),
)
),

View File

@ -187,8 +187,15 @@ class _FlutterDriverExtension {
}, description: 'widget with text tooltip "${arguments.text}"');
}
Finder _createByValueKeyFinder(ByValueKey arguments) {
return find.byKey(new ValueKey<dynamic>(arguments.keyValue));
Finder _createByValueKeyFinder(ByValueKey<dynamic> arguments) {
switch (arguments.keyValueType) {
case 'int':
return find.byKey(new ValueKey<int>(arguments.keyValue));
case 'String':
return find.byKey(new ValueKey<String>(arguments.keyValue));
default:
throw 'Unsupported ByValueKey type: ${arguments.keyValueType}';
}
}
Finder _createFinder(SerializableFinder finder) {