Coder Social home page Coder Social logo

embraceitmobile / animated_tree_view Goto Github PK

View Code? Open in Web Editor NEW
60.0 2.0 29.0 24.54 MB

Animated TreeView based on AnimatedList allows building fully customizable Nodes that can be nested to infinite levels and children.

Home Page: https://pub.dev/packages/animated_tree_view

License: MIT License

Swift 0.49% Objective-C 0.01% Dart 86.85% HTML 0.52% CMake 5.29% C++ 6.43% C 0.40%
dart tree-structure animated flutter tree-view tree-list animated-list nested-list

animated_tree_view's Issues

Expand all nodes default or special node

Hi, Is there any way to expand all child nodes or specified node after all view build is complete? I changed the 'isExpanded' property of the TreeNode to true but it had no effect.

Custom name for node

Hi,

Currently when adding a new child or node, it is adding a name based on level and key.

What about adding a custom name? Is there any sample for this matter. I am trying to open a dialog to read the name and then I changed the code, but I am receiving some errors.

2D Scrolling

Flutter has implemented the 2d scrolling api, so this issue is to alert the developer to complete the todo for 2d scrolling that is present in the readme.

Lookup TreeNode by Key?

Is there any way to look up a TreeNode by a key? I want to expand a TreeNode within the tree, but I don't have a reference to the node, just its key.

Node Style

How do I change the style of the Node component, it appears pink, with rounded edges, how do I change this style?

It looks like this:

image

How do I change it to look like this?

image

Flutter 3.22 breaks package in release mode

Hello and thank you very much for this great package! It is definitely the best tree package in the Flutter World.
But with Flutter 3.22 the update behaviour of checkboxes is not properly working anymore when executing app in release.
This is probably related to this issue regarding keys: flutter/flutter#148983

We had to downgrade our app from Flutter 3.22 to 3.19. Now it is working again.
Would it be possible to make this project compatible with Flutter 3.22.x in release build?

Feature Request: allow items reordering

Hi, thank you for this package it's truly amazing!

I would like to suggest a new feature. It would be relly cool if this package could suppport item reorder using drag and drop.
Basically the user should be able to pick up a node of the tree and drag and drop it anywhere else in the tree at the same level.

What I'm suggesting is a behavior similar to this, but adapted to work on a tree structure:
expansion_tiles

There currently is no package that supports item reordering on more than 2 levels, and I believe this package has the structure to support this freature without any crazy work necessary, since it is already based on ReorderableListView.

I created a fork and started working on this, but my skills and understanding of the structure of this package are insuficcient to complete the task.

Dynamic change of root

Hi,

Thanks very much for this package.
I seem to have an issue when I change the root node and rebuild the treeview widget.
The treeview builds the same but when the build method is called it seems to remember the old root nodes. The build method is called with nodes that no longer exist in the new root node.
As an example if I create a root node with 3 nodes the build method is correctly called 3 times.
Then if I change the root node to just 1 node and rebuild then the builder is called 4 times.
This is the root node output - IndexedNode{children: [IndexedNode{children: [], key: 1, parent: IndexedNode{children: [...], key: /, parent: null}}], key: /, parent: null}

I am using the GetIt mixin with a stateless widget to create the TreeView.

Many Thanks
Garth

Question: Is there a way to deactivate "toggleExpansion" ?

Hi,
i'm looking for a way to, based on the item, to deactivate the expansion/collapse of its children.
Is there a way currently ?

Or is it something you want to achieve?
If yes, my suggestion would be something like, i could do the PR:

  Future<void> toggleExpansion(ITreeNode<Data> item) async {
    if (item.isExpandable == false) {
      return;
    }
    if (item.isExpanded)
      await collapseNode(item);
    else {
      expandNode(item);
      await applyExpansionBehavior(item);
    }
  }

Greets!

Please make AnimationController in ExpansionIndicatorState public

Hi, thanks for the great package. A minor thing though:
For simplifying the process of creating a custom ExpansionIndicator (extending the abstract ExpansionIndicatorState class), it would be nice to get public access to its AnimationController.

Right now it is private:
late final AnimationController _controller = AnimationController(
duration: animationDuration,
vsync: this,
);

Could you make it public by removing the underscore pls?

onItemTap exception

hey bro,I set onItemTap listener,it not works and got exception,maybe you use wrong data in that line.

onTap: onTap == null ? null : () => onTap!(item),

my exception

