diff --git a/example/.firebase/hosting.YnVpbGRcd2Vi.cache b/example/.firebase/hosting.YnVpbGRcd2Vi.cache index d926d91e..5ec8fad3 100644 --- a/example/.firebase/hosting.YnVpbGRcd2Vi.cache +++ b/example/.firebase/hosting.YnVpbGRcd2Vi.cache @@ -1,4 +1,6 @@ favicon.png,1708776909321,0cab6e3dd5a9f008afdd133e1e1207cf65f2f2a10eb6712e3c209d8a5f76425a +flutter.js,1712123089908,f5a14edb95c81962fa23eaaae56e126c490103fa2f18b3ad825460cbdc0f9e4e +index.html.jic,1712203008730,450d91343d6c4e4ebf643feca4fbd233cbf13f2fddb65dbad43f1408f0d32494 index.tmpl.html,1708776904218,db354b8f2b060e79f22237c8fa4a0a126f8476dd3a0145e032db1f94e12dc069 manifest.json,1708776904218,0bee7a1ad8c8853d3f1aa1a5c004c9b00e0e3915e451e5107e058dba069c93f4 assets/assets/images/bridging-the-gap-logo.jpeg,1709603134636,bc7eef7612f77cde161d7d53a5167d95e922c62e5e3728adbf5f088c45545fb6 @@ -23,31 +25,29 @@ assets/packages/flutter_content/lib/assets/images/google-icons/sheets.png,170877 assets/packages/flutter_content/lib/assets/images/google-icons/slides.png,1708776908129,436dd120a01caf9220cccf50e91b583df115c1d31ca22f935f999cb4793b8515 assets/startup-scripts/cats-config.json,1708776904214,8c5026aa006dd1496109e5f281e294a41549117c13984dd0072b6ec3e53a35c7 assets/startup-scripts/example-config.json,1708854933099,96f1f0e89604299954ebe5111c267ad7e2ab5e56fe4b1cb7bc09693cef0c1dcc -icons/Icon-192.png,1708776908536,eaf2464bfb1d192fdd192a616f7b858dee456d573c6ec619648a1dcf2bdddfa6 -icons/Icon-512.png,1708776908252,9cf4cd298ae95acc1f25e97d88aa3f6bbfdf40867ea0f8a854c4393f49d56e64 -icons/Icon-maskable-192.png,1708776908525,196ce9142a3442ab37ae90cd46c3389e4660400c859b81cbb0538a51b39752eb -icons/Icon-maskable-512.png,1708776907913,6833b7c449e0dd24d5e164a53cc4557e643893e675b476b05efcbb9a6aa05bf0 -flutter.js,1712123089908,f5a14edb95c81962fa23eaaae56e126c490103fa2f18b3ad825460cbdc0f9e4e -index.html,1712235360526,2a22090e8bcb777a63d1e888f7c9d1c9ff328004211dc5b951516d076fc079ab -version.json,1712235358793,5681baaa8d2e258cbb0fd11e3aaa16eb218980d545af5756808375b7ecd21223 -flutter_service_worker.js,1712235361120,97289c92f94e45df3dab4339ce1fd7f0b4aaffb9621951356e9e00b5ea2fb877 -index.html.jic,1712203008730,450d91343d6c4e4ebf643feca4fbd233cbf13f2fddb65dbad43f1408f0d32494 -assets/AssetManifest.bin,1712235358970,101f9f07c8e751f633efa97add0bfa613ae630b70ad9e37516359e239477d127 -assets/AssetManifest.bin.json,1712235358970,eb37bcd3ca1b6e57b043db66299a15547884275782168e4aecc033a426fffabf -assets/AssetManifest.json,1712235358970,27719e640c59cfede9c314523fba5389928da66b3a6ff6dc760d70c884c932f3 -assets/FontManifest.json,1712235358970,e38b95988f5d060cf9b7ce97cb5ac9236d6f4cc04a11d69567df97b2b4cbc5e5 -assets/packages/cupertino_icons/assets/CupertinoIcons.ttf,1712235360501,f59150eed777f87591658721b2d83b7c24a09b2bd3195480a4bf864753afdec7 -assets/fonts/MaterialIcons-Regular.otf,1712235360506,bf484ea31013eb523ec79e8714ebdfed95885f34175d58ffab39b67f0a8bafab -assets/shaders/ink_sparkle.frag,1712235359091,591c7517d5cb43eb91ea451e0d3f9f585cbf8298cf6c46a9144b77cb0775a406 -canvaskit/skwasm.worker.js,1712123089906,3fd50075667dba6e3822f8300deafbd0236ef4ddaa09228f2d07fefdfc22c905 canvaskit/canvaskit.js,1712123089824,78fcd45d44f595265e49e58d7de7be7c0f272b8028a7f2fa7f885cdd55ddfa3e -canvaskit/skwasm.js,1712123089883,ea7b5728dd099712b1ee59c47cadffab7891c3612f4567edc838fdeceded3560 -canvaskit/chromium/canvaskit.js,1712123089858,765f1da9cc7d4436b770238da368cde4175891ee3efe25b1d527f89085676c56 -assets/NOTICES,1712235358971,3613e4947f596874592f90b0b07798b99e7c6cef14423479823ffaa5c3038d08 -canvaskit/chromium/canvaskit.js.symbols,1712123089862,3d33b487a1e36b6145e0efe7a3f6f9826844301de61343a6761e22f3030ed3d9 canvaskit/canvaskit.js.symbols,1712123089828,128193b5dcf67bd21064f3a0e3144f40ca5d994a29f6548235ca5c14d3648a24 +canvaskit/canvaskit.wasm,1712123089857,146684bc3d008b6447f94d6fccd220e7952e0d91f16db5665787739cf78e2788 +canvaskit/skwasm.js,1712123089883,ea7b5728dd099712b1ee59c47cadffab7891c3612f4567edc838fdeceded3560 canvaskit/skwasm.js.symbols,1712123089887,f91e30b4c5f94a2c35f80b1c75d6db43d23602dbca69f243242b0b15d5b914d6 canvaskit/skwasm.wasm,1712123089905,d03ac87729205c75879766cbcd225e669a9766552d3b64a08b255116e23f4671 +canvaskit/skwasm.worker.js,1712123089906,3fd50075667dba6e3822f8300deafbd0236ef4ddaa09228f2d07fefdfc22c905 +canvaskit/chromium/canvaskit.js,1712123089858,765f1da9cc7d4436b770238da368cde4175891ee3efe25b1d527f89085676c56 +canvaskit/chromium/canvaskit.js.symbols,1712123089862,3d33b487a1e36b6145e0efe7a3f6f9826844301de61343a6761e22f3030ed3d9 canvaskit/chromium/canvaskit.wasm,1712123089882,d39a626014748054f5ec9b684bfecf18dd19e640643e4ba5b98a21e62e4b61ab -main.dart.js,1712235006867,1859d5c5cf98a6f57b6d34d4ef2eae31efb24db5628c3389ef9ae3567e7317e1 -canvaskit/canvaskit.wasm,1712123089857,146684bc3d008b6447f94d6fccd220e7952e0d91f16db5665787739cf78e2788 +icons/Icon-192.png,1708776908536,eaf2464bfb1d192fdd192a616f7b858dee456d573c6ec619648a1dcf2bdddfa6 +icons/Icon-512.png,1708776908252,9cf4cd298ae95acc1f25e97d88aa3f6bbfdf40867ea0f8a854c4393f49d56e64 +icons/Icon-maskable-192.png,1708776908525,196ce9142a3442ab37ae90cd46c3389e4660400c859b81cbb0538a51b39752eb +icons/Icon-maskable-512.png,1708776907913,6833b7c449e0dd24d5e164a53cc4557e643893e675b476b05efcbb9a6aa05bf0 +index.html,1712913513955,e6f4673e6d41947e0176dbfb7f6391e1705c518543c06775aaffc51e7243ef4e +version.json,1712913512006,6efb30111b65a2f22066243372af8bb04b0d78674339231ec3396704896cfeb3 +flutter_service_worker.js,1712913514574,b730fc789066c27499da61fe37382f50cb30e8a00a7295e25d8b2707f045189a +assets/AssetManifest.json,1712913512235,27719e640c59cfede9c314523fba5389928da66b3a6ff6dc760d70c884c932f3 +assets/AssetManifest.bin,1712913512235,101f9f07c8e751f633efa97add0bfa613ae630b70ad9e37516359e239477d127 +assets/AssetManifest.bin.json,1712913512236,eb37bcd3ca1b6e57b043db66299a15547884275782168e4aecc033a426fffabf +assets/FontManifest.json,1712913512236,e38b95988f5d060cf9b7ce97cb5ac9236d6f4cc04a11d69567df97b2b4cbc5e5 +assets/packages/cupertino_icons/assets/CupertinoIcons.ttf,1712913513933,f59150eed777f87591658721b2d83b7c24a09b2bd3195480a4bf864753afdec7 +assets/fonts/MaterialIcons-Regular.otf,1712913513934,bf484ea31013eb523ec79e8714ebdfed95885f34175d58ffab39b67f0a8bafab +assets/shaders/ink_sparkle.frag,1712913512371,591c7517d5cb43eb91ea451e0d3f9f585cbf8298cf6c46a9144b77cb0775a406 +assets/NOTICES,1712913512236,7f0ca623fc52a4001d2b45470963eac5dac71299ded3c35ac5f23f349b13fb4a +main.dart.js,1712913511301,80045edcd904773be66b54bbbac2de08ad0dfd8245a60485cf6ef6f51fcb4130 diff --git a/example/lib/main.dart b/example/lib/main.dart index b2586bd2..5e45af45 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -253,7 +253,7 @@ Future main() async { initialValueJsonAssetPath: "startup-scripts/example-config.json", webHome: const FlutterContentPage( panelName: 'home', - snippetName: 'example-home', + snippetName: 'example-home-4', fromTemplate: SnippetTemplate.empty_snippet, ), // webHome: const ZoomerSamplePage(), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b87e634d..736233cd 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -2,7 +2,7 @@ name: example description: "Example website project to demo the flutter_content pkg." publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.9.0+18 +version: 0.9.1+18 environment: sdk: '>=3.2.3 <4.0.0' @@ -29,3 +29,4 @@ flutter: assets: - assets/images/ - startup-scripts/ + diff --git a/lib/flutter_content.dart b/lib/flutter_content.dart index 24dbee8d..e1ed6622 100644 --- a/lib/flutter_content.dart +++ b/lib/flutter_content.dart @@ -172,7 +172,6 @@ typedef EncodedSnippetJson = String; typedef JsonMap = Map; typedef SizeFunc = Size Function(); typedef PosFunc = Offset Function(); -typedef TargetsWrapperName = String; typedef DoubleFunc = double Function(); @@ -338,15 +337,17 @@ class FC { void addToSnippetCache({ required SnippetName snippetName, required SnippetRootNode rootNode, - required VersionId initialVersionId, - required bool editing, + required VersionId versionId, + // required bool editing, }) { debugPrint('addToSnippetCache($snippetName)'); - snippetCache.addAll({ - snippetName: {initialVersionId: rootNode} - }); - updateEditingVersionId( - snippetName: snippetName, newVersionId: initialVersionId); + if (snippetCache.containsKey(snippetName)) { + snippetCache[snippetName]![versionId] = rootNode; + } else { + snippetCache.addAll({ + snippetName: {versionId: rootNode} + }); + } } void updateEditingVersionId({ @@ -390,7 +391,6 @@ class FC { /// Docs about CFBundleVersion: https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion late CAPIBloC capiBloc; - Map targetsWrappers = {}; late bool _skipAssetPkgName; // when using assets from within the flutter_content pkg itself late List _googleFontNames; @@ -403,12 +403,12 @@ class FC { final inEditMode = ValueNotifier(false); - bool get canEditContent => - HydratedBloc.storage.read("canEditContent") ?? false; + bool get canEditContent => true; + // HydratedBloc.storage.read("canEditContent") ?? false; void setCanEdit(bool b) => HydratedBloc.storage.write("canEditContent", b); - Offset calloutConfigToolbarPos(context) => + Offset calloutConfigToolbarPos() => _calloutConfigToolbarPos ?? Offset( Useful.scrW / 2 - 350, @@ -432,8 +432,7 @@ class FC { _handlers[name]; // each snippet panel has a gk, a last selected node, and a ur - final Map gkSTreeNodeMap = - {}; // every node's toWidget() creates a GK + final Map gkSTreeNodeMap = {}; // every node's toWidget() creates a GK final Map snippetPlacementMap = {}; final Map panelGkMap = {}; final List registeredScrollControllers = []; @@ -454,13 +453,16 @@ class FC { // Snippet Stack final Queue _snippetsBeingEdited = Queue(); - SnippetBloC? get snippetBeingEdited => - areAnySnippetsBeingEdited ? _snippetsBeingEdited.first : null; + SnippetBloC? get snippetBeingEdited { + return _snippetsBeingEdited.isNotEmpty ? _snippetsBeingEdited.first : null; + } bool get areAnySnippetsBeingEdited => _snippetsBeingEdited.isNotEmpty; void pushSnippet(SnippetBloC snippetBloc) { _snippetsBeingEdited.addFirst(snippetBloc); + debugPrint("snippetBeingEdited is $snippetBeingEdited"); + return; } SnippetBloC? popSnippet() => @@ -493,8 +495,8 @@ class FC { return gk; } - TargetsWrapperState? parentTW(String twName) => - FC().targetsWrappers[twName]?.currentState as TargetsWrapperState?; + // TargetsWrapperState? parentTW(String twName) => + // FC().targetsWrappers[twName]?.currentState as TargetsWrapperState?; // final FeatureList _singleTargetBtnFeatures = []; @@ -504,7 +506,7 @@ class FC { STreeNode? get selectedNode => snippetBeingEdited?.state.selectedNode; - STreeNode? get highlightedNode => snippetBeingEdited?.state.highlightedNode; + // STreeNode? get highlightedNode => snippetBeingEdited?.state.highlightedNode; SnippetTreeController? get currentTreeC => snippetBeingEdited?.state.treeC; diff --git a/lib/src/api/snippet_panel/callout_snippet_tree_and_properties.dart b/lib/src/api/snippet_panel/callout_snippet_tree_and_properties.dart index c7a3ab0f..40283b18 100644 --- a/lib/src/api/snippet_panel/callout_snippet_tree_and_properties.dart +++ b/lib/src/api/snippet_panel/callout_snippet_tree_and_properties.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_content/flutter_content.dart'; import 'package:flutter_content/src/api/snippet_panel/callout_snippet_tree_and_properties_content.dart'; +import 'package:flutter_content/src/bloc/snippet_event.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart'; // void removeSnippetTreeCallout(String snippetName) => Callout.removeOverlay(snippetName); @@ -14,8 +15,8 @@ import 'package:hydrated_bloc/hydrated_bloc.dart'; // // void refreshSnippetTreeCallout(String snippetName) => Callout.refreshOverlay(snippetName); -CalloutConfig -snippetTreeCalloutConfig(SnippetBloC snippetBloc, VoidCallback onDismissedF) { +CalloutConfig snippetTreeCalloutConfig( + SnippetBloC snippetBloc, VoidCallback onDismissedF) { double width() { double? w = HydratedBloc.storage.read("snippet-tree-callout-width"); if (w != null) return w.abs(); @@ -96,6 +97,9 @@ void showSnippetTreeAndPropertiesCallout({ ScrollController? ancestorHScrollController, ScrollController? ancestorVScrollController, required VoidCallback onDismissedF, + required STreeNode startingAtNode, + required STreeNode? selectedNode, + required STreeNode tappedNode, bool allowButtonCallouts = false, }) async { STreeNode rootNode = snippetBloc.state.rootNode; @@ -123,6 +127,16 @@ void showSnippetTreeAndPropertiesCallout({ }, targetGkF: targetGKF, ); + // imm select a node + STreeNode sel = selectedNode ?? startingAtNode; + snippetBloc.add(SnippetEvent.selectNode( + node: sel, + selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), +// imageTC: tc, + )); + Useful.afterNextBuildDo(() { + tappedNode.showNodeWidgetOverlay(); + }); } // void _clearSelection() { diff --git a/lib/src/api/snippet_panel/callout_snippet_tree_and_properties_content.dart b/lib/src/api/snippet_panel/callout_snippet_tree_and_properties_content.dart index 9da09890..0010e0ca 100644 --- a/lib/src/api/snippet_panel/callout_snippet_tree_and_properties_content.dart +++ b/lib/src/api/snippet_panel/callout_snippet_tree_and_properties_content.dart @@ -359,6 +359,8 @@ class SnippetTreeAndPropertiesCalloutContents extends HookWidget { // some properties cannot be deleted!snippetBloc.state.selectedNode.canBeDeleted() // some properties cannot be deleted if (!snippetBloc.state.selectedNode.canBeDeleted()) return; + bool wasShowingAsRoot = snippetBloc.state.selectedNode == snippetBloc.treeC.roots.first; + STreeNode? parentNode = snippetBloc.state.selectedNode.parent as STreeNode?; Callout.dismiss(SELECTED_NODE_BORDER_CALLOUT); snippetBloc.add(const SnippetEvent.deleteNodeTapped()); Useful.afterNextBuildDo(() async { @@ -368,6 +370,13 @@ class SnippetTreeAndPropertiesCalloutContents extends HookWidget { // if was tab or tabview, reset the tab Q and controller SnippetPanelState? spState = SnippetPanel.of(context); spState?.resetTabQandC; + // redraw tree if deleted node was root + if (wasShowingAsRoot && parentNode != null) { + snippetBloc.add(SnippetEvent.selectNode( + node: parentNode, + selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), + )); + } }); }); Callout.dismiss("TreeNodeMenu"); @@ -407,38 +416,38 @@ class SnippetTreeAndPropertiesCalloutContents extends HookWidget { ), tooltip: 'Save a a new Snippet...', ), - IconButton( - hoverColor: Colors.white30, - onPressed: () async { - // some properties cannot be deleted!snippetBloc.state.selectedNode.canBeDeleted() - // some properties cannot be deleted - if (!snippetBloc.state.selectedNode.canBeDeleted()) return; - Callout.dismiss(SELECTED_NODE_BORDER_CALLOUT); - snippetBloc.add(const SnippetEvent.deleteNodeTapped()); - Useful.afterNextBuildDo(() async { - await Future.delayed(const Duration(milliseconds: 1000)); - snippetBloc.add(const SnippetEvent.completeDeletion()); - Useful.afterNextBuildDo(() { - // if was tab or tabview, reset the tab Q and controller - SnippetPanelState? spState = SnippetPanel.of(context); - spState?.resetTabQandC; - }); - }); - Callout.dismiss("TreeNodeMenu"); - }, - icon: Icon(Icons.delete, - color: Colors.red.withOpacity( - !snippetBloc.state.aNodeIsSelected || - snippetBloc.state.selectedNode - is SnippetRefNode || - (gc is GenericSingleChildNode? && - gc?.parent is StepNode && - (gc?.propertyName == 'title' || - gc?.propertyName == 'content')) - ? .5 - : 1.0)), - tooltip: 'Remove', - ), + // IconButton( + // hoverColor: Colors.white30, + // onPressed: () async { + // // some properties cannot be deleted!snippetBloc.state.selectedNode.canBeDeleted() + // // some properties cannot be deleted + // if (!snippetBloc.state.selectedNode.canBeDeleted()) return; + // Callout.dismiss(SELECTED_NODE_BORDER_CALLOUT); + // snippetBloc.add(const SnippetEvent.deleteNodeTapped()); + // Useful.afterNextBuildDo(() async { + // await Future.delayed(const Duration(milliseconds: 1000)); + // snippetBloc.add(const SnippetEvent.completeDeletion()); + // Useful.afterNextBuildDo(() { + // // if was tab or tabview, reset the tab Q and controller + // SnippetPanelState? spState = SnippetPanel.of(context); + // spState?.resetTabQandC; + // }); + // }); + // Callout.dismiss("TreeNodeMenu"); + // }, + // icon: Icon(Icons.delete, + // color: Colors.red.withOpacity( + // !snippetBloc.state.aNodeIsSelected || + // snippetBloc.state.selectedNode + // is SnippetRefNode || + // (gc is GenericSingleChildNode? && + // gc?.parent is StepNode && + // (gc?.propertyName == 'title' || + // gc?.propertyName == 'content')) + // ? .5 + // : 1.0)), + // tooltip: 'Remove', + // ), ], ), // tree structure icon buttons @@ -646,7 +655,8 @@ class SnippetTreePane extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - navigateUpTreeButton(context), + if (snippetBloc.treeC.roots.first.parent is! SnippetRootNode) + navigateUpTreeButton(context), Expanded( child: SnippetTreeView(snippetBloc: snippetBloc)), ], @@ -675,7 +685,7 @@ class SnippetTreePane extends StatelessWidget { snippetBloc.add(SnippetEvent.selectNode( node: parent!, // imageTC: tc, - selectedWidgetGK: GlobalKey(debugLabel: 'selectedWidgetGK'), + // selectedWidgetGK: GlobalKey(debugLabel: 'selectedWidgetGK'), selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), )); Useful.afterNextBuildDo(() { diff --git a/lib/src/api/snippet_panel/snippet_panel.dart b/lib/src/api/snippet_panel/snippet_panel.dart index 8be436c6..c53965cd 100644 --- a/lib/src/api/snippet_panel/snippet_panel.dart +++ b/lib/src/api/snippet_panel/snippet_panel.dart @@ -201,13 +201,14 @@ class SnippetPanelState extends State // if exists, ensure cached first VersionId? editingVersionId = FC().editingVersionIds[widget.snippetName]; if (editingVersionId != null) { + // ensure snippet is in the cache await FC().fbModelRepo.getSnippetFromCacheOrFB( snippetName: widget.snippetName, versionId: editingVersionId); } SnippetRootNode? snippetRootNode = FC().rootNodeOfEditingSnippet(widget.snippetName); // possibly create new root snippet, which will have a scaffold, appbar and a tabbar for a main menu - if (snippetRootNode == null && widget.fromTemplate != null) { + if (snippetRootNode == null) { snippetRootNode = SnippetPanel.createSnippetFromTemplate( widget.fromTemplate!, widget.snippetName); VersionId initialVersionId = @@ -215,25 +216,10 @@ class SnippetPanelState extends State FC().addToSnippetCache( snippetName: widget.snippetName, rootNode: snippetRootNode, - initialVersionId: initialVersionId, - editing: true, - ); - FC().capiBloc.add(CAPIEvent.saveSnippet( - snippetRootNode: snippetRootNode, - newVersionId: initialVersionId, - )); - } else if (snippetRootNode == null) { - snippetRootNode = - SnippetRootNode(name: widget.snippetName, child: PlaceholderNode()) - .cloneSnippet(); - VersionId initialVersionId = - DateTime.now().millisecondsSinceEpoch.toString(); - FC().addToSnippetCache( - snippetName: widget.snippetName, - rootNode: snippetRootNode, - initialVersionId: initialVersionId, - editing: true, + versionId: initialVersionId, + // editing: true, ); + FC().updateEditingVersionId(snippetName: widget.snippetName, newVersionId: initialVersionId,); FC().capiBloc.add(CAPIEvent.saveSnippet( snippetRootNode: snippetRootNode, newVersionId: initialVersionId, @@ -364,11 +350,11 @@ class SnippetPanelState extends State FC().addToSnippetCache( snippetName: widget.snippetName, rootNode: rootNode, - initialVersionId: initialVersionId, - editing: true, + versionId: initialVersionId, + // editing: true, ); - FC().updatePublishedVersionId( - snippetName: widget.snippetName, versionId: initialVersionId); + FC().updatePublishedVersionId(snippetName: widget.snippetName, versionId: initialVersionId); + FC().updateEditingVersionId(snippetName: widget.snippetName, newVersionId: initialVersionId); FC().capiBloc.add(CAPIEvent.saveSnippet( snippetRootNode: rootNode, newVersionId: initialVersionId, @@ -529,14 +515,13 @@ class SnippetPanelState extends State // snippetNameToUse = FC().snippetPlacementMap[widget.panelName]!; // } - debugPrint("build SnippetPanel ${widget.panelName}"); - // TODO no BloC when user not able to edit ? return BlocBuilder( key: FC().panelGkMap[widget.panelName] = GlobalKey(debugLabel: 'Panel[${widget.panelName}]'), - // buildWhen: (previous, current) => current.snippetBeingEdited?.snippetName == widget.sName, + buildWhen: (previous, current) => !current.skipSnippetPanelRebuild, builder: (innerContext, state) { + debugPrint("build SnippetPanel / BlocBuilder ${widget.panelName}"); return FutureBuilder( future: _ensureSnippetInCache(), builder: (context, snapshot) { diff --git a/lib/src/api/wrapper/material_spa.dart b/lib/src/api/wrapper/material_spa.dart index edc693bb..103a5205 100644 --- a/lib/src/api/wrapper/material_spa.dart +++ b/lib/src/api/wrapper/material_spa.dart @@ -248,7 +248,8 @@ class MaterialSPAState extends State with TickerProviderStateMixin // ); @override - Widget build(BuildContext context) => Builder(builder: (context) { + Widget build(BuildContext context) => Builder( + builder: (context) { return FutureBuilder( future: fInitApp, builder: (context, snapshot) { @@ -259,8 +260,8 @@ class MaterialSPAState extends State with TickerProviderStateMixin // start the app with the main bloC if (!Callout.anyPresent(["floating-clipboard"])) { Useful.afterNextBuildDo(() { - _showFloatingClipboard(); - Callout.hide("floating-clipboard"); + // _showFloatingClipboard(); + // Callout.hide("floating-clipboard"); showDevToolsFAB(); }); } @@ -542,14 +543,13 @@ class MaterialSPAState extends State with TickerProviderStateMixin // if currently configuring a target, only show for the current target's snippet FC().showingNodeOBoundaryOverlays = true; // bool configuringATarget = Callout.anyPresent(['config-toolbar']); - var gkSTreeNodeMap = FC().gkSTreeNodeMap; void traverseAndMeasure(BuildContext el) { // debugPrint('traverseAndMeasure(${el.toString()})'); - if ((gkSTreeNodeMap.containsKey(el.widget.key))) { + if ((FC().gkSTreeNodeMap.containsKey(el.widget.key))) { // || (el.widget.key != null && gkSTreeNodeMap[el.widget.key]?.rootNodeOfSnippet() == FC().targetSnippetBeingConfigured)) { GlobalKey gk = el.widget.key as GlobalKey; - STreeNode? node = gkSTreeNodeMap[gk]; + STreeNode? node = FC().gkSTreeNodeMap[gk]; if (node != null) { if (node.rootNodeOfSnippet() == FC().targetSnippetBeingConfigured) { debugPrint("targetSnippetBeingConfigured: ${node.toString()}"); diff --git a/lib/src/api/wrapper/multiple/config_toolbar/callout_config_toolbar.dart b/lib/src/api/wrapper/multiple/config_toolbar/callout_config_toolbar.dart index f7aa126b..ebee5d78 100644 --- a/lib/src/api/wrapper/multiple/config_toolbar/callout_config_toolbar.dart +++ b/lib/src/api/wrapper/multiple/config_toolbar/callout_config_toolbar.dart @@ -17,14 +17,12 @@ import 'resize_slider.dart'; Timer? _debounce; class CalloutConfigToolbar extends StatefulWidget { - final TargetsWrapperName twName; final TargetModel tc; final VoidCallback onCloseF; final ScrollController? ancestorHScrollController; final ScrollController? ancestorVScrollController; const CalloutConfigToolbar({ - required this.twName, required this.tc, required this.onCloseF, this.ancestorHScrollController, @@ -47,7 +45,7 @@ class _CalloutConfigToolbarState extends State { @override Widget build(BuildContext context) { TargetModel tc = widget.tc; - Size ivSize = tc.targetWrapperState!.wrapperSize; + Size ivSize = tc.targetsWrapperState?.wrapperSize ?? MediaQuery.of(context).size; return SizedBox( width: CalloutConfigToolbar.CALLOUT_CONFIG_TOOLBAR_W(tc), height: CalloutConfigToolbar.CALLOUT_CONFIG_TOOLBAR_H(tc), @@ -73,9 +71,8 @@ class _CalloutConfigToolbarState extends State { ), onChangeF: (value) { tc.transformScale = value; - FC() - .parentTW(widget.twName) - ?.zoomer + TargetsWrapperState? state = tc.targetsWrapperState; + state?.zoomer ?.zoomImmediately(value, value); }, min: 1.0, @@ -126,7 +123,6 @@ class _CalloutConfigToolbarState extends State { ), onPressed: () { ColourTool.show( - widget.twName, tc, onBarrierTappedF: widget.onCloseF, justPlaying: false, @@ -159,7 +155,6 @@ class _CalloutConfigToolbarState extends State { ), onPressed: () { PointyTool.show( - widget.twName, tc, // onBarrierTappedF: onParentBarrierTappedF, ancestorHScrollController: widget.ancestorHScrollController, @@ -185,8 +180,7 @@ class _CalloutConfigToolbarState extends State { tc.calloutBorderColorValue = Colors.grey.value; tc.calloutBorderThickness = 2; removeSnippetContentCallout(tc.snippetName); - FC() - .parentTW(widget.twName) + tc.targetsWrapperState ?.zoomer ?.zoomImmediately(tc.transformScale, tc.transformScale); showSnippetContentCallout( @@ -217,7 +211,6 @@ class _CalloutConfigToolbarState extends State { ), onPressed: () { MoreCalloutConfigSettings.show( - widget.twName, widget.tc, ancestorHScrollController: widget.ancestorHScrollController, ancestorVScrollController: widget.ancestorVScrollController, @@ -234,11 +227,12 @@ class _CalloutConfigToolbarState extends State { ), onPressed: () { //TODO FC().capiBloc.add(CAPIEvent.deleteTarget(tc: tc)); - tc.targetWrapperState!.widget.parentNode.targets.remove(tc); + tc.targetsWrapperState?.widget.parentNode.targets.remove(tc); Callout.dismiss('config-toolbar'); removeSnippetContentCallout(tc.snippetName); - FC().parentTW(widget.twName)?.zoomer?.resetTransform(); - FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); + tc.targetsWrapperState?.zoomer?.resetTransform( + afterTransformF: ()=> FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()) + ); }, ), const VerticalDivider(color: Colors.white, width: 2), @@ -251,9 +245,12 @@ class _CalloutConfigToolbarState extends State { onPressed: () { Callout.dismiss('config-toolbar'); removeSnippetContentCallout(tc.snippetName); - FC().parentTW(widget.twName)?.zoomer?.resetTransform(); - FC().capiBloc.add(CAPIEvent.TargetChanged(newTC: tc)); - FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); + tc.targetsWrapperState?.zoomer?.resetTransform( + afterTransformF: () { + FC().capiBloc.add(CAPIEvent.TargetChanged(newTC: tc)); + FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); + } + ); }, ), ], diff --git a/lib/src/api/wrapper/multiple/config_toolbar/colour_callout.dart b/lib/src/api/wrapper/multiple/config_toolbar/colour_callout.dart index fd5624fc..3725d3e7 100644 --- a/lib/src/api/wrapper/multiple/config_toolbar/colour_callout.dart +++ b/lib/src/api/wrapper/multiple/config_toolbar/colour_callout.dart @@ -5,7 +5,6 @@ import 'package:flutter_content/src/snippet/pnodes/editors/easy_color_picker.dar import 'package:flutter_content/src/target_config/content/callout_snippet_content.dart'; class ColourTool extends StatefulWidget { - final TargetsWrapperName twName; final TargetModel tc; final VoidCallback onParentBarrierTappedF; final ScrollController? ancestorHScrollController; @@ -13,7 +12,6 @@ class ColourTool extends StatefulWidget { final bool justPlaying; const ColourTool( - this.twName, this.tc, this.onParentBarrierTappedF, { this.ancestorHScrollController, @@ -26,7 +24,6 @@ class ColourTool extends StatefulWidget { State createState() => _ColourToolState(); static show( - final TargetsWrapperName twName, final TargetModel tc, { required VoidCallback onBarrierTappedF, final ScrollController? ancestorHScrollController, @@ -54,7 +51,6 @@ class ColourTool extends StatefulWidget { notUsingHydratedStorage: true, ), boxContentF: (_) => ColourTool( - twName, tc, onBarrierTappedF, ancestorHScrollController: ancestorHScrollController, @@ -100,9 +96,7 @@ class _ColourToolState extends State { // widget.onParentBarrierTappedF.call(); // Callout.refreshOverlay(tc.snippetName, f: () {}); removeSnippetContentCallout(tc.snippetName); - FC() - .parentTW(widget.twName) - ?.zoomer + tc.targetsWrapperState?.zoomer ?.zoomImmediately(tc.transformScale, tc.transformScale); showSnippetContentCallout( tc: tc, diff --git a/lib/src/api/wrapper/multiple/config_toolbar/more_callout_settings.dart b/lib/src/api/wrapper/multiple/config_toolbar/more_callout_settings.dart index 01a99574..6243006c 100644 --- a/lib/src/api/wrapper/multiple/config_toolbar/more_callout_settings.dart +++ b/lib/src/api/wrapper/multiple/config_toolbar/more_callout_settings.dart @@ -7,13 +7,11 @@ import 'package:flutter_content/src/target_config/content/snippet_editor/node_pr import 'package:flutter_content/src/target_config/content/snippet_editor/node_properties/node_property_button_number.dart'; class MoreCalloutConfigSettings extends StatefulWidget { - final TargetsWrapperName twName; final TargetModel tc; final ScrollController? ancestorHScrollController; final ScrollController? ancestorVScrollController; const MoreCalloutConfigSettings( - this.twName, this.tc, { this.ancestorHScrollController, this.ancestorVScrollController, @@ -25,7 +23,6 @@ class MoreCalloutConfigSettings extends StatefulWidget { _MoreCalloutConfigSettingsState(); static show( - final TargetsWrapperName twName, final TargetModel tc, { final ScrollController? ancestorHScrollController, final ScrollController? ancestorVScrollController, @@ -40,7 +37,6 @@ class MoreCalloutConfigSettings extends StatefulWidget { Callout.showOverlay( targetGkF: () => targetGK, boxContentF: (_) => MoreCalloutConfigSettings( - twName, tc, ancestorHScrollController: ancestorHScrollController, ancestorVScrollController: ancestorVScrollController, @@ -201,8 +197,7 @@ class _MoreCalloutConfigSettingsState extends State { void _refreshContentCallout() { Callout.dismiss(CAPI.MORE_CALLOUT_CONFIG_SETTINGS.name); removeSnippetContentCallout(tc.snippetName); - FC() - .parentTW(widget.twName) + tc.targetsWrapperState ?.zoomer ?.zoomImmediately(tc.transformScale, tc.transformScale); showSnippetContentCallout( diff --git a/lib/src/api/wrapper/multiple/config_toolbar/pointy_callout.dart b/lib/src/api/wrapper/multiple/config_toolbar/pointy_callout.dart index 9ea2b910..148eb27b 100644 --- a/lib/src/api/wrapper/multiple/config_toolbar/pointy_callout.dart +++ b/lib/src/api/wrapper/multiple/config_toolbar/pointy_callout.dart @@ -4,14 +4,12 @@ import 'package:flutter_content/src/bloc/capi_event.dart'; import 'package:flutter_content/src/target_config/content/callout_snippet_content.dart'; class PointyTool extends StatefulWidget { - final TargetsWrapperName twName; final TargetModel tc; final ScrollController? ancestorHScrollController; final ScrollController? ancestorVScrollController; final bool justPlaying; const PointyTool( - this.twName, this.tc, { this.ancestorHScrollController, this.ancestorVScrollController, @@ -22,7 +20,7 @@ class PointyTool extends StatefulWidget { @override State createState() => _PointyToolState(); - static show(final TargetsWrapperName twName, final TargetModel tc, + static show(final TargetModel tc, {final ScrollController? ancestorHScrollController, final ScrollController? ancestorVScrollController, required final bool justPlaying}) { @@ -35,7 +33,6 @@ class PointyTool extends StatefulWidget { Callout.showOverlay( targetGkF: () => targetGK, boxContentF: (_) => PointyTool( - twName, tc, ancestorHScrollController: ancestorHScrollController, ancestorVScrollController: ancestorVScrollController, @@ -85,8 +82,7 @@ class _PointyToolState extends State { // widget.onParentBarrierTappedF.call(); // Callout.refreshOverlay(tc.snippetName, f: () {}); removeSnippetContentCallout(tc.snippetName); - FC() - .parentTW(widget.twName) + tc.targetsWrapperState ?.zoomer ?.zoomImmediately(tc.transformScale, tc.transformScale); showSnippetContentCallout( diff --git a/lib/src/api/wrapper/multiple/positioned_target_cover.dart b/lib/src/api/wrapper/multiple/positioned_target_cover.dart index fd27a38b..c08d9a40 100644 --- a/lib/src/api/wrapper/multiple/positioned_target_cover.dart +++ b/lib/src/api/wrapper/multiple/positioned_target_cover.dart @@ -20,9 +20,10 @@ class PositionedTarget extends StatelessWidget { // in case initialTC replaced by a build ? huh! // if (tc != null) { double radius = tc.radius; + var stackPos = tc.targetStackPos(); return Positioned( - top: tc.targetStackPos().dy - radius, - left: tc.targetStackPos().dx - radius, + top: stackPos.dy - radius, + left: stackPos.dx - radius, child: FC().canEditContent ? Draggable( key: FC().setMultiTargetGk(tc.uid.toString(), GlobalKey()), diff --git a/lib/src/api/wrapper/multiple/positioned_target_cover_btn.dart b/lib/src/api/wrapper/multiple/positioned_target_cover_btn.dart index ec540a75..947a77aa 100644 --- a/lib/src/api/wrapper/multiple/positioned_target_cover_btn.dart +++ b/lib/src/api/wrapper/multiple/positioned_target_cover_btn.dart @@ -9,29 +9,32 @@ import 'config_toolbar/callout_config_toolbar.dart'; // Btn has 2 uses: Tap to play, and DoubleTap to configure, plus it is draggable class PositionedTargetPlayBtn extends StatelessWidget { final TargetModel initialTC; - final TargetsWrapperState parentWrapperState; final int index; const PositionedTargetPlayBtn({ required this.initialTC, - required this.parentWrapperState, required this.index, super.key, }); CAPIBloC get bloc => FC().capiBloc; + TargetsWrapperState? get parentWrapperState { + var state = initialTC.targetsWrapperGK!.currentState as TargetsWrapperState?; + return state; + } + @override Widget build(BuildContext context) { TargetModel? tc = initialTC; //bloc.state.tcByUid(initialTC); return Positioned( top: tc.btnStackPos().dy - bloc.state.CAPI_TARGET_BTN_RADIUS, left: tc.btnStackPos().dx - bloc.state.CAPI_TARGET_BTN_RADIUS, - child: _draggableSelectTargetBtn(context, tc), + child: _draggableSelectTargetBtn(tc), ); } - Widget _draggableSelectTargetBtn(BuildContext context, TargetModel tc) { + Widget _draggableSelectTargetBtn(TargetModel tc) { return Draggable( childWhenDragging: const Offstage(), feedback: IntegerCircleAvatar( @@ -44,17 +47,22 @@ class PositionedTargetPlayBtn extends StatelessWidget { ), child: GestureDetector( onTap: () { - parentWrapperState.widget.parentNode.playList.add(tc); - playTarget(context, tc); - }, - onLongPress: () { - tc.setTargetStackPosPc( - tc.btnStackPos(), - ); - bloc.add(CAPIEvent.TargetChanged(newTC: tc)); + if (parentWrapperState == null) return; + + parentWrapperState!.widget.parentNode.playList.add(tc); + playTarget(tc); }, + // onLongPress: () { + // tc.setTargetStackPosPc( + // tc.btnStackPos(), + // ); + // bloc.add(CAPIEvent.TargetChanged(newTC: tc)); + // }, onDoubleTap: () async { if (!FC().canEditContent) return; + + if (parentWrapperState == null) return; + Alignment? ta = TargetsWrapper.calcTargetAlignmentWithinTargetsWrapper(tc); if (ta == null) return; @@ -62,17 +70,19 @@ class PositionedTargetPlayBtn extends StatelessWidget { // hideAllSingleTargetBtns(); bloc.add(CAPIEvent.showOnlyOneTarget(tc: tc)); - // IMPORTANT applyTransform will destroy this context, so make state available for afterwards - parentWrapperState.zoomer?.applyTransform( - tc.transformScale, tc.transformScale, ta, afterTransformF: () { - showSnippetContentCallout( - tc: tc, - justPlaying: false, - ); - // show config toolbar in a toast - showConfigToolbar( - tc, parentWrapperState.widget.parentNode.name, context); + Useful.afterNextBuildDo(() { + parentWrapperState?.zoomer?.applyTransform( + tc.transformScale, tc.transformScale, ta, afterTransformF: () { + showSnippetContentCallout( + tc: tc, + justPlaying: false, + ); + // show config toolbar in a toast + showConfigToolbar(tc); + }); }); + + // IMPORTANT applyTransform will destroy this context, so make state available for afterwards }, child: IntegerCircleAvatar( tc, @@ -109,50 +119,55 @@ class PositionedTargetPlayBtn extends StatelessWidget { // localPos = localPos * scale; Offset newGlobalPos = offset; //.translate(iwPos.dx, iwPos.dy); // tc.setBtnStackPosPc(newGlobalPos); - tc.setBtnStackPosPc(newGlobalPos - .translate( - bloc.state.CAPI_TARGET_BTN_RADIUS, - bloc.state.CAPI_TARGET_BTN_RADIUS, - ) - .translate( - parentWrapperState - .zoomer?.widget.ancestorHScrollController?.offset ?? - 0.0, - parentWrapperState - .zoomer?.widget.ancestorVScrollController?.offset ?? - 0.0, - ), + tc.setBtnStackPosPc( + newGlobalPos + .translate( + bloc.state.CAPI_TARGET_BTN_RADIUS, + bloc.state.CAPI_TARGET_BTN_RADIUS, + ) + .translate( + parentWrapperState! + .zoomer?.widget.ancestorHScrollController?.offset ?? + 0.0, + parentWrapperState! + .zoomer?.widget.ancestorVScrollController?.offset ?? + 0.0, + ), ); bloc.add(CAPIEvent.TargetChanged(newTC: tc)); + // parentTW!.bloc.add(CAPIEvent.btnMoved(tc: tc, newGlobalPos: newGlobalPos)); }, ); } - void playTarget(context, TargetModel tc) { + void playTarget(TargetModel tc) { + if (parentWrapperState == null) return; + Alignment? ta = TargetsWrapper.calcTargetAlignmentWithinTargetsWrapper(tc); if (ta == null) return; // IMPORTANT applyTransform will destroy this context, so make state available for afterwards - parentWrapperState.zoomer?.applyTransform( + var zoomer = parentWrapperState!.zoomer; + var savedKey = tc.targetsWrapperGK; + zoomer?.applyTransform( tc.transformScale, tc.transformScale, ta, afterTransformF: () { + if (savedKey == tc.targetsWrapperGK) { + debugPrint('doh!'); + } bloc.add(CAPIEvent.hideTargetGroupsExcept(tc: tc)); bloc.add(const CAPIEvent.hideAllTargetGroupBtns()); // hideAllSingleTargetBtns(); + showSnippetContentCallout(tc: tc, justPlaying: true); Useful.afterMsDelayDo(tc.calloutDurationMs, () { - parentWrapperState.zoomer?.resetTransform(); - FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); + parentWrapperState!.zoomer?.resetTransform( + afterTransformF: () => + FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups())); }); - - showSnippetContentCallout(tc: tc, justPlaying: true); }); } - static void showConfigToolbar( - TargetModel tc, - TargetsWrapperName twName, - BuildContext context, - ) { + static void showConfigToolbar(TargetModel tc) { Callout.dismiss('config-toolbar'); Callout.showOverlay( calloutConfig: CalloutConfig( @@ -164,12 +179,11 @@ class PositionedTargetPlayBtn extends StatelessWidget { borderRadius: 20, animate: false, arrowType: ArrowType.NO_CONNECTOR, - initialCalloutPos: FC().calloutConfigToolbarPos(context), + initialCalloutPos: FC().calloutConfigToolbarPos(), onDragEndedF: (newPos) { FC().setCalloutConfigToolbarPos(newPos); }), boxContentF: (ctx) => CalloutConfigToolbar( - twName: twName, tc: tc, onCloseF: () { Callout.dismiss(tc.snippetName); diff --git a/lib/src/api/wrapper/multiple/targets_wrapper.dart b/lib/src/api/wrapper/multiple/targets_wrapper.dart index c41627c4..4dd09c8a 100644 --- a/lib/src/api/wrapper/multiple/targets_wrapper.dart +++ b/lib/src/api/wrapper/multiple/targets_wrapper.dart @@ -1,7 +1,5 @@ // ignore_for_file: camel_case_types -import 'dart:async'; - import 'package:flutter/material.dart'; import 'package:flutter_content/flutter_content.dart'; import 'package:flutter_content/src/bloc/capi_event.dart'; @@ -12,12 +10,12 @@ import 'positioned_target_cover_btn.dart'; class TargetsWrapper extends StatefulWidget { final TargetGroupWrapperNode parentNode; - final Widget child; + final Widget? child; final bool hardEdge; const TargetsWrapper( {required this.parentNode, - required this.child, + this.child, this.hardEdge = true, required super.key}); @@ -64,12 +62,15 @@ class TargetsWrapper extends StatefulWidget { class TargetsWrapperState extends State { // Rect? _selectedTargetRect; + bool _needToMeasure = true; late Offset wrapperPos; - late Size wrapperSize; + late Size _wrapperSize; + Size get wrapperSize => _wrapperSize; + set wrapperSize(Size newSize) => _wrapperSize = newSize; Offset? savedChildLocalPosPc; - Timer? _sizeChangedTimer; + // Timer? _sizeChangedTimer; // bool playing = false; double? scrollOffset; @@ -80,27 +81,50 @@ class TargetsWrapperState extends State { late TargetModel tcToPlay; - ZoomerState? get zoomer => Zoomer.of(context)!; + ZoomerState? get zoomer { + if (context.mounted) { + return Zoomer.of(context)!; + } else { + print('zoomer context'); + } + return null; + } @override void initState() { + debugPrint('TargetsWrapperState initState'); super.initState(); for (TargetModel tc in widget.parentNode.targets) { - tc.targetsWrapperGK = widget.key as GlobalKey; - } - - if (zoomer?.widget.ancestorHScrollController != null) { - FC().registerScrollController(zoomer!.widget.ancestorHScrollController!); - } - if (zoomer?.widget.ancestorVScrollController != null) { - FC().registerScrollController(zoomer!.widget.ancestorVScrollController!); + tc.targetsWrapperNode = widget.parentNode; } Useful.afterNextBuildDo( () { - // register ww with AppWrapper - measureIWPosAndSize(); + // if (zoomer?.widget.ancestorHScrollController != null) { + // FC().registerScrollController(zoomer!.widget.ancestorHScrollController!); + // } + // if (zoomer?.widget.ancestorVScrollController != null) { + // FC().registerScrollController(zoomer!.widget.ancestorVScrollController!); + // } + + setState(() { + measureIWPosAndSize(); + // measure child size + var childGK = widget.child?.key as GlobalKey?; + final renderObject = childGK?.currentContext?.findRenderObject(); + final translation = + renderObject?.getTransformTo(null).getTranslation(); + Rect? paintBounds; + try { + paintBounds = renderObject?.paintBounds; + } catch (e) { + debugPrint( + 'paintBounds = renderObject?.paintBounds - ${e.toString()}'); + } + wrapperSize = paintBounds?.size ?? MediaQuery.of(context).size; + debugPrint('TargetsWrapper.child size: ${wrapperSize.toString()}'); + }); // if (widget.key != null) { // Measuring.findGlobalRect(widget.key! as GlobalKey); // // Size size = CAPIState.iwSize(widget.name); @@ -117,12 +141,12 @@ class TargetsWrapperState extends State { ); } - Rect wwRect(String wName) => Rect.fromLTWH( - wrapperPos.dx, - wrapperPos.dy, - wrapperSize.width, - wrapperSize.height, - ); + // Rect wwRect(String wName) => Rect.fromLTWH( + // wrapperPos?.dx ?? 0, + // wrapperPos?.dy ?? 0, + // wrapperSize?.width ?? Useful.scrW, + // wrapperSize?.height ?? Useful.scrH, + // ); // @override // void didChangeDependencies() { @@ -131,6 +155,7 @@ class TargetsWrapperState extends State { // } void measureIWPosAndSize() { + debugPrint('measureIWPosAndSize'); var newPosAndSize = (widget.key as GlobalKey).globalPosAndSize(); Offset? globalPos; @@ -140,14 +165,17 @@ class TargetsWrapperState extends State { zoomer?.widget.ancestorVScrollController?.offset ?? 0.0, ); if (globalPos != null) { + debugPrint('globalPos != null'); // debugPrint('TargetGroupWrapper.iwPosMap[${widget.name}] = ${globalPos.toString()}'); // debugPrint('TargetGroupWrapper.iwSizeMap[${widget.name}] = ${newPosAndSize.$2!}'); wrapperPos = globalPos; wrapperSize = newPosAndSize.$2!; + //debugPrint('measureIWPosAndSize: wrapper is ${wrapperSize.toString()}'); } + _needToMeasure = false; } catch (e) { // ignore but then don't update pos - debugPrint('measureIWPosAndSizze! ${e.toString()}'); + debugPrint('measureIWPosAndSize! ${e.toString()}'); } } // @override @@ -266,65 +294,71 @@ class TargetsWrapperState extends State { @override Widget build(BuildContext context) { - CAPIBloC bloc = FC().capiBloc; + if (_needToMeasure) { + // setState(() {}); + return const Offstage(); + } + + // CAPIBloC bloc = FC().capiBloc; return _stack(bloc); + // debugPrint("TargetGroupWrapperState.build"); - return NotificationListener( - onNotification: (SizeChangedLayoutNotification notification) { - // debugPrint("CAPIWidgetWrapperState on Size Change Notification - ${widget.name}"); - // removeDottedBorderCallout(); - // update size at end of resize - _sizeChangedTimer?.cancel(); - _sizeChangedTimer = Timer(const Duration(milliseconds: 500), () { - bloc.add(const CAPIEvent.forceRefresh()); - Useful.afterNextBuildDo(() { - debugPrint('SizeChangedLayoutNotification: measureIWPos...'); - measureIWPosAndSize(); - }); - }); - return true; - }, - child: SizeChangedLayoutNotifier( - child: SizedBox( - child: _stack(bloc), - ), - ), - ); + // return NotificationListener( + // onNotification: (SizeChangedLayoutNotification notification) { + // // debugPrint("CAPIWidgetWrapperState on Size Change Notification - ${widget.name}"); + // // removeDottedBorderCallout(); + // // update size at end of resize + // _sizeChangedTimer?.cancel(); + // _sizeChangedTimer = Timer(const Duration(milliseconds: 500), () { + // bloc.add(const CAPIEvent.forceRefresh()); + // Useful.afterNextBuildDo(() { + // debugPrint('SizeChangedLayoutNotification: measureIWPos...'); + // measureIWPosAndSize(); + // }); + // }); + // return true; + // }, + // child: SizeChangedLayoutNotifier( + // child: SizedBox( + // child: _stack(bloc), + // ), + // ), + // ); } - Stack _stack(CAPIBloC bloc) { + Widget _stack(CAPIBloC bloc) { // TargetGroupModel? config = state.imageConfig(widget.name); List tcs = widget.parentNode.targets; - return Stack( - clipBehavior: widget.hardEdge ? Clip.hardEdge : Clip.none, - children: [ - // if (!state.aTargetIsSelected()) - // RESUMED NO SELECTION - LONG-PRESSABLE BARRIER - _no_selection_long_pressable_barrier_build(bloc), - _image_child_build(bloc.state), - // PLAYING BUILD - for (TargetModel tc in tcs) - if (!bloc.state.hideAllTargetGroups && - (bloc.state.hideTargetsExcept == null || - bloc.state.hideTargetsExcept == tc)) - // if (!state.aTargetIsSelected() || state.selectedTarget!.uid == tc.uid ) - PositionedTarget( - tc, - _targetIndex(tc), - ), - // if (!state.aTargetIsSelected() && transformableWidgetWrapperState != null) - if (zoomer != null) - for (var tc in tcs.where((el) => el.showBtn)) - // if (state.hideTargetsExcept == null && tc.visible) - if (!bloc.state.hideAllTargetGroupPlayBtns) - PositionedTargetPlayBtn( - initialTC: tc, - parentWrapperState: this, - index: _targetIndex(tc)), - // if (!state.isSuspended(widget.name) && (state.aTargetIsSelected(widget.name))) - // buildPositionedDraggableTarget(state.selectedTarget(widget.name)!), - // if (bloc.state.playList.isNotEmpty) buildPositionedTargetForPlay(tcToPlay), - ], + return SizedBox.fromSize( + size: wrapperSize, + child: Stack( + clipBehavior: widget.hardEdge ? Clip.hardEdge : Clip.none, + children: [ + // if (!state.aTargetIsSelected()) + // RESUMED NO SELECTION - LONG-PRESSABLE BARRIER + _no_selection_long_pressable_barrier_build(bloc), + _childBuild(bloc.state), + // PLAYING BUILD + for (TargetModel tc in tcs) + if (!bloc.state.hideAllTargetGroups && + (bloc.state.hideTargetsExcept == null || + bloc.state.hideTargetsExcept == tc)) + // if (!state.aTargetIsSelected() || state.selectedTarget!.uid == tc.uid ) + PositionedTarget( + tc, + _targetIndex(tc), + ), + // if (!state.aTargetIsSelected() && transformableWidgetWrapperState != null) + if (zoomer != null) + for (var tc in tcs.where((el) => el.showBtn)) + // if (state.hideTargetsExcept == null && tc.visible) + if (!bloc.state.hideAllTargetGroupPlayBtns) + PositionedTargetPlayBtn(initialTC: tc, index: _targetIndex(tc)), + // if (!state.isSuspended(widget.name) && (state.aTargetIsSelected(widget.name))) + // buildPositionedDraggableTarget(state.selectedTarget(widget.name)!), + // if (bloc.state.playList.isNotEmpty) buildPositionedTargetForPlay(tcToPlay), + ], + ), ); } @@ -373,76 +407,109 @@ class TargetsWrapperState extends State { // : widget.imageF.call(), // ); - Widget _no_selection_long_pressable_barrier_build(CAPIBloC bloc) => - GestureDetector( - // onTapDown: (_) { - // debugPrint("_no_selection_long_pressable_barrier_build tapped."); - // TargetModel? selectedTC = bloc.state.hideTargetsExcept; - // if (Callout.anyPresent([snippetCalloutFeature(selectedTC?.snippetName ?? '')])) { - // parentTW?.resetTransform(); - // removeSnippetContentCallout(selectedTC!.snippetName); - // bloc.add(const CAPIEvent.unhideAllTargetGroups()); - // unhideAllSingleTargetBtns(); - // Callout.removeOverlay(snippetCalloutFeature(bloc.state.selectedTarget!.snippetName)); - // } - // }, - // long press creates a new target for this TargetWrapper - onLongPressStart: (LongPressStartDetails details) { - if (!FC().canEditContent) return; - SnippetName? snippetName = - widget.parentNode.rootNodeOfSnippet()?.name; - if (snippetName == null) return; - bloc.add(const CAPIEvent.hideAllTargetGroups()); - TargetModelId newTargetId = DateTime.now().millisecondsSinceEpoch; - TargetModel newTC = TargetModel( - uid: newTargetId, //event.wName.hashCode, - wName: widget.parentNode.name, - snippetName: snippetName, - // single: false, - ); - Offset newGlobalPos = details.globalPosition.translate( - zoomer?.widget.ancestorHScrollController?.offset ?? 0.0, - zoomer?.widget.ancestorVScrollController?.offset ?? 0.0, - ); - newTC.setTargetStackPosPc( - newGlobalPos, - ); - bool onLeft = newTC.targetLocalPosLeftPc! < .5; - newTC.btnLocalTopPc = newTC.targetLocalPosTopPc; - newTC.btnLocalLeftPc = - newTC.targetLocalPosLeftPc! + (onLeft ? .02 : -.02); - - widget.parentNode.targets.add(newTC); - bloc.add(CAPIEvent.forceRefresh()); - + Widget _no_selection_long_pressable_barrier_build(CAPIBloC bloc) { + // return GestureDetector( + // onTap: (){ + // debugPrint('HOORAY!'); + // }, + // child: Container(color: Colors.red, width: 500, height: 500,)); + return GestureDetector( + // onTap: () { + // debugPrint('_no_selection_long_pressable_barrier_build ontap'); + // }, + // onTapDown: (_) { + // debugPrint("_no_selection_long_pressable_barrier_build tapped."); + // TargetModel? selectedTC = bloc.state.hideTargetsExcept; + // if (Callout.anyPresent([snippetCalloutFeature(selectedTC?.snippetName ?? '')])) { + // parentTW?.resetTransform(); + // removeSnippetContentCallout(selectedTC!.snippetName); + // bloc.add(const CAPIEvent.unhideAllTargetGroups()); + // unhideAllSingleTargetBtns(); + // Callout.removeOverlay(snippetCalloutFeature(bloc.state.selectedTarget!.snippetName)); + // } + // }, + //long press creates a new target for this TargetWrapper + onLongPressStart: (LongPressStartDetails details) { + if (!FC().canEditContent) return; + SnippetName? snippetName = widget.parentNode.rootNodeOfSnippet()?.name; + if (snippetName == null) return; + bloc.add(const CAPIEvent.hideAllTargetGroups()); + TargetModelId newTargetId = DateTime.now().millisecondsSinceEpoch; + TargetModel newTC = TargetModel( + uid: newTargetId, //event.wName.hashCode, + snippetName: snippetName, + // single: false, + )..targetsWrapperNode = widget.parentNode; + Offset newGlobalPos = details.globalPosition.translate( + zoomer?.widget.ancestorHScrollController?.offset ?? 0.0, + zoomer?.widget.ancestorVScrollController?.offset ?? 0.0, + ); + newTC.setTargetStackPosPc( + newGlobalPos, + ); + bool onLeft = newTC.targetLocalPosLeftPc! < .5; + newTC.btnLocalTopPc = newTC.targetLocalPosTopPc; + newTC.btnLocalLeftPc = + newTC.targetLocalPosLeftPc! + (onLeft ? .02 : -.02); + + widget.parentNode.targets.add(newTC); + bloc.add(const CAPIEvent.forceRefresh()); + + Useful.afterNextBuildDo(() { + bloc.add(const CAPIEvent.unhideAllTargetGroups()); Useful.afterNextBuildDo(() { - bloc.add(const CAPIEvent.unhideAllTargetGroups()); + // TargetGroupModel? mtc = bloc.state.targetGroupMap[widget.name]; + VersionId newVersionId = + DateTime.now().millisecondsSinceEpoch.toString(); + FC().updateEditingVersionId( + snippetName: snippetName, newVersionId: newVersionId); + bloc.add(CAPIEvent.saveSnippet( + snippetRootNode: widget.parentNode.rootNodeOfSnippet()!, + newVersionId: newVersionId)); Useful.afterNextBuildDo(() { - // TargetGroupModel? mtc = bloc.state.targetGroupMap[widget.name]; - VersionId newVersionId = - DateTime.now().millisecondsSinceEpoch.toString(); - bloc.add(CAPIEvent.saveSnippet( - snippetRootNode: widget.parentNode.rootNodeOfSnippet()!, - newVersionId: newVersionId)); + bloc.add(const CAPIEvent.forceRefresh()); }); }); - }, - child: SizedBox.fromSize( - size: wrapperSize, - child: ModalBarrier( - color: !widget.parentNode.playList.isNotEmpty - ? Colors.purple.withOpacity(.25) - : null, - dismissible: false, - ), + }); + }, + child: SizedBox.fromSize( + size: Size.infinite, + child: Container( + color: Colors.lime, + width: double.infinity, + height: double.infinity, ), - ); + // child: ModalBarrier( + // color: !widget.parentNode.playList.isNotEmpty + // ? Colors.purple.withOpacity(.25) + // : null, + // dismissible: false, + // ), + ), + ); + } - Widget _image_child_build(final CAPIState state) { + Widget _childBuild(final CAPIState state) { + // return IgnorePointer( + // child: GestureDetector( + // onTap: (){ + // debugPrint('xxxxxx'); + // }, + // child: Container(color: Colors.blue, width: 300, height: 300,)), + // ); // var sizeMap = CAPIState.iwSizeMap; //debugPrint("sizeMap: ${sizeMap.toString()}"); // var gkMap = CAPIState.gkMap; // debugPrint("gkMap: ${gkMap.toString()}"); + Widget child = widget.child ?? + const Material( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Text( + 'Add a Child to the Targets Wrapper; \ne.g. an image over which \nyou will place callout targets'), + ), + ); + return wrapperSize != Size.zero ? IgnorePointer( ignoring: true, //!state.aTargetIsSelected(), @@ -452,7 +519,7 @@ class TargetsWrapperState extends State { wrapperSize = size; // debugPrint("MeasureSizeBox => ${size.toString()}"); }, - child: widget.child, + child: child, ), ) : MeasureSizeBox( @@ -465,7 +532,7 @@ class TargetsWrapperState extends State { setState(() {}); }); }, - child: widget.child, + child: child, ); } } diff --git a/lib/src/api/wrapper/zoomer.dart b/lib/src/api/wrapper/zoomer.dart index ed2bec35..5bfa7ef7 100644 --- a/lib/src/api/wrapper/zoomer.dart +++ b/lib/src/api/wrapper/zoomer.dart @@ -78,11 +78,14 @@ class ZoomerState extends State } } - void resetTransform() { + void resetTransform({required VoidCallback afterTransformF}) { Duration? savedDuration = _aController.duration; _aController ..duration = const Duration(milliseconds: 200) - ..reverse().then((value) => {_aController.duration = savedDuration}); + ..reverse().then((value) { + _aController.duration = savedDuration; + afterTransformF.call(); + }); } @override diff --git a/lib/src/bloc/capi_bloc.dart b/lib/src/bloc/capi_bloc.dart index cdac9e05..e059a4c6 100644 --- a/lib/src/bloc/capi_bloc.dart +++ b/lib/src/bloc/capi_bloc.dart @@ -188,7 +188,9 @@ class CAPIBloC extends Bloc { // } // save to firebase - await modelRepo.saveSnippet(snippetName: event.snippetRootNode.name, newVersionId: event.newVersionId); + await modelRepo.saveSnippet( + snippetRootNode: event.snippetRootNode, + newVersionId: event.newVersionId); // } // } else { @@ -246,7 +248,8 @@ class CAPIBloC extends Bloc { textColor: Colors.blueAccent, ); - modelRepo.revertSnippet(snippetName: event.snippetName, toVersionId: event.versionId); + modelRepo.revertSnippet( + snippetName: event.snippetName, toVersionId: event.versionId); if (stopwatch.elapsedMilliseconds < 2000) { Future.delayed( @@ -272,7 +275,8 @@ class CAPIBloC extends Bloc { textColor: Colors.blueAccent, ); - await modelRepo.publishSnippet(snippetName: event.snippetName, versionId: event.versionId); + await modelRepo.publishSnippet( + snippetName: event.snippetName, versionId: event.versionId); if (stopwatch.elapsedMilliseconds < 2000) { await Future.delayed( @@ -291,6 +295,7 @@ class CAPIBloC extends Bloc { // debugPrint("forceRefresh"); emit(state.copyWith( force: state.force + 1, + skipSnippetPanelRebuild: false, )); } @@ -572,7 +577,36 @@ class CAPIBloC extends Bloc { // emit(state.copyWith()); // } - void _targetChanged(TargetChanged event, emit) { + Future _targetChanged(TargetChanged event, emit) async { + SnippetRootNode? rootNode = + event.newTC.targetsWrapperNode?.rootNodeOfSnippet(); + if (rootNode != null) { + VersionId newVersionId = DateTime.now().millisecondsSinceEpoch.toString(); + FC().addToSnippetCache( + snippetName: event.newTC.snippetName, + rootNode: rootNode, + versionId: newVersionId); + FC().updateEditingVersionId( + snippetName: event.newTC.snippetName, newVersionId: newVersionId); + // debugPrint('saving ${state.snippetTreeCalloutW}, ${state.snippetTreeCalloutH}'); + var appInfoMap = FC().appInfoAsMap; + await modelRepo.saveSnippet( + snippetRootNode: rootNode, newVersionId: newVersionId); + appInfoMap = FC().appInfoAsMap; + Callout.dismissAll(onlyToasts: true); + HydratedBloc.storage.write('flutter-content', rootNode.toJson()); + Callout.showTextToast( + feature: "saving-model", + msgText: 'saving changes...', + backgroundColor: Colors.yellow, + width: Useful.scrW * .8, + height: 40, + gravity: Alignment.topCenter, + textColor: Colors.blueAccent, + removeAfterMs: 500, + ); + } + emit(state.copyWith( // targetGroupMap: newMap, hideAllTargetGroups: @@ -882,9 +916,8 @@ class CAPIBloC extends Bloc { } void _pushSnippetBloc(PushSnippetBloc event, emit) { - FC fc = FC(); SnippetRootNode? rootNode = - fc.rootNodeOfEditingSnippet(event.snippetName); + FC().rootNodeOfEditingSnippet(event.snippetName); if (rootNode == null) return; SnippetTreeController newTreeC() => SnippetTreeController( @@ -899,14 +932,16 @@ class CAPIBloC extends Bloc { treeC: newTreeC()..expandAll(), // treeUR: SnippetTreeUR() ); - fc.jsonBeforePush = rootNode.toJson(); - fc.pushSnippet(newSnippetBloc); + FC() + ..jsonBeforePush = rootNode.toJson() + ..pushSnippet(newSnippetBloc); - // emit(state.copyWith( - // hideAllTargetGroupPlayBtns: true, - // hideTargetsExcept: null, - // hideSnippetPencilIcons: true, - // )); + emit(state.copyWith( + hideAllTargetGroupPlayBtns: true, + hideTargetsExcept: null, + hideSnippetPencilIcons: true, + skipSnippetPanelRebuild: true, + )); } Future _popSnippetBloc(PopSnippetBloc event, emit) async { diff --git a/lib/src/bloc/capi_state.dart b/lib/src/bloc/capi_state.dart index de5795ee..dbfb4214 100644 --- a/lib/src/bloc/capi_state.dart +++ b/lib/src/bloc/capi_state.dart @@ -51,6 +51,7 @@ class CAPIState with _$CAPIState { // EncodedJson? jsonClipboardForMove, @Default(true) bool showClipboardContent, @Default(0) int force, // hacky way to force a transition + @Default(false) bool skipSnippetPanelRebuild, // hacky way to force a transition // @Default(true) bool ONLY_TESTING, }) = _CAPIState; diff --git a/lib/src/bloc/capi_state.freezed.dart b/lib/src/bloc/capi_state.freezed.dart index 2c12a9ae..269ce067 100644 --- a/lib/src/bloc/capi_state.freezed.dart +++ b/lib/src/bloc/capi_state.freezed.dart @@ -48,6 +48,8 @@ mixin _$CAPIState { bool get showClipboardContent => throw _privateConstructorUsedError; int get force => throw _privateConstructorUsedError; // hacky way to force a transition + bool get skipSnippetPanelRebuild => + throw _privateConstructorUsedError; // hacky way to force a transition // bool get ONLY_TESTING => throw _privateConstructorUsedError; @@ -79,6 +81,7 @@ abstract class $CAPIStateCopyWith<$Res> { bool trainerIsSignedn, bool showClipboardContent, int force, + bool skipSnippetPanelRebuild, bool ONLY_TESTING}); } @@ -112,6 +115,7 @@ class _$CAPIStateCopyWithImpl<$Res, $Val extends CAPIState> Object? trainerIsSignedn = null, Object? showClipboardContent = null, Object? force = null, + Object? skipSnippetPanelRebuild = null, Object? ONLY_TESTING = null, }) { return _then(_value.copyWith( @@ -183,6 +187,10 @@ class _$CAPIStateCopyWithImpl<$Res, $Val extends CAPIState> ? _value.force : force // ignore: cast_nullable_to_non_nullable as int, + skipSnippetPanelRebuild: null == skipSnippetPanelRebuild + ? _value.skipSnippetPanelRebuild + : skipSnippetPanelRebuild // ignore: cast_nullable_to_non_nullable + as bool, ONLY_TESTING: null == ONLY_TESTING ? _value.ONLY_TESTING : ONLY_TESTING // ignore: cast_nullable_to_non_nullable @@ -217,6 +225,7 @@ abstract class _$$CAPIStateImplCopyWith<$Res> bool trainerIsSignedn, bool showClipboardContent, int force, + bool skipSnippetPanelRebuild, bool ONLY_TESTING}); } @@ -248,6 +257,7 @@ class __$$CAPIStateImplCopyWithImpl<$Res> Object? trainerIsSignedn = null, Object? showClipboardContent = null, Object? force = null, + Object? skipSnippetPanelRebuild = null, Object? ONLY_TESTING = null, }) { return _then(_$CAPIStateImpl( @@ -319,6 +329,10 @@ class __$$CAPIStateImplCopyWithImpl<$Res> ? _value.force : force // ignore: cast_nullable_to_non_nullable as int, + skipSnippetPanelRebuild: null == skipSnippetPanelRebuild + ? _value.skipSnippetPanelRebuild + : skipSnippetPanelRebuild // ignore: cast_nullable_to_non_nullable + as bool, ONLY_TESTING: null == ONLY_TESTING ? _value.ONLY_TESTING : ONLY_TESTING // ignore: cast_nullable_to_non_nullable @@ -348,6 +362,7 @@ class _$CAPIStateImpl extends _CAPIState { this.trainerIsSignedn = false, this.showClipboardContent = true, this.force = 0, + this.skipSnippetPanelRebuild = false, this.ONLY_TESTING = true}) : super._(); @@ -412,6 +427,10 @@ class _$CAPIStateImpl extends _CAPIState { @override @JsonKey() final int force; +// hacky way to force a transition + @override + @JsonKey() + final bool skipSnippetPanelRebuild; // hacky way to force a transition // @override @@ -420,7 +439,7 @@ class _$CAPIStateImpl extends _CAPIState { @override String toString() { - return 'CAPIState(initialValueJsonAssetPath: $initialValueJsonAssetPath, hideIframes: $hideIframes, hideSnippetPencilIcons: $hideSnippetPencilIcons, snippetTreeCalloutW: $snippetTreeCalloutW, snippetTreeCalloutH: $snippetTreeCalloutH, directoryTreeCalloutInitialPos: $directoryTreeCalloutInitialPos, directoryTreeCalloutW: $directoryTreeCalloutW, directoryTreeCalloutH: $directoryTreeCalloutH, hideTargetsExcept: $hideTargetsExcept, hideAllTargetGroups: $hideAllTargetGroups, hideAllTargetGroupPlayBtns: $hideAllTargetGroupPlayBtns, newestTarget: $newestTarget, selectedTarget: $selectedTarget, selectedPanel: $selectedPanel, trainerIsSignedn: $trainerIsSignedn, showClipboardContent: $showClipboardContent, force: $force, ONLY_TESTING: $ONLY_TESTING)'; + return 'CAPIState(initialValueJsonAssetPath: $initialValueJsonAssetPath, hideIframes: $hideIframes, hideSnippetPencilIcons: $hideSnippetPencilIcons, snippetTreeCalloutW: $snippetTreeCalloutW, snippetTreeCalloutH: $snippetTreeCalloutH, directoryTreeCalloutInitialPos: $directoryTreeCalloutInitialPos, directoryTreeCalloutW: $directoryTreeCalloutW, directoryTreeCalloutH: $directoryTreeCalloutH, hideTargetsExcept: $hideTargetsExcept, hideAllTargetGroups: $hideAllTargetGroups, hideAllTargetGroupPlayBtns: $hideAllTargetGroupPlayBtns, newestTarget: $newestTarget, selectedTarget: $selectedTarget, selectedPanel: $selectedPanel, trainerIsSignedn: $trainerIsSignedn, showClipboardContent: $showClipboardContent, force: $force, skipSnippetPanelRebuild: $skipSnippetPanelRebuild, ONLY_TESTING: $ONLY_TESTING)'; } @override @@ -428,8 +447,7 @@ class _$CAPIStateImpl extends _CAPIState { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CAPIStateImpl && - (identical(other.initialValueJsonAssetPath, - initialValueJsonAssetPath) || + (identical(other.initialValueJsonAssetPath, initialValueJsonAssetPath) || other.initialValueJsonAssetPath == initialValueJsonAssetPath) && (identical(other.hideIframes, hideIframes) || other.hideIframes == hideIframes) && @@ -466,31 +484,36 @@ class _$CAPIStateImpl extends _CAPIState { (identical(other.showClipboardContent, showClipboardContent) || other.showClipboardContent == showClipboardContent) && (identical(other.force, force) || other.force == force) && + (identical( + other.skipSnippetPanelRebuild, skipSnippetPanelRebuild) || + other.skipSnippetPanelRebuild == skipSnippetPanelRebuild) && (identical(other.ONLY_TESTING, ONLY_TESTING) || other.ONLY_TESTING == ONLY_TESTING)); } @override - int get hashCode => Object.hash( - runtimeType, - initialValueJsonAssetPath, - hideIframes, - hideSnippetPencilIcons, - snippetTreeCalloutW, - snippetTreeCalloutH, - directoryTreeCalloutInitialPos, - directoryTreeCalloutW, - directoryTreeCalloutH, - hideTargetsExcept, - hideAllTargetGroups, - hideAllTargetGroupPlayBtns, - newestTarget, - selectedTarget, - selectedPanel, - trainerIsSignedn, - showClipboardContent, - force, - ONLY_TESTING); + int get hashCode => Object.hashAll([ + runtimeType, + initialValueJsonAssetPath, + hideIframes, + hideSnippetPencilIcons, + snippetTreeCalloutW, + snippetTreeCalloutH, + directoryTreeCalloutInitialPos, + directoryTreeCalloutW, + directoryTreeCalloutH, + hideTargetsExcept, + hideAllTargetGroups, + hideAllTargetGroupPlayBtns, + newestTarget, + selectedTarget, + selectedPanel, + trainerIsSignedn, + showClipboardContent, + force, + skipSnippetPanelRebuild, + ONLY_TESTING + ]); @JsonKey(ignore: true) @override @@ -518,6 +541,7 @@ abstract class _CAPIState extends CAPIState { final bool trainerIsSignedn, final bool showClipboardContent, final int force, + final bool skipSnippetPanelRebuild, final bool ONLY_TESTING}) = _$CAPIStateImpl; _CAPIState._() : super._(); @@ -564,6 +588,8 @@ abstract class _CAPIState extends CAPIState { @override int get force; @override // hacky way to force a transition + bool get skipSnippetPanelRebuild; + @override // hacky way to force a transition // bool get ONLY_TESTING; @override diff --git a/lib/src/bloc/snippet_bloc.dart b/lib/src/bloc/snippet_bloc.dart index 4f90c2c2..210c5927 100644 --- a/lib/src/bloc/snippet_bloc.dart +++ b/lib/src/bloc/snippet_bloc.dart @@ -7,7 +7,6 @@ import 'package:flutter_content/src/snippet/pnodes/groups/text_style_group.dart' import 'package:flutter_content/src/snippet/snodes/edgeinsets_node_value.dart'; import 'package:flutter_content/src/snippet/snodes/fs_image_node.dart'; import 'package:flutter_content/src/snippet/snodes/upto6color_values.dart'; -import 'package:flutter_fancy_tree_view/flutter_fancy_tree_view.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart'; import 'capi_event.dart'; @@ -28,14 +27,14 @@ class SnippetBloC extends Bloc { treeC: treeC, // ur: treeUR, selectedNode: selectedNode, - selectedWidgetGK: selectedWidgetGK, + // selectedWidgetGK: selectedWidgetGK, selectedTreeNodeGK: selectedTreeNodeGK, )) { // debugPrint("\n\nCreating SnippetBloC ${node.name}\n\n"); // events on((event, emit) => _selectNode(event, emit)); on((event, emit) => _clearNodeSelection(event, emit)); - on((event, emit) => _highlightNode(event, emit)); + // on((event, emit) => _highlightNode(event, emit)); on((event, emit) => _saveNodeAsSnippet(event, emit)); on((event, emit) => _forceSnippetRefresh(event, emit)); on((event, emit) => _wrapWith(event, emit)); @@ -96,10 +95,12 @@ class SnippetBloC extends Bloc { // STreeNodeBloc newBloc = STreeNodeBloc(node: snode); // if new selection is a node above this tree root, reset the tree's root to it - TreeSearchResult result = - state.treeC.search((snode) => snode == event.node); + bool resetTree = + !state.treeC.nodeIsADescendantOf(state.treeC.roots.first, event.node); + // TreeSearchResult result = + // state.treeC.search((snode) => snode == event.node); SnippetTreeController possiblyNewTreeC = state.treeC; - if (result.matches.isEmpty) { + if (resetTree) { possiblyNewTreeC = SnippetTreeController( roots: [event.node], childrenProvider: Node.snippetTreeChildrenProvider, @@ -111,8 +112,8 @@ class SnippetBloC extends Bloc { // selectedNodePropertiesTreeExpandedNodes: {}, // selectedNodePropertiesPaneScrollPos: 0, // selectedNodeBloc: newBloc, - highlightedNode: null, - selectedWidgetGK: event.selectedWidgetGK, + // highlightedNode: null, + // selectedWidgetGK: event.selectedWidgetGK, selectedTreeNodeGK: event.selectedTreeNodeGK, showProperties: true, nodeBeingDeleted: null, @@ -121,12 +122,12 @@ class SnippetBloC extends Bloc { // } } - void _highlightNode(HighlightNode event, emit) { - emit(state.copyWith( - highlightedNode: event.node, - )); - // } - } + // void _highlightNode(HighlightNode event, emit) { + // emit(state.copyWith( + // highlightedNode: event.node, + // )); + // // } + // } void _clearNodeSelection(event, emit) { emit(state.copyWith( @@ -313,7 +314,8 @@ class SnippetBloC extends Bloc { _cutIncludingAnyChildren(event.node); state.treeC.rebuild(); // bool well = state.rootNode.anyMissingParents(); - event.capiBloc.add(CAPIEvent.updateClipboard(newContent: event.node, skipSave: event.skipSave)); + event.capiBloc.add(CAPIEvent.updateClipboard( + newContent: event.node, skipSave: event.skipSave)); } _cutIncludingAnyChildren(STreeNode node) { @@ -366,7 +368,8 @@ class SnippetBloC extends Bloc { // } Future _copyNode(CopyNode event, emit) async { - FC().capiBloc.add(CAPIEvent.updateClipboard(newContent: event.node, skipSave: event.skipSave)); + FC().capiBloc.add(CAPIEvent.updateClipboard( + newContent: event.node, skipSave: event.skipSave)); } STreeNode _typeAsATreeNode( @@ -436,8 +439,7 @@ class SnippetBloC extends Bloc { const (SingleChildScrollViewNode) => SingleChildScrollViewNode(child: childNode), const (SizedBoxNode) => SizedBoxNode(child: childNode), - const (SnippetRefNode) => - SnippetRefNode(snippetName: 'name?'), + const (SnippetRefNode) => SnippetRefNode(snippetName: 'name?'), const (SplitViewNode) => SplitViewNode(children: childNode != null ? [childNode] : []), const (StackNode) => @@ -486,7 +488,7 @@ class SnippetBloC extends Bloc { // const (TargetButtonNode) => // TargetButtonNode(name: 'no name!', child: childNode), const (TargetGroupWrapperNode) => - TargetGroupWrapperNode(name: 'name?', child: childNode), + TargetGroupWrapperNode(child: childNode), const (TextButtonNode) => TextButtonNode(), const (TextNode) => TextNode(text: 'abc'), const (TextSpanNode) => TextSpanNode(children: []), @@ -560,6 +562,7 @@ class SnippetBloC extends Bloc { state.treeC.expand(w); state.treeC.rebuild(); + emit(state.copyWith( selectedNode: w, )); @@ -988,9 +991,12 @@ class SnippetBloC extends Bloc { _cutIncludingAnyChildren(event.node); // create new snippet - SnippetRootNode newRootNode = SnippetRootNode(name: event.newSnippetName, child: event.node); + SnippetRootNode newRootNode = + SnippetRootNode(name: event.newSnippetName, child: event.node); VersionId newVersionId = DateTime.now().millisecondsSinceEpoch.toString(); - await FC().fbModelRepo.saveSnippet(snippetName: event.newSnippetName, newVersionId: newVersionId); + await FC() + .fbModelRepo + .saveSnippet(snippetRootNode: newRootNode, newVersionId: newVersionId); FC().snippetCache[event.newSnippetName] = {}; // FlutterContent().capiBloc.add(CAPIEvent.createdSnippet(newSnippetNode: newRootNode)); diff --git a/lib/src/bloc/snippet_event.dart b/lib/src/bloc/snippet_event.dart index c96281d6..56bae9a4 100644 --- a/lib/src/bloc/snippet_event.dart +++ b/lib/src/bloc/snippet_event.dart @@ -9,7 +9,7 @@ part 'snippet_event.freezed.dart'; class SnippetEvent with _$SnippetEvent { const factory SnippetEvent.selectNode({ required STreeNode node, - required GlobalKey selectedWidgetGK, + // required GlobalKey selectedWidgetGK, required GlobalKey selectedTreeNodeGK, // TargetModel? imageTC, // TargetModel? widgetTC, @@ -22,9 +22,9 @@ class SnippetEvent with _$SnippetEvent { required String newSnippetName, }) = SaveNodeAsSnippet; - const factory SnippetEvent.highlightNode({ - required STreeNode? node, - }) = HighlightNode; + // const factory SnippetEvent.highlightNode({ + // required STreeNode? node, + // }) = HighlightNode; // const factory SnippetEvent.showNodeProperties({ // required Node node, diff --git a/lib/src/bloc/snippet_event.freezed.dart b/lib/src/bloc/snippet_event.freezed.dart index ce168032..f1c4704f 100644 --- a/lib/src/bloc/snippet_event.freezed.dart +++ b/lib/src/bloc/snippet_event.freezed.dart @@ -19,14 +19,11 @@ mixin _$SnippetEvent { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -67,14 +64,11 @@ mixin _$SnippetEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -106,14 +100,11 @@ mixin _$SnippetEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -149,7 +140,6 @@ mixin _$SnippetEvent { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -175,7 +165,6 @@ mixin _$SnippetEvent { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -200,7 +189,6 @@ mixin _$SnippetEvent { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -248,9 +236,7 @@ abstract class _$$SelectNodeImplCopyWith<$Res> { __$$SelectNodeImplCopyWithImpl<$Res>; @useResult $Res call( - {STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK}); + {STreeNode node, GlobalKey> selectedTreeNodeGK}); } /// @nodoc @@ -265,7 +251,6 @@ class __$$SelectNodeImplCopyWithImpl<$Res> @override $Res call({ Object? node = null, - Object? selectedWidgetGK = null, Object? selectedTreeNodeGK = null, }) { return _then(_$SelectNodeImpl( @@ -273,10 +258,6 @@ class __$$SelectNodeImplCopyWithImpl<$Res> ? _value.node : node // ignore: cast_nullable_to_non_nullable as STreeNode, - selectedWidgetGK: null == selectedWidgetGK - ? _value.selectedWidgetGK - : selectedWidgetGK // ignore: cast_nullable_to_non_nullable - as GlobalKey>, selectedTreeNodeGK: null == selectedTreeNodeGK ? _value.selectedTreeNodeGK : selectedTreeNodeGK // ignore: cast_nullable_to_non_nullable @@ -289,20 +270,17 @@ class __$$SelectNodeImplCopyWithImpl<$Res> class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { const _$SelectNodeImpl( - {required this.node, - required this.selectedWidgetGK, - required this.selectedTreeNodeGK}); + {required this.node, required this.selectedTreeNodeGK}); @override final STreeNode node; - @override - final GlobalKey> selectedWidgetGK; +// required GlobalKey selectedWidgetGK, @override final GlobalKey> selectedTreeNodeGK; @override String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'SnippetEvent.selectNode(node: $node, selectedWidgetGK: $selectedWidgetGK, selectedTreeNodeGK: $selectedTreeNodeGK)'; + return 'SnippetEvent.selectNode(node: $node, selectedTreeNodeGK: $selectedTreeNodeGK)'; } @override @@ -311,7 +289,6 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { properties ..add(DiagnosticsProperty('type', 'SnippetEvent.selectNode')) ..add(DiagnosticsProperty('node', node)) - ..add(DiagnosticsProperty('selectedWidgetGK', selectedWidgetGK)) ..add(DiagnosticsProperty('selectedTreeNodeGK', selectedTreeNodeGK)); } @@ -321,15 +298,12 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { (other.runtimeType == runtimeType && other is _$SelectNodeImpl && (identical(other.node, node) || other.node == node) && - (identical(other.selectedWidgetGK, selectedWidgetGK) || - other.selectedWidgetGK == selectedWidgetGK) && (identical(other.selectedTreeNodeGK, selectedTreeNodeGK) || other.selectedTreeNodeGK == selectedTreeNodeGK)); } @override - int get hashCode => - Object.hash(runtimeType, node, selectedWidgetGK, selectedTreeNodeGK); + int get hashCode => Object.hash(runtimeType, node, selectedTreeNodeGK); @JsonKey(ignore: true) @override @@ -341,14 +315,11 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -386,20 +357,17 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { required TResult Function(String name) redo, required TResult Function() forceSnippetRefresh, }) { - return selectNode(node, selectedWidgetGK, selectedTreeNodeGK); + return selectNode(node, selectedTreeNodeGK); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -428,20 +396,17 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { TResult? Function(String name)? redo, TResult? Function()? forceSnippetRefresh, }) { - return selectNode?.call(node, selectedWidgetGK, selectedTreeNodeGK); + return selectNode?.call(node, selectedTreeNodeGK); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -472,7 +437,7 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { required TResult orElse(), }) { if (selectNode != null) { - return selectNode(node, selectedWidgetGK, selectedTreeNodeGK); + return selectNode(node, selectedTreeNodeGK); } return orElse(); } @@ -483,7 +448,6 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -512,7 +476,6 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -540,7 +503,6 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -570,12 +532,10 @@ class _$SelectNodeImpl with DiagnosticableTreeMixin implements SelectNode { abstract class SelectNode implements SnippetEvent { const factory SelectNode( {required final STreeNode node, - required final GlobalKey> selectedWidgetGK, required final GlobalKey> selectedTreeNodeGK}) = _$SelectNodeImpl; - STreeNode get node; - GlobalKey> get selectedWidgetGK; + STreeNode get node; // required GlobalKey selectedWidgetGK, GlobalKey> get selectedTreeNodeGK; @JsonKey(ignore: true) _$$SelectNodeImplCopyWith<_$SelectNodeImpl> get copyWith => @@ -630,14 +590,11 @@ class _$ClearNodeSelectionImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -681,14 +638,11 @@ class _$ClearNodeSelectionImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -723,14 +677,11 @@ class _$ClearNodeSelectionImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -772,7 +723,6 @@ class _$ClearNodeSelectionImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -801,7 +751,6 @@ class _$ClearNodeSelectionImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -829,7 +778,6 @@ class _$ClearNodeSelectionImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -947,14 +895,11 @@ class _$SaveNodeAsSnippetImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -998,14 +943,11 @@ class _$SaveNodeAsSnippetImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -1040,14 +982,11 @@ class _$SaveNodeAsSnippetImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -1089,7 +1028,6 @@ class _$SaveNodeAsSnippetImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -1118,7 +1056,6 @@ class _$SaveNodeAsSnippetImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -1146,7 +1083,6 @@ class _$SaveNodeAsSnippetImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -1185,317 +1121,6 @@ abstract class SaveNodeAsSnippet implements SnippetEvent { throw _privateConstructorUsedError; } -/// @nodoc -abstract class _$$HighlightNodeImplCopyWith<$Res> { - factory _$$HighlightNodeImplCopyWith( - _$HighlightNodeImpl value, $Res Function(_$HighlightNodeImpl) then) = - __$$HighlightNodeImplCopyWithImpl<$Res>; - @useResult - $Res call({STreeNode? node}); -} - -/// @nodoc -class __$$HighlightNodeImplCopyWithImpl<$Res> - extends _$SnippetEventCopyWithImpl<$Res, _$HighlightNodeImpl> - implements _$$HighlightNodeImplCopyWith<$Res> { - __$$HighlightNodeImplCopyWithImpl( - _$HighlightNodeImpl _value, $Res Function(_$HighlightNodeImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? node = freezed, - }) { - return _then(_$HighlightNodeImpl( - node: freezed == node - ? _value.node - : node // ignore: cast_nullable_to_non_nullable - as STreeNode?, - )); - } -} - -/// @nodoc - -class _$HighlightNodeImpl - with DiagnosticableTreeMixin - implements HighlightNode { - const _$HighlightNodeImpl({required this.node}); - - @override - final STreeNode? node; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'SnippetEvent.highlightNode(node: $node)'; - } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - properties - ..add(DiagnosticsProperty('type', 'SnippetEvent.highlightNode')) - ..add(DiagnosticsProperty('node', node)); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$HighlightNodeImpl && - (identical(other.node, node) || other.node == node)); - } - - @override - int get hashCode => Object.hash(runtimeType, node); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$HighlightNodeImplCopyWith<_$HighlightNodeImpl> get copyWith => - __$$HighlightNodeImplCopyWithImpl<_$HighlightNodeImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) - selectNode, - required TResult Function() clearNodeSelection, - required TResult Function(STreeNode node, String newSnippetName) - saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, - required TResult Function( - Type? type, String? snippetName, STreeNode? testNode) - replaceSelectionWith, - required TResult Function( - Type? type, String? snippetName, STreeNode? testNode) - wrapSelectionWith, - required TResult Function( - Type? type, - STreeNode? testNode, - String? snippetName, - Type? widgetSpanChildType, - STreeNode? testWidgetSpanChildNode) - appendChild, - required TResult Function( - Type? type, String? snippetName, STreeNode? testNode) - addSiblingBefore, - required TResult Function( - Type? type, String? snippetName, STreeNode? testNode) - addSiblingAfter, - required TResult Function(Type? widgetSpanChildType) pasteReplacement, - required TResult Function( - Type? widgetSpanChildType, STreeNode? testWidgetSpanChildNode) - pasteChild, - required TResult Function() pasteSiblingBefore, - required TResult Function() pasteSiblingAfter, - required TResult Function() deleteNodeTapped, - required TResult Function() completeDeletion, - required TResult Function(STreeNode node, dynamic skipSave) copyNode, - required TResult Function( - CAPIBloC capiBloc, STreeNode node, dynamic skipSave) - cutNode, - required TResult Function(String snippetName, STreeNode? selectedNode) - selectedDirectoryOrNode, - required TResult Function(String name, bool skipRedo) undo, - required TResult Function(String name) redo, - required TResult Function() forceSnippetRefresh, - }) { - return highlightNode(node); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK)? - selectNode, - TResult? Function()? clearNodeSelection, - TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, - TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? - replaceSelectionWith, - TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? - wrapSelectionWith, - TResult? Function(Type? type, STreeNode? testNode, String? snippetName, - Type? widgetSpanChildType, STreeNode? testWidgetSpanChildNode)? - appendChild, - TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? - addSiblingBefore, - TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? - addSiblingAfter, - TResult? Function(Type? widgetSpanChildType)? pasteReplacement, - TResult? Function( - Type? widgetSpanChildType, STreeNode? testWidgetSpanChildNode)? - pasteChild, - TResult? Function()? pasteSiblingBefore, - TResult? Function()? pasteSiblingAfter, - TResult? Function()? deleteNodeTapped, - TResult? Function()? completeDeletion, - TResult? Function(STreeNode node, dynamic skipSave)? copyNode, - TResult? Function(CAPIBloC capiBloc, STreeNode node, dynamic skipSave)? - cutNode, - TResult? Function(String snippetName, STreeNode? selectedNode)? - selectedDirectoryOrNode, - TResult? Function(String name, bool skipRedo)? undo, - TResult? Function(String name)? redo, - TResult? Function()? forceSnippetRefresh, - }) { - return highlightNode?.call(node); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK)? - selectNode, - TResult Function()? clearNodeSelection, - TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, - TResult Function(Type? type, String? snippetName, STreeNode? testNode)? - replaceSelectionWith, - TResult Function(Type? type, String? snippetName, STreeNode? testNode)? - wrapSelectionWith, - TResult Function(Type? type, STreeNode? testNode, String? snippetName, - Type? widgetSpanChildType, STreeNode? testWidgetSpanChildNode)? - appendChild, - TResult Function(Type? type, String? snippetName, STreeNode? testNode)? - addSiblingBefore, - TResult Function(Type? type, String? snippetName, STreeNode? testNode)? - addSiblingAfter, - TResult Function(Type? widgetSpanChildType)? pasteReplacement, - TResult Function( - Type? widgetSpanChildType, STreeNode? testWidgetSpanChildNode)? - pasteChild, - TResult Function()? pasteSiblingBefore, - TResult Function()? pasteSiblingAfter, - TResult Function()? deleteNodeTapped, - TResult Function()? completeDeletion, - TResult Function(STreeNode node, dynamic skipSave)? copyNode, - TResult Function(CAPIBloC capiBloc, STreeNode node, dynamic skipSave)? - cutNode, - TResult Function(String snippetName, STreeNode? selectedNode)? - selectedDirectoryOrNode, - TResult Function(String name, bool skipRedo)? undo, - TResult Function(String name)? redo, - TResult Function()? forceSnippetRefresh, - required TResult orElse(), - }) { - if (highlightNode != null) { - return highlightNode(node); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(SelectNode value) selectNode, - required TResult Function(ClearNodeSelection value) clearNodeSelection, - required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, - required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, - required TResult Function(WrapSelectionWith value) wrapSelectionWith, - required TResult Function(AppendChild value) appendChild, - required TResult Function(AddSiblingBefore value) addSiblingBefore, - required TResult Function(AddSiblingAfter value) addSiblingAfter, - required TResult Function(PasteReplacement value) pasteReplacement, - required TResult Function(PasteChild value) pasteChild, - required TResult Function(PasteSiblingBefore value) pasteSiblingBefore, - required TResult Function(PasteSiblingAfter value) pasteSiblingAfter, - required TResult Function(DeleteNodeTapped value) deleteNodeTapped, - required TResult Function(CompleteDeletion value) completeDeletion, - required TResult Function(CopyNode value) copyNode, - required TResult Function(CutNode value) cutNode, - required TResult Function(SelectedDirectoryOrNode value) - selectedDirectoryOrNode, - required TResult Function(Undo value) undo, - required TResult Function(Redo value) redo, - required TResult Function(ForceSnippetRefresh value) forceSnippetRefresh, - }) { - return highlightNode(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(SelectNode value)? selectNode, - TResult? Function(ClearNodeSelection value)? clearNodeSelection, - TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, - TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, - TResult? Function(WrapSelectionWith value)? wrapSelectionWith, - TResult? Function(AppendChild value)? appendChild, - TResult? Function(AddSiblingBefore value)? addSiblingBefore, - TResult? Function(AddSiblingAfter value)? addSiblingAfter, - TResult? Function(PasteReplacement value)? pasteReplacement, - TResult? Function(PasteChild value)? pasteChild, - TResult? Function(PasteSiblingBefore value)? pasteSiblingBefore, - TResult? Function(PasteSiblingAfter value)? pasteSiblingAfter, - TResult? Function(DeleteNodeTapped value)? deleteNodeTapped, - TResult? Function(CompleteDeletion value)? completeDeletion, - TResult? Function(CopyNode value)? copyNode, - TResult? Function(CutNode value)? cutNode, - TResult? Function(SelectedDirectoryOrNode value)? selectedDirectoryOrNode, - TResult? Function(Undo value)? undo, - TResult? Function(Redo value)? redo, - TResult? Function(ForceSnippetRefresh value)? forceSnippetRefresh, - }) { - return highlightNode?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(SelectNode value)? selectNode, - TResult Function(ClearNodeSelection value)? clearNodeSelection, - TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, - TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, - TResult Function(WrapSelectionWith value)? wrapSelectionWith, - TResult Function(AppendChild value)? appendChild, - TResult Function(AddSiblingBefore value)? addSiblingBefore, - TResult Function(AddSiblingAfter value)? addSiblingAfter, - TResult Function(PasteReplacement value)? pasteReplacement, - TResult Function(PasteChild value)? pasteChild, - TResult Function(PasteSiblingBefore value)? pasteSiblingBefore, - TResult Function(PasteSiblingAfter value)? pasteSiblingAfter, - TResult Function(DeleteNodeTapped value)? deleteNodeTapped, - TResult Function(CompleteDeletion value)? completeDeletion, - TResult Function(CopyNode value)? copyNode, - TResult Function(CutNode value)? cutNode, - TResult Function(SelectedDirectoryOrNode value)? selectedDirectoryOrNode, - TResult Function(Undo value)? undo, - TResult Function(Redo value)? redo, - TResult Function(ForceSnippetRefresh value)? forceSnippetRefresh, - required TResult orElse(), - }) { - if (highlightNode != null) { - return highlightNode(this); - } - return orElse(); - } -} - -abstract class HighlightNode implements SnippetEvent { - const factory HighlightNode({required final STreeNode? node}) = - _$HighlightNodeImpl; - - STreeNode? get node; - @JsonKey(ignore: true) - _$$HighlightNodeImplCopyWith<_$HighlightNodeImpl> get copyWith => - throw _privateConstructorUsedError; -} - /// @nodoc abstract class _$$ReplaceSelectionWithImplCopyWith<$Res> { factory _$$ReplaceSelectionWithImplCopyWith(_$ReplaceSelectionWithImpl value, @@ -1595,14 +1220,11 @@ class _$ReplaceSelectionWithImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -1646,14 +1268,11 @@ class _$ReplaceSelectionWithImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -1688,14 +1307,11 @@ class _$ReplaceSelectionWithImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -1737,7 +1353,6 @@ class _$ReplaceSelectionWithImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -1766,7 +1381,6 @@ class _$ReplaceSelectionWithImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -1794,7 +1408,6 @@ class _$ReplaceSelectionWithImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -1932,14 +1545,11 @@ class _$WrapSelectionWithImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -1983,14 +1593,11 @@ class _$WrapSelectionWithImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2025,14 +1632,11 @@ class _$WrapSelectionWithImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2074,7 +1678,6 @@ class _$WrapSelectionWithImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -2103,7 +1706,6 @@ class _$WrapSelectionWithImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -2131,7 +1733,6 @@ class _$WrapSelectionWithImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -2299,14 +1900,11 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -2351,14 +1949,11 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2394,14 +1989,11 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2444,7 +2036,6 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -2473,7 +2064,6 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -2501,7 +2091,6 @@ class _$AppendChildImpl with DiagnosticableTreeMixin implements AppendChild { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -2643,14 +2232,11 @@ class _$AddSiblingBeforeImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -2694,14 +2280,11 @@ class _$AddSiblingBeforeImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2736,14 +2319,11 @@ class _$AddSiblingBeforeImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -2785,7 +2365,6 @@ class _$AddSiblingBeforeImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -2814,7 +2393,6 @@ class _$AddSiblingBeforeImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -2842,7 +2420,6 @@ class _$AddSiblingBeforeImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -2980,14 +2557,11 @@ class _$AddSiblingAfterImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -3031,14 +2605,11 @@ class _$AddSiblingAfterImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3073,14 +2644,11 @@ class _$AddSiblingAfterImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3122,7 +2690,6 @@ class _$AddSiblingAfterImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -3151,7 +2718,6 @@ class _$AddSiblingAfterImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -3179,7 +2745,6 @@ class _$AddSiblingAfterImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -3298,14 +2863,11 @@ class _$PasteReplacementImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -3349,14 +2911,11 @@ class _$PasteReplacementImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3391,14 +2950,11 @@ class _$PasteReplacementImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3440,7 +2996,6 @@ class _$PasteReplacementImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -3469,7 +3024,6 @@ class _$PasteReplacementImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -3497,7 +3051,6 @@ class _$PasteReplacementImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -3624,14 +3177,11 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -3675,14 +3225,11 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3717,14 +3264,11 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -3766,7 +3310,6 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -3795,7 +3338,6 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -3823,7 +3365,6 @@ class _$PasteChildImpl with DiagnosticableTreeMixin implements PasteChild { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -3911,14 +3452,11 @@ class _$PasteSiblingBeforeImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -3962,14 +3500,11 @@ class _$PasteSiblingBeforeImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4004,14 +3539,11 @@ class _$PasteSiblingBeforeImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4053,7 +3585,6 @@ class _$PasteSiblingBeforeImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -4082,7 +3613,6 @@ class _$PasteSiblingBeforeImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -4110,7 +3640,6 @@ class _$PasteSiblingBeforeImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -4189,14 +3718,11 @@ class _$PasteSiblingAfterImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -4240,14 +3766,11 @@ class _$PasteSiblingAfterImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4282,14 +3805,11 @@ class _$PasteSiblingAfterImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4331,7 +3851,6 @@ class _$PasteSiblingAfterImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -4360,7 +3879,6 @@ class _$PasteSiblingAfterImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -4388,7 +3906,6 @@ class _$PasteSiblingAfterImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -4467,14 +3984,11 @@ class _$DeleteNodeTappedImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -4518,14 +4032,11 @@ class _$DeleteNodeTappedImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4560,14 +4071,11 @@ class _$DeleteNodeTappedImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4609,7 +4117,6 @@ class _$DeleteNodeTappedImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -4638,7 +4145,6 @@ class _$DeleteNodeTappedImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -4666,7 +4172,6 @@ class _$DeleteNodeTappedImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -4745,14 +4250,11 @@ class _$CompleteDeletionImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -4796,14 +4298,11 @@ class _$CompleteDeletionImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4838,14 +4337,11 @@ class _$CompleteDeletionImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -4887,7 +4383,6 @@ class _$CompleteDeletionImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -4916,7 +4411,6 @@ class _$CompleteDeletionImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -4944,7 +4438,6 @@ class _$CompleteDeletionImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -5056,14 +4549,11 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -5107,14 +4597,11 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5149,14 +4636,11 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5198,7 +4682,6 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -5227,7 +4710,6 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -5255,7 +4737,6 @@ class _$CopyNodeImpl with DiagnosticableTreeMixin implements CopyNode { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -5385,14 +4866,11 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -5436,14 +4914,11 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5478,14 +4953,11 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5527,7 +4999,6 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -5556,7 +5027,6 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -5584,7 +5054,6 @@ class _$CutNodeImpl with DiagnosticableTreeMixin implements CutNode { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -5715,14 +5184,11 @@ class _$SelectedDirectoryOrNodeImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -5766,14 +5232,11 @@ class _$SelectedDirectoryOrNodeImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5808,14 +5271,11 @@ class _$SelectedDirectoryOrNodeImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -5857,7 +5317,6 @@ class _$SelectedDirectoryOrNodeImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -5886,7 +5345,6 @@ class _$SelectedDirectoryOrNodeImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -5914,7 +5372,6 @@ class _$SelectedDirectoryOrNodeImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -6036,14 +5493,11 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -6087,14 +5541,11 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6129,14 +5580,11 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6178,7 +5626,6 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -6207,7 +5654,6 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -6235,7 +5681,6 @@ class _$UndoImpl with DiagnosticableTreeMixin implements Undo { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -6345,14 +5790,11 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -6396,14 +5838,11 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6438,14 +5877,11 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6487,7 +5923,6 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -6516,7 +5951,6 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -6544,7 +5978,6 @@ class _$RedoImpl with DiagnosticableTreeMixin implements Redo { TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, @@ -6629,14 +6062,11 @@ class _$ForceSnippetRefreshImpl @optionalTypeArgs TResult when({ required TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, - GlobalKey> selectedTreeNodeGK) + STreeNode node, GlobalKey> selectedTreeNodeGK) selectNode, required TResult Function() clearNodeSelection, required TResult Function(STreeNode node, String newSnippetName) saveNodeAsSnippet, - required TResult Function(STreeNode? node) highlightNode, required TResult Function( Type? type, String? snippetName, STreeNode? testNode) replaceSelectionWith, @@ -6680,14 +6110,11 @@ class _$ForceSnippetRefreshImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult? Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult? Function()? clearNodeSelection, TResult? Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult? Function(STreeNode? node)? highlightNode, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult? Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6722,14 +6149,11 @@ class _$ForceSnippetRefreshImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function( - STreeNode node, - GlobalKey> selectedWidgetGK, + TResult Function(STreeNode node, GlobalKey> selectedTreeNodeGK)? selectNode, TResult Function()? clearNodeSelection, TResult Function(STreeNode node, String newSnippetName)? saveNodeAsSnippet, - TResult Function(STreeNode? node)? highlightNode, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? replaceSelectionWith, TResult Function(Type? type, String? snippetName, STreeNode? testNode)? @@ -6771,7 +6195,6 @@ class _$ForceSnippetRefreshImpl required TResult Function(SelectNode value) selectNode, required TResult Function(ClearNodeSelection value) clearNodeSelection, required TResult Function(SaveNodeAsSnippet value) saveNodeAsSnippet, - required TResult Function(HighlightNode value) highlightNode, required TResult Function(ReplaceSelectionWith value) replaceSelectionWith, required TResult Function(WrapSelectionWith value) wrapSelectionWith, required TResult Function(AppendChild value) appendChild, @@ -6800,7 +6223,6 @@ class _$ForceSnippetRefreshImpl TResult? Function(SelectNode value)? selectNode, TResult? Function(ClearNodeSelection value)? clearNodeSelection, TResult? Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult? Function(HighlightNode value)? highlightNode, TResult? Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult? Function(WrapSelectionWith value)? wrapSelectionWith, TResult? Function(AppendChild value)? appendChild, @@ -6828,7 +6250,6 @@ class _$ForceSnippetRefreshImpl TResult Function(SelectNode value)? selectNode, TResult Function(ClearNodeSelection value)? clearNodeSelection, TResult Function(SaveNodeAsSnippet value)? saveNodeAsSnippet, - TResult Function(HighlightNode value)? highlightNode, TResult Function(ReplaceSelectionWith value)? replaceSelectionWith, TResult Function(WrapSelectionWith value)? wrapSelectionWith, TResult Function(AppendChild value)? appendChild, diff --git a/lib/src/bloc/snippet_state.dart b/lib/src/bloc/snippet_state.dart index 89446865..40c8a499 100644 --- a/lib/src/bloc/snippet_state.dart +++ b/lib/src/bloc/snippet_state.dart @@ -2,7 +2,6 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_content/flutter_content.dart'; -import 'package:flutter_content/src/target_config/content/snippet_editor/undo_redo_snippet_tree.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'snippet_state.freezed.dart'; @@ -17,10 +16,10 @@ class SnippetState with _$SnippetState { required SnippetTreeController treeC, // required SnippetTreeUR ur, STreeNode? selectedNode, - GlobalKey? selectedWidgetGK, + // GlobalKey? selectedWidgetGK, GlobalKey? selectedTreeNodeGK, // ---- the state gets saved between snippet tree callout instances ------------------ - STreeNode? highlightedNode, + // STreeNode? highlightedNode, @Default(false) bool showProperties, STreeNode? nodeBeingDeleted, @Default(0) int force, // hacky way to force a transition ? diff --git a/lib/src/bloc/snippet_state.freezed.dart b/lib/src/bloc/snippet_state.freezed.dart index 63cb602c..3bc166d1 100644 --- a/lib/src/bloc/snippet_state.freezed.dart +++ b/lib/src/bloc/snippet_state.freezed.dart @@ -20,12 +20,11 @@ mixin _$SnippetState { SnippetRootNode get rootNode => throw _privateConstructorUsedError; SnippetTreeController get treeC => throw _privateConstructorUsedError; // required SnippetTreeUR ur, - STreeNode? get selectedNode => throw _privateConstructorUsedError; - GlobalKey>? get selectedWidgetGK => - throw _privateConstructorUsedError; + STreeNode? get selectedNode => + throw _privateConstructorUsedError; // GlobalKey? selectedWidgetGK, GlobalKey>? get selectedTreeNodeGK => throw _privateConstructorUsedError; // ---- the state gets saved between snippet tree callout instances ------------------ - STreeNode? get highlightedNode => throw _privateConstructorUsedError; +// STreeNode? highlightedNode, bool get showProperties => throw _privateConstructorUsedError; STreeNode? get nodeBeingDeleted => throw _privateConstructorUsedError; int get force => throw _privateConstructorUsedError; @@ -45,9 +44,7 @@ abstract class $SnippetStateCopyWith<$Res> { {SnippetRootNode rootNode, SnippetTreeController treeC, STreeNode? selectedNode, - GlobalKey>? selectedWidgetGK, GlobalKey>? selectedTreeNodeGK, - STreeNode? highlightedNode, bool showProperties, STreeNode? nodeBeingDeleted, int force}); @@ -69,9 +66,7 @@ class _$SnippetStateCopyWithImpl<$Res, $Val extends SnippetState> Object? rootNode = null, Object? treeC = null, Object? selectedNode = freezed, - Object? selectedWidgetGK = freezed, Object? selectedTreeNodeGK = freezed, - Object? highlightedNode = freezed, Object? showProperties = null, Object? nodeBeingDeleted = freezed, Object? force = null, @@ -89,18 +84,10 @@ class _$SnippetStateCopyWithImpl<$Res, $Val extends SnippetState> ? _value.selectedNode : selectedNode // ignore: cast_nullable_to_non_nullable as STreeNode?, - selectedWidgetGK: freezed == selectedWidgetGK - ? _value.selectedWidgetGK - : selectedWidgetGK // ignore: cast_nullable_to_non_nullable - as GlobalKey>?, selectedTreeNodeGK: freezed == selectedTreeNodeGK ? _value.selectedTreeNodeGK : selectedTreeNodeGK // ignore: cast_nullable_to_non_nullable as GlobalKey>?, - highlightedNode: freezed == highlightedNode - ? _value.highlightedNode - : highlightedNode // ignore: cast_nullable_to_non_nullable - as STreeNode?, showProperties: null == showProperties ? _value.showProperties : showProperties // ignore: cast_nullable_to_non_nullable @@ -129,9 +116,7 @@ abstract class _$$SnippetStateImplCopyWith<$Res> {SnippetRootNode rootNode, SnippetTreeController treeC, STreeNode? selectedNode, - GlobalKey>? selectedWidgetGK, GlobalKey>? selectedTreeNodeGK, - STreeNode? highlightedNode, bool showProperties, STreeNode? nodeBeingDeleted, int force}); @@ -151,9 +136,7 @@ class __$$SnippetStateImplCopyWithImpl<$Res> Object? rootNode = null, Object? treeC = null, Object? selectedNode = freezed, - Object? selectedWidgetGK = freezed, Object? selectedTreeNodeGK = freezed, - Object? highlightedNode = freezed, Object? showProperties = null, Object? nodeBeingDeleted = freezed, Object? force = null, @@ -171,18 +154,10 @@ class __$$SnippetStateImplCopyWithImpl<$Res> ? _value.selectedNode : selectedNode // ignore: cast_nullable_to_non_nullable as STreeNode?, - selectedWidgetGK: freezed == selectedWidgetGK - ? _value.selectedWidgetGK - : selectedWidgetGK // ignore: cast_nullable_to_non_nullable - as GlobalKey>?, selectedTreeNodeGK: freezed == selectedTreeNodeGK ? _value.selectedTreeNodeGK : selectedTreeNodeGK // ignore: cast_nullable_to_non_nullable as GlobalKey>?, - highlightedNode: freezed == highlightedNode - ? _value.highlightedNode - : highlightedNode // ignore: cast_nullable_to_non_nullable - as STreeNode?, showProperties: null == showProperties ? _value.showProperties : showProperties // ignore: cast_nullable_to_non_nullable @@ -206,9 +181,7 @@ class _$SnippetStateImpl extends _SnippetState { {required this.rootNode, required this.treeC, this.selectedNode, - this.selectedWidgetGK, this.selectedTreeNodeGK, - this.highlightedNode, this.showProperties = false, this.nodeBeingDeleted, this.force = 0}) @@ -222,13 +195,11 @@ class _$SnippetStateImpl extends _SnippetState { // required SnippetTreeUR ur, @override final STreeNode? selectedNode; - @override - final GlobalKey>? selectedWidgetGK; +// GlobalKey? selectedWidgetGK, @override final GlobalKey>? selectedTreeNodeGK; // ---- the state gets saved between snippet tree callout instances ------------------ - @override - final STreeNode? highlightedNode; +// STreeNode? highlightedNode, @override @JsonKey() final bool showProperties; @@ -240,7 +211,7 @@ class _$SnippetStateImpl extends _SnippetState { @override String toString() { - return 'SnippetState(rootNode: $rootNode, treeC: $treeC, selectedNode: $selectedNode, selectedWidgetGK: $selectedWidgetGK, selectedTreeNodeGK: $selectedTreeNodeGK, highlightedNode: $highlightedNode, showProperties: $showProperties, nodeBeingDeleted: $nodeBeingDeleted, force: $force)'; + return 'SnippetState(rootNode: $rootNode, treeC: $treeC, selectedNode: $selectedNode, selectedTreeNodeGK: $selectedTreeNodeGK, showProperties: $showProperties, nodeBeingDeleted: $nodeBeingDeleted, force: $force)'; } @override @@ -253,12 +224,8 @@ class _$SnippetStateImpl extends _SnippetState { (identical(other.treeC, treeC) || other.treeC == treeC) && (identical(other.selectedNode, selectedNode) || other.selectedNode == selectedNode) && - (identical(other.selectedWidgetGK, selectedWidgetGK) || - other.selectedWidgetGK == selectedWidgetGK) && (identical(other.selectedTreeNodeGK, selectedTreeNodeGK) || other.selectedTreeNodeGK == selectedTreeNodeGK) && - (identical(other.highlightedNode, highlightedNode) || - other.highlightedNode == highlightedNode) && (identical(other.showProperties, showProperties) || other.showProperties == showProperties) && (identical(other.nodeBeingDeleted, nodeBeingDeleted) || @@ -267,17 +234,8 @@ class _$SnippetStateImpl extends _SnippetState { } @override - int get hashCode => Object.hash( - runtimeType, - rootNode, - treeC, - selectedNode, - selectedWidgetGK, - selectedTreeNodeGK, - highlightedNode, - showProperties, - nodeBeingDeleted, - force); + int get hashCode => Object.hash(runtimeType, rootNode, treeC, selectedNode, + selectedTreeNodeGK, showProperties, nodeBeingDeleted, force); @JsonKey(ignore: true) @override @@ -291,9 +249,7 @@ abstract class _SnippetState extends SnippetState { {required final SnippetRootNode rootNode, required final SnippetTreeController treeC, final STreeNode? selectedNode, - final GlobalKey>? selectedWidgetGK, final GlobalKey>? selectedTreeNodeGK, - final STreeNode? highlightedNode, final bool showProperties, final STreeNode? nodeBeingDeleted, final int force}) = _$SnippetStateImpl; @@ -305,13 +261,10 @@ abstract class _SnippetState extends SnippetState { SnippetTreeController get treeC; @override // required SnippetTreeUR ur, STreeNode? get selectedNode; - @override - GlobalKey>? get selectedWidgetGK; - @override + @override // GlobalKey? selectedWidgetGK, GlobalKey>? get selectedTreeNodeGK; @override // ---- the state gets saved between snippet tree callout instances ------------------ - STreeNode? get highlightedNode; - @override +// STreeNode? highlightedNode, bool get showProperties; @override STreeNode? get nodeBeingDeleted; diff --git a/lib/src/model/firestore_model_repo.dart b/lib/src/model/firestore_model_repo.dart index 0435a3cf..dfc04e1d 100644 --- a/lib/src/model/firestore_model_repo.dart +++ b/lib/src/model/firestore_model_repo.dart @@ -54,13 +54,15 @@ class FireStoreModelRepository implements IModelRepository { @override // if not in cache, gets from FB and adds to cache - Future getSnippetFromCacheOrFB({required SnippetName snippetName, required VersionId versionId}) async { + Future getSnippetFromCacheOrFB( + {required SnippetName snippetName, required VersionId versionId}) async { // try to fetch from cache, otherwise fetch from FB var versions = FC().snippetCache[snippetName]; var version = (versions ?? {})[versionId]; if (version != null) return; - DocumentReference versionedSnippetDocRef = appDocRef.collection('snippets/$snippetName/versions').doc(versionId); + DocumentReference versionedSnippetDocRef = + appDocRef.collection('snippets/$snippetName/versions').doc(versionId); DocumentSnapshot doc = await versionedSnippetDocRef.get(); if (doc.exists) { final data = doc.data() as Map; @@ -98,27 +100,27 @@ class FireStoreModelRepository implements IModelRepository { /// createOrUpdateAppModelAndCAPIModel @override Future saveSnippet({ - required SnippetName snippetName, + required SnippetRootNode snippetRootNode, required VersionId newVersionId, }) async { - SnippetRootNode? snippetNode = FC().rootNodeOfEditingSnippet(snippetName); - if (snippetNode != null) { - // snippet saved under new versionId, and editingSnippet now set to this new version - FC().addVersionId(snippetName, newVersionId); - // var newAppInfo = FC().appInfo; - // newAppInfo.versionIds[snippetName]?.insert(0, newVersionId); - // newAppInfo.editingVersionIds.addAll({snippetName: newVersionId}); - // FC().appInfo = newAppInfo; - await saveAppInfo(); + var fc = FC(); + // snippet saved under new versionId, and editingSnippet now set to this new version + FC().addVersionId(snippetRootNode.name, newVersionId); + // var newAppInfo = FC().appInfo; + // newAppInfo.versionIds[snippetName]?.insert(0, newVersionId); + // newAppInfo.editingVersionIds.addAll({snippetName: newVersionId}); + // FC().appInfo = newAppInfo; - // now create the actual version doc - DocumentReference newVersionedSnippetDocRef = appDocRef - .collection('snippets/$snippetName/versions') - .doc(newVersionId); - await newVersionedSnippetDocRef.set(snippetNode.toMap()); - return newVersionId; - } - return null; + // now create the actual version doc + DocumentReference newVersionedSnippetDocRef = appDocRef + .collection('snippets/${snippetRootNode.name}/versions') + .doc(newVersionId); + var map = snippetRootNode.toMap(); + await newVersionedSnippetDocRef.set(map); + + await saveAppInfo(); + + return newVersionId; } @override diff --git a/lib/src/model/model_repo.dart b/lib/src/model/model_repo.dart index 84fbb4f3..83693aa6 100644 --- a/lib/src/model/model_repo.dart +++ b/lib/src/model/model_repo.dart @@ -16,7 +16,7 @@ abstract class IModelRepository { {required SnippetName snippetName, required VersionId versionId}); Future saveSnippet({ - required SnippetName snippetName, + required SnippetRootNode snippetRootNode, required VersionId newVersionId, }); diff --git a/lib/src/model/target_model.dart b/lib/src/model/target_model.dart index 7066a7d5..f2617448 100644 --- a/lib/src/model/target_model.dart +++ b/lib/src/model/target_model.dart @@ -4,6 +4,7 @@ import 'package:dart_mappable/dart_mappable.dart'; import 'package:flutter/material.dart'; import 'package:flutter_content/flutter_content.dart'; import 'package:flutter_content/src/snippet/pnodes/enums/enum_decoration.dart'; +import 'package:flutter_content/src/snippet/snodes/target_group_wrapper_node.dart'; import 'package:json_annotation/json_annotation.dart'; part 'target_model.mapper.dart'; @@ -14,10 +15,10 @@ class TargetModel with TargetModelMappable { double transformScale; // double transformTranslateX; // double transformTranslateY; - TargetsWrapperName wName; // + // if target is part of a TargetsWrapper, it's parent node will be this property @JsonKey(includeFromJson: false, includeToJson: false) - GlobalKey? targetsWrapperGK; + TargetGroupWrapperNode? targetsWrapperNode; // bool single; double? targetLocalPosLeftPc; @@ -53,7 +54,6 @@ class TargetModel with TargetModelMappable { TargetModel({ required this.uid, - required this.wName, // this.single = true, this.transformScale = 1.0, // this.transformTranslateX = 0.0, @@ -66,6 +66,8 @@ class TargetModel with TargetModelMappable { this.calloutLeftPc, this.btnLocalTopPc, // initially shown directly over target this.btnLocalLeftPc, + this.targetLocalPosLeftPc, + this.targetLocalPosTopPc, this.showBtn = true, this.canResizeH = true, this.canResizeV = true, @@ -86,7 +88,8 @@ class TargetModel with TargetModelMappable { // fontWeightIndex = FontWeight.normal.index; } - TargetsWrapperState? get targetWrapperState => targetsWrapperGK?.currentState as TargetsWrapperState; + GlobalKey? get targetsWrapperGK => targetsWrapperNode?.nodeWidgetGK; + TargetsWrapperState? get targetsWrapperState => targetsWrapperNode?.nodeWidgetGK?.currentState as TargetsWrapperState; /// https://gist.github.com/pskink/aa0b0c80af9a986619845625c0e87a67 Matrix4 composeMatrix({ @@ -113,7 +116,7 @@ class TargetModel with TargetModelMappable { return Matrix4(c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, dx, dy, 0, 1); } - bool playingOrSelected() => targetWrapperState?.widget.parentNode.playList.isNotEmpty??false; // || (_bloc.state.aTargetIsSelected() && _bloc.state.selectedTarget!.uid == uid); + bool playingOrSelected() => targetsWrapperState?.widget.parentNode.playList.isNotEmpty??false; // || (_bloc.state.aTargetIsSelected() && _bloc.state.selectedTarget!.uid == uid); double getScale({bool testing = false}) => playingOrSelected() || testing ? transformScale : 1.0; @@ -125,7 +128,7 @@ class TargetModel with TargetModelMappable { // } double get radius { - Size ivSize = targetWrapperState!.wrapperSize; + Size ivSize = targetsWrapperState!.wrapperSize; return radiusPc != null ? radiusPc! * ivSize.width : 30.0; } @@ -172,7 +175,7 @@ class TargetModel with TargetModelMappable { Offset btnStackPos() { // iv rect should always be measured - Size ivSize = targetWrapperState!.wrapperSize; + Size ivSize = targetsWrapperState!.wrapperSize; double stackPosX = (btnLocalLeftPc ?? 0.0) * ivSize.width; double stackPosY = (btnLocalTopPc ?? 0.0) * ivSize.height; @@ -181,7 +184,7 @@ class TargetModel with TargetModelMappable { } Offset targetStackPos() { - Size ivSize = targetWrapperState!.wrapperSize; + Size ivSize = targetsWrapperState!.wrapperSize; double stackPosX = (targetLocalPosLeftPc ?? 0.0) * ivSize.width; double stackPosY = (targetLocalPosTopPc ?? 0.0) * ivSize.height; @@ -191,8 +194,8 @@ class TargetModel with TargetModelMappable { void setTargetStackPosPc(Offset globalPos) { // iv rect should always be measured - Offset ivTopLeft = targetWrapperState!.wrapperPos; - Size ivSize = targetWrapperState!.wrapperSize; + Offset ivTopLeft = targetsWrapperState!.wrapperPos; + Size ivSize = targetsWrapperState!.wrapperSize; double targetLocalPosTop = globalPos.dy - ivTopLeft.dy; double targetLocalPosLeft = globalPos.dx - ivTopLeft.dx; @@ -208,8 +211,8 @@ class TargetModel with TargetModelMappable { void setBtnStackPosPc(Offset globalPos) { // iv rect should always be measured - Offset ivTopLeft = targetWrapperState!.wrapperPos; - Size ivSize = targetWrapperState!.wrapperSize; + Offset ivTopLeft = targetsWrapperState!.wrapperPos; + Size ivSize = targetsWrapperState!.wrapperSize; btnLocalTopPc = (globalPos.dy - ivTopLeft.dy) / (ivSize.height); btnLocalLeftPc = (globalPos.dx - ivTopLeft.dx) / (ivSize.width); diff --git a/lib/src/model/target_model.mapper.dart b/lib/src/model/target_model.mapper.dart index a8cd6564..2ee1f9cd 100644 --- a/lib/src/model/target_model.mapper.dart +++ b/lib/src/model/target_model.mapper.dart @@ -23,8 +23,6 @@ class TargetModelMapper extends ClassMapperBase { static int _$uid(TargetModel v) => v.uid; static const Field _f$uid = Field('uid', _$uid); - static String _$wName(TargetModel v) => v.wName; - static const Field _f$wName = Field('wName', _$wName); static double _$transformScale(TargetModel v) => v.transformScale; static const Field _f$transformScale = Field('transformScale', _$transformScale, opt: true, def: 1.0); @@ -52,6 +50,13 @@ class TargetModelMapper extends ClassMapperBase { static double? _$btnLocalLeftPc(TargetModel v) => v.btnLocalLeftPc; static const Field _f$btnLocalLeftPc = Field('btnLocalLeftPc', _$btnLocalLeftPc, opt: true); + static double? _$targetLocalPosLeftPc(TargetModel v) => + v.targetLocalPosLeftPc; + static const Field _f$targetLocalPosLeftPc = + Field('targetLocalPosLeftPc', _$targetLocalPosLeftPc, opt: true); + static double? _$targetLocalPosTopPc(TargetModel v) => v.targetLocalPosTopPc; + static const Field _f$targetLocalPosTopPc = + Field('targetLocalPosTopPc', _$targetLocalPosTopPc, opt: true); static bool _$showBtn(TargetModel v) => v.showBtn; static const Field _f$showBtn = Field('showBtn', _$showBtn, opt: true, def: true); @@ -102,20 +107,11 @@ class TargetModelMapper extends ClassMapperBase { static bool _$autoPlay(TargetModel v) => v.autoPlay; static const Field _f$autoPlay = Field('autoPlay', _$autoPlay, opt: true, def: false); - static GlobalKey>? _$targetsWrapperGK(TargetModel v) => - v.targetsWrapperGK; - static const Field>> - _f$targetsWrapperGK = - Field('targetsWrapperGK', _$targetsWrapperGK, mode: FieldMode.member); - static double? _$targetLocalPosLeftPc(TargetModel v) => - v.targetLocalPosLeftPc; - static const Field _f$targetLocalPosLeftPc = Field( - 'targetLocalPosLeftPc', _$targetLocalPosLeftPc, - mode: FieldMode.member); - static double? _$targetLocalPosTopPc(TargetModel v) => v.targetLocalPosTopPc; - static const Field _f$targetLocalPosTopPc = Field( - 'targetLocalPosTopPc', _$targetLocalPosTopPc, - mode: FieldMode.member); + static TargetGroupWrapperNode? _$targetsWrapperNode(TargetModel v) => + v.targetsWrapperNode; + static const Field + _f$targetsWrapperNode = + Field('targetsWrapperNode', _$targetsWrapperNode, mode: FieldMode.member); static bool _$visible(TargetModel v) => v.visible; static const Field _f$visible = Field('visible', _$visible, mode: FieldMode.member); @@ -123,7 +119,6 @@ class TargetModelMapper extends ClassMapperBase { @override final MappableFields fields = const { #uid: _f$uid, - #wName: _f$wName, #transformScale: _f$transformScale, #radiusPc: _f$radiusPc, #calloutDurationMs: _f$calloutDurationMs, @@ -133,6 +128,8 @@ class TargetModelMapper extends ClassMapperBase { #calloutLeftPc: _f$calloutLeftPc, #btnLocalTopPc: _f$btnLocalTopPc, #btnLocalLeftPc: _f$btnLocalLeftPc, + #targetLocalPosLeftPc: _f$targetLocalPosLeftPc, + #targetLocalPosTopPc: _f$targetLocalPosTopPc, #showBtn: _f$showBtn, #canResizeH: _f$canResizeH, #canResizeV: _f$canResizeV, @@ -147,16 +144,13 @@ class TargetModelMapper extends ClassMapperBase { #calloutArrowColorValue: _f$calloutArrowColorValue, #animateArrow: _f$animateArrow, #autoPlay: _f$autoPlay, - #targetsWrapperGK: _f$targetsWrapperGK, - #targetLocalPosLeftPc: _f$targetLocalPosLeftPc, - #targetLocalPosTopPc: _f$targetLocalPosTopPc, + #targetsWrapperNode: _f$targetsWrapperNode, #visible: _f$visible, }; static TargetModel _instantiate(DecodingData data) { return TargetModel( uid: data.dec(_f$uid), - wName: data.dec(_f$wName), transformScale: data.dec(_f$transformScale), radiusPc: data.dec(_f$radiusPc), calloutDurationMs: data.dec(_f$calloutDurationMs), @@ -166,6 +160,8 @@ class TargetModelMapper extends ClassMapperBase { calloutLeftPc: data.dec(_f$calloutLeftPc), btnLocalTopPc: data.dec(_f$btnLocalTopPc), btnLocalLeftPc: data.dec(_f$btnLocalLeftPc), + targetLocalPosLeftPc: data.dec(_f$targetLocalPosLeftPc), + targetLocalPosTopPc: data.dec(_f$targetLocalPosTopPc), showBtn: data.dec(_f$showBtn), canResizeH: data.dec(_f$canResizeH), canResizeV: data.dec(_f$canResizeV), @@ -235,7 +231,6 @@ abstract class TargetModelCopyWith<$R, $In extends TargetModel, $Out> implements ClassCopyWith<$R, $In, $Out> { $R call( {int? uid, - String? wName, double? transformScale, double? radiusPc, int? calloutDurationMs, @@ -245,6 +240,8 @@ abstract class TargetModelCopyWith<$R, $In extends TargetModel, $Out> double? calloutLeftPc, double? btnLocalTopPc, double? btnLocalLeftPc, + double? targetLocalPosLeftPc, + double? targetLocalPosTopPc, bool? showBtn, bool? canResizeH, bool? canResizeV, @@ -273,7 +270,6 @@ class _TargetModelCopyWithImpl<$R, $Out> @override $R call( {int? uid, - String? wName, double? transformScale, Object? radiusPc = $none, int? calloutDurationMs, @@ -283,6 +279,8 @@ class _TargetModelCopyWithImpl<$R, $Out> Object? calloutLeftPc = $none, Object? btnLocalTopPc = $none, Object? btnLocalLeftPc = $none, + Object? targetLocalPosLeftPc = $none, + Object? targetLocalPosTopPc = $none, bool? showBtn, bool? canResizeH, bool? canResizeV, @@ -299,7 +297,6 @@ class _TargetModelCopyWithImpl<$R, $Out> bool? autoPlay}) => $apply(FieldCopyWithData({ if (uid != null) #uid: uid, - if (wName != null) #wName: wName, if (transformScale != null) #transformScale: transformScale, if (radiusPc != $none) #radiusPc: radiusPc, if (calloutDurationMs != null) #calloutDurationMs: calloutDurationMs, @@ -309,6 +306,10 @@ class _TargetModelCopyWithImpl<$R, $Out> if (calloutLeftPc != $none) #calloutLeftPc: calloutLeftPc, if (btnLocalTopPc != $none) #btnLocalTopPc: btnLocalTopPc, if (btnLocalLeftPc != $none) #btnLocalLeftPc: btnLocalLeftPc, + if (targetLocalPosLeftPc != $none) + #targetLocalPosLeftPc: targetLocalPosLeftPc, + if (targetLocalPosTopPc != $none) + #targetLocalPosTopPc: targetLocalPosTopPc, if (showBtn != null) #showBtn: showBtn, if (canResizeH != null) #canResizeH: canResizeH, if (canResizeV != null) #canResizeV: canResizeV, @@ -334,7 +335,6 @@ class _TargetModelCopyWithImpl<$R, $Out> @override TargetModel $make(CopyWithData data) => TargetModel( uid: data.get(#uid, or: $value.uid), - wName: data.get(#wName, or: $value.wName), transformScale: data.get(#transformScale, or: $value.transformScale), radiusPc: data.get(#radiusPc, or: $value.radiusPc), calloutDurationMs: @@ -345,6 +345,10 @@ class _TargetModelCopyWithImpl<$R, $Out> calloutLeftPc: data.get(#calloutLeftPc, or: $value.calloutLeftPc), btnLocalTopPc: data.get(#btnLocalTopPc, or: $value.btnLocalTopPc), btnLocalLeftPc: data.get(#btnLocalLeftPc, or: $value.btnLocalLeftPc), + targetLocalPosLeftPc: + data.get(#targetLocalPosLeftPc, or: $value.targetLocalPosLeftPc), + targetLocalPosTopPc: + data.get(#targetLocalPosTopPc, or: $value.targetLocalPosTopPc), showBtn: data.get(#showBtn, or: $value.showBtn), canResizeH: data.get(#canResizeH, or: $value.canResizeH), canResizeV: data.get(#canResizeV, or: $value.canResizeV), diff --git a/lib/src/snippet/callout_node_menu.dart b/lib/src/snippet/callout_node_menu.dart index 52c8efef..1513e773 100644 --- a/lib/src/snippet/callout_node_menu.dart +++ b/lib/src/snippet/callout_node_menu.dart @@ -496,8 +496,16 @@ MenuItemButton _menuItemButton( snippetBloc.add(SnippetEvent.addSiblingBefore(type: childType)); if (action == NodeAction.addSiblingAfter) snippetBloc.add(SnippetEvent.addSiblingAfter(type: childType)); - if (action == NodeAction.wrapWith) + if (action == NodeAction.wrapWith) { snippetBloc.add(SnippetEvent.wrapSelectionWith(type: childType)); + // in case need to show more of the tree (higher up) + Useful.afterNextBuildDo(() { + snippetBloc.add(SnippetEvent.selectNode( + node: selectedNode.parent as STreeNode, + selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), + )); + }); + } Callout.dismiss(TREENODE_MENU_CALLOUT); FC().capiBloc.add(const CAPIEvent.forceRefresh()); }, diff --git a/lib/src/snippet/node.dart b/lib/src/snippet/node.dart index c2623b84..bed6e5a3 100644 --- a/lib/src/snippet/node.dart +++ b/lib/src/snippet/node.dart @@ -133,6 +133,16 @@ class SnippetTreeController extends TreeController { return foundNode; } + bool nodeIsADescendantOf(STreeNode startingNode, STreeNode nodeToFind) { + STreeNode? foundNode; + foundNode = breadthFirstSearch( + startingNodes: [startingNode], + descendCondition: (_) => true, + returnCondition: (node) => node == nodeToFind, + ); + return foundNode != null; + } + STreeNode rootNode(TreeEntry theEntry) { TreeEntry entry = theEntry; while (entry.parent != null) { diff --git a/lib/src/snippet/snode.dart b/lib/src/snippet/snode.dart index 7b946087..995a18bf 100644 --- a/lib/src/snippet/snode.dart +++ b/lib/src/snippet/snode.dart @@ -228,23 +228,23 @@ abstract class STreeNode extends Node with STreeNodeMappable { Callout.showOverlay( ensureLowestOverlay: false, boxContentF: (context) => PointerInterceptor( + intercepting: true, child: InkWell( onTap: () { // debugPrint("tapped"); SnippetName? snippetName = rootNodeOfSnippet()?.name; if (snippetName == null) return; - var cc = nodeWidgetGK?.currentContext; + // var cc = nodeWidgetGK?.currentContext; // edit the root snippet // hideAllSingleTargetBtns(); // FlutterContent().capiBloc.add(const CAPIEvent.hideAllTargetGroupBtns()); // FlutterContent().capiBloc.add(const CAPIEvent.hideTargetGroupsExcept()); MaterialSPAState.removeAllNodeWidgetOverlays(); // actually push node parent, then select node - more user-friendly - cc = nodeWidgetGK?.currentContext; + var b = nodeWidgetGK?.currentContext?.mounted; pushThenShowNamedSnippetWithNodeSelected( snippetName, this, this, context); // Useful.afterNextBuildDo(() { - showNodeWidgetOverlay(); // }); }, child: Container( @@ -324,23 +324,30 @@ abstract class STreeNode extends Node with STreeNodeMappable { } else { highestNode = (startingAtNode.parent ?? startingAtNode) as STreeNode; } - var cc = startingAtNode.nodeWidgetGK?.currentContext; + var b = startingAtNode.nodeWidgetGK?.currentContext?.mounted; + + // set bloc state skipSnippetPanelBuild true FC().capiBloc.add(CAPIEvent.pushSnippetBloc( snippetName: snippetName, visibleDecendantNode: highestNode)); + // Useful.afterNextBuildDo(() { + // }); + // return; Useful.afterNextBuildDo(() { - var cc = startingAtNode.nodeWidgetGK?.currentContext; - SnippetBloC? snippetBeingEdited = FC().snippetBeingEdited; - if (FC().snippetBeingEdited != null) { + debugPrint('after pushSnippetBloc'); + var b = startingAtNode.nodeWidgetGK?.currentContext?.mounted; + var gk = startingAtNode.nodeWidgetGK; + var ctx = gk?.currentContext; + if (FC().snippetBeingEdited != null && ctx != null) { // currCtx = startingAtNode.nodeWidgetGK?.currentContext; showSnippetTreeAndPropertiesCallout( - snippetBloc: snippetBeingEdited!, - targetGKF: () => startingAtNode.nodeWidgetGK, + snippetBloc: FC().snippetBeingEdited!, + targetGKF: () => gk, onDismissedF: () { // CAPIState.snippetStateMap[snippetBloc.snippetName] = snippetBloc.state; STreeNode.unhighlightSelectedNode(); Callout.dismiss('selected-panel-border-overlay'); - FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); FC().capiBloc.add(const CAPIEvent.popSnippetBloc()); + FC().capiBloc.add(const CAPIEvent.unhideAllTargetGroups()); // removeNodePropertiesCallout(); Callout.dismiss(TREENODE_MENU_CALLOUT); MaterialSPAState.exitEditMode(); @@ -348,22 +355,25 @@ abstract class STreeNode extends Node with STreeNodeMappable { DateTime.now().millisecondsSinceEpoch.toString(); FC().addToSnippetCache( snippetName: snippetName, - rootNode: snippetBeingEdited!.rootNode, - initialVersionId: newVersionId, - editing: true, + rootNode: FC().snippetBeingEdited!.rootNode, + versionId: newVersionId, + // editing: true, ); - FC().updateEditingVersionId(snippetName: snippetName, newVersionId: newVersionId); + FC().updateEditingVersionId( + snippetName: snippetName, newVersionId: newVersionId); FC().capiBloc.add(CAPIEvent.saveSnippet( - snippetRootNode: snippetBeingEdited!.rootNode, + snippetRootNode: FC().snippetBeingEdited!.rootNode, newVersionId: newVersionId)); Useful.afterNextBuildDo(() { MaterialSPAState.showDevToolsFAB(); }); }, + startingAtNode: startingAtNode, + selectedNode: selectedNode, + tappedNode: this, ); // set the properties tree - STreeNode sel = selectedNode ?? startingAtNode; // final List propertyNodes = sel.properties(context); // // get a new treeController only when snippet selected // sel.pTreeC ??= PTreeNodeTreeController( @@ -378,12 +388,8 @@ abstract class STreeNode extends Node with STreeNodeMappable { // }); // select node - snippetBeingEdited.add(SnippetEvent.selectNode( - node: sel, - selectedWidgetGK: GlobalKey(debugLabel: 'selectedWidgetGK'), - selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), -// imageTC: tc, - )); + // TODO move to callout .onReady + //capiBloc.add(const CAPIEvent.forceRefresh()); // var nodeCtx = node.nodeWidgetGK?.currentContext; // Scrollable.ensureVisible(context); } @@ -397,7 +403,8 @@ abstract class STreeNode extends Node with STreeNodeMappable { SnippetBloC? snippetBloc = FC().snippetBeingEdited; SnippetState? snippetBlocState = snippetBloc?.state; if (snippetBlocState?.selectedNode != null) { - MaterialSPAState.showNodeWidgetOverlay((snippetBlocState?.selectedNode)!); + MaterialSPAState.showNodeWidgetOverlay( + (snippetBlocState?.selectedNode)!); } }); } @@ -500,8 +507,11 @@ abstract class STreeNode extends Node with STreeNodeMappable { List sensibleParents() => const []; GlobalKey createNodeGK() { - nodeWidgetGK = GlobalKey(); - FC().gkSTreeNodeMap[nodeWidgetGK!] = this; + debugPrint('--- createNodeGK --- ${toString()}'); + if (nodeWidgetGK == null) { + nodeWidgetGK = GlobalKey(); + FC().gkSTreeNodeMap[nodeWidgetGK!] = this; + } return nodeWidgetGK!; } @@ -645,73 +655,115 @@ abstract class STreeNode extends Node with STreeNodeMappable { Future possiblyHighlightSelectedNode() async { if (FC().selectedNode == this) { - if (true || FC().highlightedNode != FC().selectedNode) { - Useful.afterNextBuildDo(() { -// if (Callout.anyPresent([SELECTED_NODE_BORDER_CALLOUT])) { - unhighlightSelectedNode(); -// } - SnippetBloC? snippetBloc = FC().snippetBeingEdited; - var gk = snippetBloc?.state.selectedWidgetGK; - Rect? r = gk?.globalPaintBounds(); - if (r != null) { - double thickness = 4; - double w = r.width + thickness * 2; - double h = r.height + thickness * 2; - Offset translate = Offset(-thickness, -thickness); -// if (r.top < thickness || r.left < thickness || r.bottom < thickness || r.right < thickness) { -// w = r.width; -// h = r.height; -// thickness = 10; -// translate = Offset.zero; -// } - debugPrint("Showing $SELECTED_NODE_BORDER_CALLOUT"); - Callout.showOverlay( - ensureLowestOverlay: true, - calloutConfig: CalloutConfig( - feature: SELECTED_NODE_BORDER_CALLOUT, - initialCalloutPos: - r.topLeft.translate(translate.dx, translate.dy), - suppliedCalloutW: w, - suppliedCalloutH: h, - fillColor: Colors.transparent, - arrowType: ArrowType.NO_CONNECTOR, - draggable: false, - transparentPointer: true, - ), - boxContentF: (context) => InkWell( -// onTap: () { -// // removeNodeMenuCallout(); -// showNodePropertiesCallout( -// context: context, -// selectedNode: this, -// targetGKF: () => Node.selectionGK, //nodeGK, -// ); -// }, - child: Container( - width: w, - height: h, - decoration: BoxDecoration( - color: Colors.transparent, - border: Border.all( - color: Colors.purpleAccent.withOpacity(.5), - width: thickness), - ), - ), + unhighlightSelectedNode(); + SnippetBloC? snippetBloc = FC().snippetBeingEdited; + var gk = nodeWidgetGK; + Rect? r = gk?.globalPaintBounds(); + if (r != null) { + double thickness = 4; + double w = r.width + thickness * 2; + double h = r.height + thickness * 2; + Offset translate = Offset(-thickness, -thickness); + debugPrint("Showing $SELECTED_NODE_BORDER_CALLOUT"); + Callout.showOverlay( + ensureLowestOverlay: true, + calloutConfig: CalloutConfig( + feature: SELECTED_NODE_BORDER_CALLOUT, + initialCalloutPos: r.topLeft.translate(translate.dx, translate.dy), + suppliedCalloutW: w, + suppliedCalloutH: h, + fillColor: Colors.transparent, + arrowType: ArrowType.NO_CONNECTOR, + draggable: false, + transparentPointer: true, + ), + boxContentF: (context) => InkWell( + child: Container( + width: w, + height: h, + decoration: BoxDecoration( + color: Colors.transparent, + border: Border.all( + color: Colors.purpleAccent.withOpacity(.5), + width: thickness), ), - targetGkF: () => snippetBloc?.state.selectedWidgetGK!, - ); - FC() - .snippetBeingEdited - ?.add(SnippetEvent.highlightNode(node: this)); -// Useful.afterMsDelayDo(1000, () { -// Useful.om.moveToTop("TreeNodeMenu".hashCode); -// }); - } - }); + ), + ), + ); + // FC().snippetBeingEdited?.add(SnippetEvent.highlightNode(node: this)); } } } +// Future possiblyHighlightSelectedNode() async { +// if (FC().selectedNode == this) { +// if (true || FC().highlightedNode != FC().selectedNode) { +// Useful.afterNextBuildDo(() { +// // if (Callout.anyPresent([SELECTED_NODE_BORDER_CALLOUT])) { +// unhighlightSelectedNode(); +// // } +// SnippetBloC? snippetBloc = FC().snippetBeingEdited; +// var gk = snippetBloc?.state.selectedWidgetGK; +// Rect? r = gk?.globalPaintBounds(); +// if (r != null) { +// double thickness = 4; +// double w = r.width + thickness * 2; +// double h = r.height + thickness * 2; +// Offset translate = Offset(-thickness, -thickness); +// // if (r.top < thickness || r.left < thickness || r.bottom < thickness || r.right < thickness) { +// // w = r.width; +// // h = r.height; +// // thickness = 10; +// // translate = Offset.zero; +// // } +// debugPrint("Showing $SELECTED_NODE_BORDER_CALLOUT"); +// Callout.showOverlay( +// ensureLowestOverlay: true, +// calloutConfig: CalloutConfig( +// feature: SELECTED_NODE_BORDER_CALLOUT, +// initialCalloutPos: +// r.topLeft.translate(translate.dx, translate.dy), +// suppliedCalloutW: w, +// suppliedCalloutH: h, +// fillColor: Colors.transparent, +// arrowType: ArrowType.NO_CONNECTOR, +// draggable: false, +// transparentPointer: true, +// ), +// boxContentF: (context) => InkWell( +// // onTap: () { +// // // removeNodeMenuCallout(); +// // showNodePropertiesCallout( +// // context: context, +// // selectedNode: this, +// // targetGKF: () => Node.selectionGK, //nodeGK, +// // ); +// // }, +// child: Container( +// width: w, +// height: h, +// decoration: BoxDecoration( +// color: Colors.transparent, +// border: Border.all( +// color: Colors.purpleAccent.withOpacity(.5), +// width: thickness), +// ), +// ), +// ), +// // targetGkF: () => snippetBloc?.state.selectedWidgetGK!, +// ); +// FC() +// .snippetBeingEdited +// ?.add(SnippetEvent.highlightNode(node: this)); +// // Useful.afterMsDelayDo(1000, () { +// // Useful.om.moveToTop("TreeNodeMenu".hashCode); +// // }); +// } +// }); +// } +// } +// } + // can be a MenuItemButton (default) or a SubmenuButton (override) // List toMenuItems(BuildContext context, { // required List nodeTypeCandidates, diff --git a/lib/src/snippet/snode_widget.dart b/lib/src/snippet/snode_widget.dart index c5463d89..49c9f841 100644 --- a/lib/src/snippet/snode_widget.dart +++ b/lib/src/snippet/snode_widget.dart @@ -123,7 +123,7 @@ class NodeWidget extends StatelessWidget { snippetBloc.add(SnippetEvent.selectNode( node: entry.node, // imageTC: tc, - selectedWidgetGK: GlobalKey(debugLabel: 'selectedWidgetGK'), + // selectedWidgetGK: GlobalKey(debugLabel: 'selectedWidgetGK'), selectedTreeNodeGK: GlobalKey(debugLabel: 'selectedTreeNodeGK'), )); Useful.afterNextBuildDo(() { diff --git a/lib/src/snippet/snodes/asset_image_node.dart b/lib/src/snippet/snodes/asset_image_node.dart index baec8de9..00d889df 100644 --- a/lib/src/snippet/snodes/asset_image_node.dart +++ b/lib/src/snippet/snodes/asset_image_node.dart @@ -43,7 +43,7 @@ class AssetImageNode extends CL with AssetImageNodeMappable { skipLabelText: true, onStringChange: (newValue) => refreshWithUpdate(() => name = newValue), calloutButtonSize: const Size(280, 70), - calloutSize: const Size(280, 70), + calloutSize: const Size(400, 120), ), DecimalPropertyValueNode( snode: this, diff --git a/lib/src/snippet/snodes/firebase_storage_image_node.dart b/lib/src/snippet/snodes/firebase_storage_image_node.dart index c4fbef25..9e100df4 100644 --- a/lib/src/snippet/snodes/firebase_storage_image_node.dart +++ b/lib/src/snippet/snodes/firebase_storage_image_node.dart @@ -41,7 +41,7 @@ class FirebaseStorageImageNode extends CL onStringChange: (newValue) => refreshWithUpdate(() => name = newValue), calloutButtonSize: const Size(280, 70), - calloutSize: const Size(280, 70), + calloutSize: const Size(400, 120), ), StringPropertyValueNode( snode: this, diff --git a/lib/src/snippet/snodes/fs_image_node.dart b/lib/src/snippet/snodes/fs_image_node.dart index 2d01ff75..875df800 100644 --- a/lib/src/snippet/snodes/fs_image_node.dart +++ b/lib/src/snippet/snodes/fs_image_node.dart @@ -31,60 +31,70 @@ class FSImageNode extends CL with FSImageNodeMappable { @override List createPropertiesList(BuildContext context) => [ - FSImagePathPropertyValueNode( + FSImagePathPropertyValueNode( snode: this, name: 'fullPath', stringValue: fsFullPath, - onPathChange: (newValue) => refreshWithUpdate(() => fsFullPath = newValue ?? 'gs://flutter-content-2dc30.appspot.com/missing-image.PNG'), + onPathChange: (newValue) => refreshWithUpdate(() => fsFullPath = + newValue ?? + 'gs://flutter-content-2dc30.appspot.com/missing-image.PNG'), calloutButtonSize: const Size(280, 70), ), DecimalPropertyValueNode( snode: this, name: 'width', decimalValue: width, - onDoubleChange: (newValue) => refreshWithUpdate(() => width = newValue), + onDoubleChange: (newValue) => + refreshWithUpdate(() => width = newValue), calloutButtonSize: const Size(80, 20), ), DecimalPropertyValueNode( snode: this, name: 'height', decimalValue: height, - onDoubleChange: (newValue) => refreshWithUpdate(() => height = newValue), + onDoubleChange: (newValue) => + refreshWithUpdate(() => height = newValue), calloutButtonSize: const Size(80, 20), ), DecimalPropertyValueNode( snode: this, name: 'scale', decimalValue: scale, - onDoubleChange: (newValue) => refreshWithUpdate(() => scale = newValue), + onDoubleChange: (newValue) => + refreshWithUpdate(() => scale = newValue), calloutButtonSize: const Size(80, 20), ), EnumPropertyValueNode( snode: this, name: 'fit', valueIndex: fit?.index, - onIndexChange: (newValue) => refreshWithUpdate(() => fit = BoxFitEnum.of(newValue)), + onIndexChange: (newValue) => + refreshWithUpdate(() => fit = BoxFitEnum.of(newValue)), ), EnumPropertyValueNode( snode: this, name: 'alignment', valueIndex: alignment?.index, - onIndexChange: (newValue) => refreshWithUpdate(() => alignment = AlignmentEnum.of(newValue)), + onIndexChange: (newValue) => + refreshWithUpdate(() => alignment = AlignmentEnum.of(newValue)), ), ]; @override Widget toWidget(BuildContext context, STreeNode? parentNode) { - setParent(parentNode); // propagating parents down from root + setParent(parentNode); // propagating parents down from root possiblyHighlightSelectedNode(); - return SizedBox( - key: createNodeGK(), - width: width, - height: height, - child: StorageImage(ref: FirebaseStorage.instance.ref( - fsFullPath ?? 'gs://flutter-content-2dc30.appspot.com/missing-image.PNG', - )), - ); + return StorageImage( + fit: fit?.flutterValue, + width: width, + height: height, + scale: scale??1.0, + alignment: alignment?.flutterValue ?? Alignment.center, + ref: FirebaseStorage.instance.ref( + fsFullPath ?? + 'gs://flutter-content-2dc30.appspot.com/missing-image.PNG', + ), + ); } @override @@ -128,4 +138,4 @@ class FSImageNode extends CL with FSImageNodeMappable { /// ); /// } ///} -/// ``` \ No newline at end of file +/// ``` diff --git a/lib/src/snippet/snodes/target_group_wrapper_node.dart b/lib/src/snippet/snodes/target_group_wrapper_node.dart index 4a4fc5fa..75b4ea8b 100644 --- a/lib/src/snippet/snodes/target_group_wrapper_node.dart +++ b/lib/src/snippet/snodes/target_group_wrapper_node.dart @@ -9,13 +9,13 @@ part 'target_group_wrapper_node.mapper.dart'; @MappableClass() class TargetGroupWrapperNode extends ButtonNode with TargetGroupWrapperNodeMappable { - SnippetName name; + // SnippetName name; List targets; List playList; TargetGroupWrapperNode({ - required this.name, + // required this.name, this.targets = const [], this.playList = const [], super.child, @@ -23,15 +23,15 @@ class TargetGroupWrapperNode extends ButtonNode @override List createPropertiesList(BuildContext context) => [ - StringPropertyValueNode( - snode: this, - name: 'wrapper name', - stringValue: name, - onStringChange: (newValue) => - refreshWithUpdate(() => name = newValue), - calloutButtonSize: const Size(280, 80), - calloutSize: const Size(280, 80), - ), + // StringPropertyValueNode( + // snode: this, + // name: 'wrapper name', + // stringValue: name, + // onStringChange: (newValue) => + // refreshWithUpdate(() => name = newValue), + // calloutButtonSize: const Size(280, 80), + // calloutSize: const Size(280, 80), + // ), ]; // @override @@ -49,7 +49,7 @@ class TargetGroupWrapperNode extends ButtonNode @override Widget toWidget(BuildContext context, STreeNode? parentNode) { setParent(parentNode); - return name != 'name?' + return child != null ? TargetsWrapper( parentNode: this, key: createNodeGK(), @@ -59,18 +59,10 @@ class TargetGroupWrapperNode extends ButtonNode color: Colors.orangeAccent, ), ) - : const Row( - children: [ - Text('wrapper must be assigned a name'), - Icon(Icons.error, color: Colors.redAccent), - ], - ); - return child?.toWidget(context, this) ?? - const Icon( - Icons.warning, - color: Colors.red, - size: 24, - ); + : TargetsWrapper( + parentNode: this, + key: createNodeGK(), + ); } @override diff --git a/lib/src/snippet/snodes/target_group_wrapper_node.mapper.dart b/lib/src/snippet/snodes/target_group_wrapper_node.mapper.dart index 8119722a..f69dbe1c 100644 --- a/lib/src/snippet/snodes/target_group_wrapper_node.mapper.dart +++ b/lib/src/snippet/snodes/target_group_wrapper_node.mapper.dart @@ -24,9 +24,6 @@ class TargetGroupWrapperNodeMapper @override final String id = 'TargetGroupWrapperNode'; - static String _$name(TargetGroupWrapperNode v) => v.name; - static const Field _f$name = - Field('name', _$name); static List _$targets(TargetGroupWrapperNode v) => v.targets; static const Field> _f$targets = Field('targets', _$targets, opt: true, def: const []); @@ -72,7 +69,6 @@ class TargetGroupWrapperNodeMapper @override final MappableFields fields = const { - #name: _f$name, #targets: _f$targets, #playList: _f$playList, #child: _f$child, @@ -94,7 +90,6 @@ class TargetGroupWrapperNodeMapper static TargetGroupWrapperNode _instantiate(DecodingData data) { return TargetGroupWrapperNode( - name: data.dec(_f$name), targets: data.dec(_f$targets), playList: data.dec(_f$playList), child: data.dec(_f$child)); @@ -165,8 +160,7 @@ abstract class TargetGroupWrapperNodeCopyWith< STreeNodeCopyWith<$R, STreeNode, STreeNode>? get child; @override $R call( - {String? name, - List? targets, + {List? targets, List? playList, STreeNode? child}); TargetGroupWrapperNodeCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( @@ -197,19 +191,16 @@ class _TargetGroupWrapperNodeCopyWithImpl<$R, $Out> $value.child?.copyWith.$chain((v) => call(child: v)); @override $R call( - {String? name, - List? targets, + {List? targets, List? playList, Object? child = $none}) => $apply(FieldCopyWithData({ - if (name != null) #name: name, if (targets != null) #targets: targets, if (playList != null) #playList: playList, if (child != $none) #child: child })); @override TargetGroupWrapperNode $make(CopyWithData data) => TargetGroupWrapperNode( - name: data.get(#name, or: $value.name), targets: data.get(#targets, or: $value.targets), playList: data.get(#playList, or: $value.playList), child: data.get(#child, or: $value.child)); diff --git a/lib/src/target_config/content/callout_snippet_content.dart b/lib/src/target_config/content/callout_snippet_content.dart index 049207a6..fcac9350 100644 --- a/lib/src/target_config/content/callout_snippet_content.dart +++ b/lib/src/target_config/content/callout_snippet_content.dart @@ -25,7 +25,7 @@ Future showSnippetContentCallout({ required bool justPlaying, }) async { // possibly transform before showing callout - TargetsWrapperState? parentTW = tc.targetWrapperState; + TargetsWrapperState? parentTW = tc.targetsWrapperState; Rect? wrapperRect = (parentTW?.widget.key as GlobalKey) .globalPaintBounds(); //Measuring.findGlobalRect(parentIW?.widget.key as GlobalKey); @@ -55,8 +55,8 @@ Future showSnippetContentCallout({ FC().addToSnippetCache( snippetName: tc.snippetName, rootNode: newSnippet, - initialVersionId: initialVersionId, - editing: true, + versionId: initialVersionId, + // editing: true, ); FC().targetSnippetBeingConfigured = newSnippet; } @@ -69,7 +69,7 @@ Future showSnippetContentCallout({ boxContentF: (boxCtx) => PointerInterceptor( child: BlocBuilder( builder: (context, state) { - return FC().targetSnippetBeingConfigured!.toWidget(boxCtx, null); + return FC().targetSnippetBeingConfigured!.toWidget(context, null); }, ), ), diff --git a/test/unit_test.mocks.dart b/test/unit_test.mocks.dart index ffc003a4..bb8a8902 100644 --- a/test/unit_test.mocks.dart +++ b/test/unit_test.mocks.dart @@ -96,7 +96,7 @@ class MockModelRepository extends _i1.Mock implements _i3.IModelRepository { @override _i4.Future saveSnippet({ - required String? snippetName, + required _i5.SnippetRootNode? snippetRootNode, required String? newVersionId, }) => (super.noSuchMethod( @@ -104,7 +104,7 @@ class MockModelRepository extends _i1.Mock implements _i3.IModelRepository { #saveSnippet, [], { - #snippetName: snippetName, + #snippetRootNode: snippetRootNode, #newVersionId: newVersionId, }, ), diff --git a/your_file.yaml b/your_file.yaml deleted file mode 100644 index 5f282702..00000000 --- a/your_file.yaml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file