File tree 2 files changed +18
-0
lines changed
modules/ensemble/lib/framework
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,15 @@ abstract class EnsembleWidgetState<W extends EnsembleWidget> extends State<W> {
55
55
56
56
Widget rtn = buildWidget (context);
57
57
58
+ // Add KeyedSubtree with ValueKey based on testId to make widget findable in tests using find.byKey()
59
+ if (widgetController.testId != null &&
60
+ widgetController.testId! .isNotEmpty) {
61
+ rtn = KeyedSubtree (
62
+ key: ValueKey (widgetController.testId! ),
63
+ child: rtn,
64
+ );
65
+ }
66
+
58
67
if (widgetController.textDirection != null ) {
59
68
rtn = Directionality (
60
69
textDirection: widgetController.textDirection! , child: rtn);
Original file line number Diff line number Diff line change @@ -62,6 +62,15 @@ abstract class EWidgetState<W extends HasController>
62
62
if (widget.controller is WidgetController ) {
63
63
WidgetController widgetController = widget.controller as WidgetController ;
64
64
65
+ // Add KeyedSubtree with ValueKey based on testId to make widget findable in tests using find.byKey()
66
+ if (widgetController.testId != null &&
67
+ widgetController.testId! .isNotEmpty) {
68
+ rtn = KeyedSubtree (
69
+ key: ValueKey (widgetController.testId! ),
70
+ child: rtn,
71
+ );
72
+ }
73
+
65
74
if (widgetController.textDirection != null ) {
66
75
rtn = Directionality (
67
76
textDirection: widgetController.textDirection! , child: rtn);
You can’t perform that action at this time.
0 commit comments