E/flutter ( 6743): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'TreeNode<BusinessTreeNode<dynamic>>' is not a subtype of type 'BusinessTreeNode<dynamic>'
E/flutter ( 6743): #0      ExpandableNodeItem.build.<anonymous closure> (package:animated_tree_view/tree_view/expandable_node.dart:51:49)
E/flutter ( 6743): #1      _ExpandableNodeContainer.build.<anonymous closure> (package:animated_tree_view/tree_view/expandable_node.dart:93:51)
E/flutter ( 6743): #2      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
E/flutter ( 6743): #3      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:627:11)
E/flutter ( 6743): #4      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:306:5)

Get objects in the tree

Hello, can somebody help me? I trying to get all objects in the tree so I can convert it to json to send to backend, but I can't understand how to do it.

layout error

tree view need x y scroll.
otherwise the ui layout is error
Screen Shot 2021-06-27 at 4 52 48 PM

Order issue when add a new node

Package version - 2.1.0
Type of tree - TreeView.simpleTyped
Flutter version - 3.13.6

There is an order issue when I add a node to a parent node where there are already expanded nodes, a new nodes is added to the wrong place

Screen.Recording.2023-11-13.at.10.37.03.mov

Unhandled Exception: Bad state: No element

When tapping the indented area in front of the card, throw Unhandled Exception: Bad state: No element at animated_list_controller.dart:145

TreeView.simple(
        key: globalKey,
        tree: tree,
        builder: (context, level, item) => Card(
              child: ListTile(
                title: Text("Item ${item.level}-${item.key}, ${data?["title"] ?? ""}"),
                subtitle: Text("Level $level"),
              ),
        ),
)

How to detect if node is expanding or shrinking in onItemTap method?

I am trying to dynamically lazy load data as long as user clicks on the e.g. Folder.

I was thinking about capturing the click using onItemTap and then detect if node is "expanding" in order to dynamically load and inject nodes.

Unfortunately in my case (using file_explorer_sample.dart) example: node.isExpanded is always true regarding if node is opening or closing.

onItemTap: (node) async {
  if (node.isExpanded) {
   // Why always true?
  }
}

Any idea how to detect current state of the node in onItemTap?

Related: #37

How to load the tree data only when it is needed?

I'm looking for a behavior similar to the java swing JTree. I want to build a tree model that allows the tree data to be loaded only when it is needed. My app's data is stored in a database and it is not practical to load it all into memory to build all the nodes up front. I suspect I can implement this but I'm curious since all the example code shows cases where the tree is loaded into memory.

expandAllChildren causes duplicate tree nodes

Good evening!

Thank you for creating this project. It has been awesome to use!

I have run into a bug using the new expandAllChildren feature released in version 2.0.0. When calling that method on the TreeViewController, it creates duplicates of all the items in the tree. I was able to reproduce the issue in your example Flutter app.

Here is a screenshot of the problem. Notice that there are two instances of Item 1-0E. All I did to get into this state is click the Expand all button exactly once. If you click it a few times then the duplicates are cleared out.

image

expandNode performance issue

I have a large data to display in the treeview. Root node has 1830 children inside. When expandNode is called for the root node for just expanding the root to see every 1st level node application freezes for more than 6 seconds. My suspicion is that its blocking the UI thread. Possible solution might be to isolate the expand node to make it not block the ui thread

expandAllChildren

Upon initial loading of the tree, it can be completely unfolded. But upon going back to the previous page and subsequently redirecting to this page, the tree does not unfold anew.

How to refresh UI state for node after check-box is clicked on such node?

I need a tree with a checkbox on each of its nodes. My current problem is that the checkbox ui state does not change right after I click the checkbox for that node, but it is then updated correctly when I expand or shrink the tree.

How can I make this work so that when a checkbox os pressed it's UI wii change too on the node?

[bug] item duplicated

2024-08-29.03.11.38.mov

I placed the TreeView on the second page of the PageView, the first time it entered normal, the second time there were duplicate items, or the expansion status was inconsistent.

UnimplementedError: combinePaths not implemented in HTML renderer [iOs Web]

When running a basic example of the tree in a Flutter application, on Web (Safari) I get an exception :
UnimplementedError: combinePaths not implemented in HTML renderer
treeOnPWA

Code Example:

TreeView.indexTyped<T, IndexedTreeNode>(
showRootNode: false,
indentation: const Indentation(style: IndentStyle.roundJoint),
expansionIndicatorBuilder: (context, node) =>
NoExpansionIndicator(tree: node),
onTreeReady: (controller) {
treeListModel.treeController = controller;
onTreeReady?.call(controller);
},
tree: snapshot.data!,
builder: treeListNodeBuilder,
);

