google / flutter.widgets

https://pub.dev/packages/flutter_widgets
BSD 3-Clause "New" or "Revised" License
1.38k stars 488 forks source link

Is there a way to extends Visibility detector viewport/bound box? #542

Open WOOVYWOOVY opened 1 month ago

WOOVYWOOVY commented 1 month ago

Problem description

This is a question regarding visibility detector.

Steps to reproduce

  1. A simple list view with each item has it's own visibility detector attached to it.

Expected behavior

I expected for the widgets from the simple list even when not fully visible (visibleFraction: 0.0), could be treated as a partially visible one (visibleFraction: 0.01~), by extending the viewport/bound box/the visible area within the same scroll position.

Actual behavior

If there's just a slight scroll between the edge of the viewport, the widget disappearance could be seen by the user, and I would like to prevent that.

Environment

I am using an android emulator.

Additional details

--

Any feedback is appreciated, thank you!

jamesderlin commented 1 month ago

I don't understand what you're asking for. You want the VisibilityDetector to report items as very slightly partially visible when they aren't actually visible at all?

Can you please describe a concrete example for what you want and why it would be useful?

WOOVYWOOVY commented 1 month ago

Thanks for the reply james! In my current app structure, it is quite hard to implement the classic shrinkwrap: false listview that would recycle widgets when they aren't visible which would improve the performance, so I am using a different approach where I'm thinking I'll be using visibility detector instead and the Visibility class to make the widgets disappear, to, at least, saves the performance.

But sadly I don't really understand how to extent the viewport so that user don't have to see a 'gap' which is a disappeared widget for a sec, and then finally the widget appeared filling the gap after that short moment.

It would be really useful and improve user experience if user doesn't have to see a gap when they're scrolling fast and having the 'invisible' widgets in the UI even just for a split second.

But maybe, you have another suggestion instead of this approach? Since I have a long list with just simple images, and everytime the list loads it rendered all the images in the list all at once, that hurts the performance... Thank you James!