Skip to content

Commit e831f34

Browse files
committed
Implement key="test:<value>"
1 parent e19887f commit e831f34

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

package/lib/src/controls/create_control.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,20 @@ Widget createControl(Control? parent, String id, bool parentDisabled,
9797
return const SizedBox.shrink();
9898
}
9999

100-
GlobalKey? globalKey;
100+
Key? controlKey;
101101
var key = controlView.control.attrString("key", "")!;
102102
if (key != "") {
103-
globalKey = GlobalKey();
104-
FletAppServices.of(context).globalKeys[key] = globalKey;
103+
if (key.startsWith("test:")) {
104+
controlKey = Key(key.substring(5));
105+
} else {
106+
var globalKey = controlKey = GlobalKey();
107+
FletAppServices.of(context).globalKeys[key] = globalKey;
108+
}
105109
}
106110

107111
// create control widget
108112
var widget = createWidget(
109-
globalKey, controlView, parent, parentDisabled, nextChild);
113+
controlKey, controlView, parent, parentDisabled, nextChild);
110114

111115
// no theme defined? return widget!
112116
if (id == "page" || controlView.control.attrString("theme") == null) {

0 commit comments

Comments
 (0)