Flutter doctor

[!] Flutter (Channel [user-branch], 3.19.3, on Microsoft Windows [Version 10.0.22631.3447], locale en-BE)
! Flutter version 3.19.3 on channel [user-branch] at D:\install\software\flutter\3.19.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.5.4)
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.87.2)
[!] Proxy Configuration ! NO_PROXY does not contain localhost
[√] Connected device (3 available)
[√] Network resources

Stacktrace :

Performing hot restart...
Reloaded application in 423ms.
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following UnimplementedError was thrown during paint():
UnimplementedError

The relevant error-causing widget was:
CustomPaint org-dartlang-app:///packages/mywebapp/main.dart:64:12

When the exception was thrown, this was the stack:
package:dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 194:49 throw
package:build_web_compilers/lib/ui/src/ui/canvas.dart 2200:5 combine
package:mywebapp/main.dart 115:21 paint
package:flutter/src/rendering/custom_paint.dart 531:12 [_paintWithPainter]
package:flutter/src/rendering/custom_paint.dart 572:7 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/box.dart 2508:14 defaultPaint
package:flutter/src/rendering/flex.dart 948:7 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/shifted_box.dart 70:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/shifted_box.dart 70:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/box.dart 2508:14 defaultPaint
package:flutter/src/rendering/custom_layout.dart 396:5 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/material/material.dart 530:11 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 384:12 pushLayer
package:flutter/src/rendering/proxy_box.dart 1757:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 135:10 _repaintCompositedChild
package:flutter/src/rendering/object.dart 95:5 repaintCompositedChild
package:flutter/src/rendering/object.dart 201:7 [_compositeChild]
package:flutter/src/rendering/object.dart 182:7 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 921:16 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/proxy_box.dart 2464:13 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 135:10 _repaintCompositedChild
package:flutter/src/rendering/object.dart 95:5 repaintCompositedChild
package:flutter/src/rendering/object.dart 201:7 [_compositeChild]
package:flutter/src/rendering/object.dart 182:7 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/proxy_box.dart 3174:11 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/box.dart 2508:14 defaultPaint
package:flutter/src/rendering/stack.dart 589:5 paintStack
package:flutter/src/rendering/stack.dart 597:7 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/proxy_box.dart 123:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 184:12 paintChild
package:flutter/src/rendering/view.dart 210:14 paint
package:flutter/src/rendering/object.dart 2211:7 [_paintWithContext]
package:flutter/src/rendering/object.dart 135:10 _repaintCompositedChild
package:flutter/src/rendering/object.dart 95:5 repaintCompositedChild
package:flutter/src/rendering/object.dart 937:29 flushPaint
package:flutter/src/rendering/binding.dart 346:19 drawFrame
package:flutter/src/widgets/binding.dart 774:13 drawFrame
package:flutter/src/rendering/binding.dart 283:5 [_handlePersistentFrameCallback]
package:flutter/src/scheduler/binding.dart 1101:15 [_invokeFrameCallback]
package:flutter/src/scheduler/binding.dart 1040:9 handleDrawFrame
package:flutter/src/scheduler/binding.dart 849:7
package:dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19 internalCallback

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#dc268 relayoutBoundary=up4:
creator: CustomPaint ← UnicornOutlineButton ← Column ← Center ← MediaQuery ← Padding ← SafeArea ←
_BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
AnimatedBuilder ← ⋯
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=1920.0, 0.0<=h<=Infinity)
size: Size(88.0, 48.0)
This RenderObject had the following descendants (showing up to depth 5):
child: RenderSemanticsGestureHandler#078b7 relayoutBoundary=up5 NEEDS-PAINT
child: RenderPointerListener#fd406 relayoutBoundary=up6 NEEDS-PAINT
child: RenderSemanticsAnnotations#9008b relayoutBoundary=up7 NEEDS-PAINT
child: RenderMouseRegion#dec56 relayoutBoundary=up8 NEEDS-PAINT
child: RenderSemanticsGestureHandler#cea3a relayoutBoundary=up9 NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: UnimplementedError

A similar issue has been reported in other library :
Github opened issue: flutter/flutter#44572

The issue happen only on Flutter Web (Safari Web browser) on Firefox it works without issue.

onItemTap is sent also when tapping on expansion handle

