Skip to content

Commit

Permalink
Merge branch 'global-key'
Browse files Browse the repository at this point in the history
  • Loading branch information
FeodorFitsner committed Oct 26, 2023
2 parents e23df3e + e831f34 commit 37b9581
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions package/lib/src/controls/create_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,20 @@ Widget createControl(Control? parent, String id, bool parentDisabled,
return const SizedBox.shrink();
}

GlobalKey? globalKey;
Key? controlKey;
var key = controlView.control.attrString("key", "")!;
if (key != "") {
globalKey = GlobalKey();
FletAppServices.of(context).globalKeys[key] = globalKey;
if (key.startsWith("test:")) {
controlKey = Key(key.substring(5));
} else {
var globalKey = controlKey = GlobalKey();
FletAppServices.of(context).globalKeys[key] = globalKey;
}
}

// create control widget
var widget = createWidget(
globalKey, controlView, parent, parentDisabled, nextChild);
controlKey, controlView, parent, parentDisabled, nextChild);

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

0 comments on commit 37b9581

Please sign in to comment.