File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
modules/ensemble/lib/framework Expand file tree Collapse file tree 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> {
5555
5656 Widget rtn = buildWidget (context);
5757
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+
5867 if (widgetController.textDirection != null ) {
5968 rtn = Directionality (
6069 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>
6262 if (widget.controller is WidgetController ) {
6363 WidgetController widgetController = widget.controller as WidgetController ;
6464
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+
6574 if (widgetController.textDirection != null ) {
6675 rtn = Directionality (
6776 textDirection: widgetController.textDirection! , child: rtn);
You can’t perform that action at this time.
0 commit comments