Hi, looks like there is no way during onItemTap to know if only the item has been tapped or the expansion handle.
I want to go onto next screen only when item (folder) is tapped, not when the expansion handle has been tapped to open children.
Is there any clue about this?

Tree is getting collapsed moving from one tab to another/screen

My tree expands for the first time, but when I move to another tab or page, it gets collapsed. I'm using GetX. I need my tree to remain expanded even if I move from one tab to another. How can I achieve this? I've attached code snippets and a video of the issue I'm facing.

class RelationTreeView extends StatefulWidget {
  @override
  State<RelationTreeView> createState() => _RelationTreeViewState();
}

class _RelationTreeViewState extends State<RelationTreeView> {
  final controller = Get.find<BookScanController>();

  @override
  Widget build(BuildContext context) {
    return GetBuilder<BookScanController>(
      builder: (_) => Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _heading(context),
          TreeView.simple(
            shrinkWrap: true,
            key: controller.globalKey,
            tree: controller.relationShipTree,
            showRootNode: false,
            expansionBehavior: ExpansionBehavior.scrollToLastChild,
            expansionIndicatorBuilder: (context, node) =>
                ChevronIndicator.upDown(
              tree: node,
              color: Theme.of(context).hintColor,
              padding: const EdgeInsets.all(15),
            ),
            indentation: Indentation(
              style: IndentStyle.squareJoint,
              thickness: 2.5,
              color: Theme.of(context).hintColor,
            ),
            builder: (context, node) => Container(
              margin: const EdgeInsets.only(top: 10, left: 10, right: 10),
              child: ListTile(
                leading: _.selectedPatientInfo == node.data
                    ? Icon(
                        Icons.check_circle_rounded,
                        size: 16,
                        color: Theme.of(context).indicatorColor,
                      )
                    : Icon(
                        Icons.check_circle_rounded,
                        size: 16,
                        color: Theme.of(context).disabledColor,
                      ),
                title: Text(
                  "${node.key}".toTitleCase(),
                  style: Theme.of(context).textTheme.bodySmall,
                ),
                subtitle: _patientCard(
                  node.data as Map<String, dynamic>?,
                  context,
                  node.level == 1 ? true : false,
                ),
                onTap: () {
                  controller.updateSelectedPatientInfo(
                    node.data as Map<String, dynamic>?,
                  );
                },
              ),
            ),
          ),
        ],
      ),
    );
  }

bookscancontroller.dart

class BookScanController extends GetxController{
   final globalKey = GlobalKey<TreeViewState>();

  TreeViewController? get tccontroller => globalKey.currentState?.controller;
  
   TreeNode relationShipTree = TreeNode.root();
  
   void _expandAllNodes() {
    tccontroller?.toggleExpansion(
      relationShipTree,
    );
  }
bandicam.2023-11-18.17-23-25-858.mp4

Build custom ExpansionIndicator

I am slightly confused about building custom ExpansionIndicator, do not know how to do it. Probably you can provide a small example.

Why node.data can be null?

If I declare the tree data type as not null it should preserve this type. If I want to make it nullable I just can put <MyType?>.

scroll to index 3.0

can you upgrade to scroll to index 3.0 that is compatible with flutter 3 ?

Error: Bad state: No element

When loading the view, I receive the following stack trace.
I cannot figure out what the issue is. Whether it is an issue in my code or in the module.

As far as I understand, the error is thrown by animated_tree_view. Can you confirm that?

My indexed tree only has two levels after root. 5 level 1 entries. the first two level 1 entries have 2 level 2 entries.

Error: Bad state: No element
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 337:5             last]
packages/animated_tree_view/tree_view/animated_list_controller.dart 145:44    <fn>
dart-sdk/lib/async/future.dart 424:39                                         <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19       internalCallback
Error: Bad state: No element
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 337:5             last]
packages/animated_tree_view/tree_view/animated_list_controller.dart 145:44    <fn>
dart-sdk/lib/async/future.dart 424:39                                         <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19       internalCallback

AnimatedList Performance When Handling Complex Data

I am using v2.2.1.
Seeing the above error when I am trying to update the TreeView in subsequent calls. First time it works fine.

Below is the complete code


class _FileItemBrowseState extends State<TreeViewBrowse> {
  TreeNode<FileSystemItem>? tree;
  String expandedPath = '';
  TreeViewController? _treeViewController;

