Commit 8ef17e0a authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

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
parent edcab3c3
...@@ -92,6 +92,7 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -92,6 +92,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new LazyBlock( child: new LazyBlock(
key: new Key('main-scroll'),
delegate: new FancyItemDelegate(), delegate: new FancyItemDelegate(),
) )
), ),
......
...@@ -187,8 +187,15 @@ class _FlutterDriverExtension { ...@@ -187,8 +187,15 @@ class _FlutterDriverExtension {
}, description: 'widget with text tooltip "${arguments.text}"'); }, description: 'widget with text tooltip "${arguments.text}"');
} }
Finder _createByValueKeyFinder(ByValueKey arguments) { Finder _createByValueKeyFinder(ByValueKey<dynamic> arguments) {
return find.byKey(new ValueKey<dynamic>(arguments.keyValue)); 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) { Finder _createFinder(SerializableFinder finder) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment