nilshenrich / FileTreeHasher

Cross plattform tool to automatically hash and check single file or whole directory tree
https://nilshenrich.github.io/FileTreeHasher/
MIT License
0 stars 0 forks source link

Load folder updating file tree #2

Closed nilshenrich closed 12 months ago

nilshenrich commented 1 year ago

When selecting a new folder to load, the complete widget tree is created and the GUI is updated once the creation process is finished.\ When loading big folders, this takes some time making the GUI stuck.

The folder loading process shall be visible on the GUI.

nilshenrich commented 1 year ago

The items list is built recursively and passed completely to the widget builder only once. The list must be updated step by step and the widget builder must be updated every time

nilshenrich commented 1 year ago

Development steps:

  1. Modify _loadedTrees directly instead local variable
  2. Update state on every added item. Only top level files for the first try
  3. Pass reference to inner sub-tree to update _loadedTrees in recursions
nilshenrich commented 1 year ago

Development steps:

1. Modify `_loadedTrees` directly instead local variable

2. Update state on every added item. Only top level files for the first try

3. Pass reference to inner sub-tree to update `_loadedTrees` in recursions

setState doesn't update directly. The program still waits for the end of _showNewFolder and updates everything together

nilshenrich commented 1 year ago

Development steps:

1. Modify `_loadedTrees` directly instead local variable

2. Update state on every added item. Only top level files for the first try

3. Pass reference to inner sub-tree to update `_loadedTrees` in recursions

setState doesn't update directly. The program still waits for the end of _showNewFolder and updates everything together

I saw the button hover focus and tooltip stays as long as the selectNewFolder is running, so the GUI seems frozen for this time\ -> Call async?

nilshenrich commented 1 year ago

Live update works for hash generation.

Test: Not working if trying to increase slowly in non-async function: 0e7ed8263352ccaefbe946ce0753375eaabf7cd8

nilshenrich commented 1 year ago

Live update works for hash generation.

Test: Not working if trying to increase slowly in non-async function: 0e7ed8263352ccaefbe946ce0753375eaabf7cd8

Still not working within async method: da172dbe41ad8d5827a92e376d598437ef647b5f

nilshenrich commented 1 year ago

Live update works for hash generation. Test: Not working if trying to increase slowly in non-async function: 0e7ed82

Still not working within async method: da172db

any async function needs to be await-ed to make it work

nilshenrich commented 1 year ago

It is not possible to update a StatelessWidget like T_FileTreeView dynamically as after first setState, the widget is recreated and a dynamic sub-pointer loses its connection.

-> Better making the T_FileTreeView a StatefulWidget where items can be added dynamically using a method

nilshenrich commented 1 year ago

It is not possible to update a StatelessWidget like T_FileTreeView dynamically as after first setState, the widget is recreated and a dynamic sub-pointer loses its connection.

-> Better making the T_FileTreeView a StatefulWidget where items can be added dynamically using a method

Can T_FileTreeView be a specialized T_FolderView ? Then there would be no difference between adding items to folder or to tree.

nilshenrich commented 1 year ago

Use provider to manage state changes from outside a widget.\ Insight the ChangeNotifier class the subitems shall be buffered and the load shall be called. A folder can be stateless then.

Tutorial: https://youtu.be/FUDhozpnTUw?si=TZsTQEmgbQx29vTL

nilshenrich commented 1 year ago

Use provider to manage state changes from outside a widget. Insight the ChangeNotifier class the subitems shall be buffered and the load shall be called. A folder can be stateless then.

Tutorial: https://youtu.be/FUDhozpnTUw?si=TZsTQEmgbQx29vTL

Folder must stay stateful because the content shall be able to be collapsed and expanded

nilshenrich commented 1 year ago

Next steps on branch "provider" (e3707678549db1cae0e42a5a2aa67f24e1380890):

  1. Recreate complex tree view item types
  2. A folder view shall have a function to add one item
  3. Update provider using a T_FileTreeView without children
  4. Add function to load file tree from system to P_FileTree, so the GUI can be updated on each recursive action
  5. Load child elements of 1. grade into file tree
  6. Load deeper child elements recursively updating the GUI after each add action
nilshenrich commented 12 months ago

Works now with 5e83498124b2b2bc4e91dc38d913bb65fdd57fb0.

But the view is not updated as long the folder stays expanded. Only collapsing and expanding updates the view

nilshenrich commented 12 months ago

Works now with 5e83498.

But the view is not updated as long the folder stays expanded. Only collapsing and expanding updates the view

Make widgets stateful?

nilshenrich commented 12 months ago

Works now with 5e83498.

But the view is not updated as long the folder stays expanded. Only collapsing and expanding updates the view

Make widgets stateful?

Or the widget could be recreated with children. Either in add method or manually after adding a child.

nilshenrich commented 12 months ago

Done with 445c4fece9086194a9459bfd54ea43fa76de9c44