  @override
  Widget build(BuildContext context) {
    return BlocBuilder<ListFileItemsCubit, ListFilesState>(
        builder: (context, state) {
      if (state.loading || state.items.isEmpty) {
        return const SizedBox.shrink();
      }
      updateTreeView(state);
      return _treeView(state);
    });
  }

  void updateTreeView(ListFilesState state) async {
    final childNodes = state.items.map((item) {
      return TreeNode<FileSystemItem>(data: item);
    }).toList();

    if (tree == null) {
      // First call, initialise the tree
      tree = TreeNode<FileSystemItem>.root();
      tree?.addAll(childNodes);
    } else if (expandedPath.isNotEmpty) {
      // Subsequent call, just update the tree
      final parentNode = tree?.elementAt(expandedPath);
      if (parentNode is TreeNode<FileSystemItem>) {
        parentNode.addAll(childNodes);
      }
      expandedPath = '';
    }
  }

  Widget _treeView(ListFilesState state) {
    return Expanded(
      child: TreeView.simpleTyped<FileSystemItem, TreeNode<FileSystemItem>>(
          builder: (_, node) {
            final item = node.data as FileSystemItem;
            return FileItemEntry(
              item: item,
              viewMode: BrowseView.list,
              selected: false,
              onChevronIconTap: () {
                if (item is Directory) {
                  expandedPath = node.path;
                  context.read<ListFileItemsCubit>().listFiles(
                      ListFileItemsEvent(widget.state.volume, item.path));
                }
              },
            );
          },
          tree: tree!,
          showRootNode: false,
          onTreeReady: (controller) {
            _treeViewController = controller;
          }),
    );
  }
}

Exception has occurred.

Hello, I implemented TreeView.simpleTyped but when I enter the page I get this error:

Exception has occurred.
ActionNotAllowedException (ActionNotAllowedException:
The insertNodes stream is not allowedfor the ListenableNode. The index based operations like 'insert' are not implemented in ListenableNode})

after that, the node tree appears normally. Can someone help me?

question for real world usecase

Hi @jawwad-hassan89 ,

Hope you are all well !

I am just dropping this message as I would like to create a teampass (https://teampass.net/) clone with flutter.

What would you advice me to use as an architecture for managing permission rights to items categories with view/edit/delete capability. I found flutter_rbac or dart-casbin

Screenshot of teampass:
pf_tp_5
Thanks for any insights or inputs to help me to boostrap this project.

The bottleneck I see, is that have I hace 30k items to hook in the the tree view. Is It possible to make the tree view searchable ?

Cheers,
Luc

Not generating unique keys for the nodes

I got this error (

if (children.containsKey(node.key)) throw DuplicateKeyException(node.key);
) when I have a Node with a lot of children.

In my case it happens (sometimes) when I open this tree location (/bin/), where there are a lot of children.

I bypass this error by providing a String key to every node.

I suggest that maybe you can provide an int instead of String (2^64 unique keys is enough).

Also I tried to use int keys like this: '$keyIndex++', but I got same error: (0 key is yet used, 1 key is yet used, ...).

v2.0.1 ,add node to rootNode will produce repeated subNode UI

When there are three child nodes under the hidden root node of the tree, adding a child node on the root node will copy the above three child nodes under the new child node, resulting in repeated UI; The demo project also has this problem

duplicate.mp4

Question: Editing Tree Hierarchy

Is there a way if the user have a flat list of items/nodes, to edit the hierarchy; to move certain nodes under a specific parent and vice versa?

Functionality like slide to right to (indent) the node and make it nested under the parent or dropdown to choose (Parent of Child from the list). (ex. Notes or Checklist app)

Something like DragAndDropLists or nested_reorderable_list but with the same functionality animated_tree_view has where you can add or delete children

Unhandled Exception: Exception: Animated list state not found from GlobalKey<AnimatedListState>

My code:

for (var element in _rootNode.childrenAsList) { if (element.key == parentKey.toString()) { try { element .add(TreeNode(key: context.uid.toString())); } catch (e) {} return; } }

Exception:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Animated list state not found from GlobalKey
#0 _AnimatedListState.insertItem
tree_view.dart:495
#1 AnimatedListController.insert
animated_list_controller.dart:65
#2 AnimatedListController.insertAll
animated_list_controller.dart:70
#3 AnimatedListController.expandNode
animated_list_controller.dart:116
#4 AnimatedListController.handleAddItemsEvent
animated_list_controller.dart:208
#5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
#6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#7 _DelayedData.perform (dart:async/stream_impl.dart:515:14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.