Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Rendering images from a directory chosen using SAF #3

Open
Chiggy-Playz opened this issue Oct 16, 2024 · 1 comment
Open

[HELP] Rendering images from a directory chosen using SAF #3

Chiggy-Playz opened this issue Oct 16, 2024 · 1 comment
Labels
question Further information is requested

Comments

@Chiggy-Playz
Copy link

How can this package along with saf_util be used to get access to a directory (using saf_util's openDirectory ig), then get all the images in that folder (can be hundreds or thousands), sort them according to last modified attribute (latest first) and then show them to the user using the Image.file widget. Thing is, the Image.file widget is unable to read from the actual file, despite opening the directory containing the file using saf_util. How can I tackle this in an efficient manner?

@mgenware
Copy link
Member

saf_util has a saveThumbnailToFile func to save thumbnail to a local file.

We have a similar app doing the exact same thing. To do everything in an efficient manner, caching is very important. First, list folder contents via saf_util. list and cache the results. Then we can do any sorting quickly on the cached list.

To render thumbnails efficiently, use Flutter's ListView.builder to render the list and load thumbnail in ListView.builder.itemBuilder with saf_util.saveThumbnailToFile. Do cache the thumbnail as well, so ListVIew can re-render thumbnails quickly during scrolling.

@mgenware mgenware added the question Further information is requested label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants