I'm not sure I understand the use of RangeMaintainingScrollPhysics in Flutter.
What I have is a listview of variable items (think something like a twitter feed), and those items have images in them which dynamically load. If an image above your current position loads, then the listview item changes size and the whole list gets pushed down. The user loses his current position, which is annoying.
Reading the docs on RangeMaintainingScrollPhysics I thought that it would solve the problem I'm describing. But its not working for me at all, so either I am misunderstanding what it does or I misused it
Am I understanding what its purpose is?
Related
I have a long, scrollable list of widgets, and need to be able to restore the correct position in the list whenever the user switches from portrait to landscape, because the content is mainly text.
For now, I am using scrollable_positioned_list, but it isn't enough in some cases because its position is of course based on its immediate children. But when the child itself contains a bunch of other widgets, you get very imprecise positionning.
What I would want to do is to go down to the individual RenderParagraph or equivalent level, and look at their position in the viewport (using getOffsetToReveal for example) in order to position the scroll correctly.
In more descriptive steps :
I keep track of the "topmost" RenderObject,
The user goes from portait to landscape,
I scroll the list until the equivalent RenderObject is again the "topmost".
But to do that, I would need to get a listing of all RenderObjects currently in a given viewport, and I do not know how.
There also is visitChildElements, but the docs warns that is it potentially performance-intensive.
Thanks in advance. Other ideas around this problem are welcome too !
I want to display some text and containers one by one slowly as shown in the below gif. I tried in list view also but could not achieve it. If anyone has any ideas could you suggest me?.
For this particular example in the video, you can use the flutter_staggered_animations package.
Can i render an imagens only it'll visuble in scrollview?
My app has an list view with many products, when I scrolling down many times the performance of my app is down (i'm using a lazy list), i guess it's becase there many imagens (from web) render up my screen.
I'm thinking to do something like it:
You'll need to use Listview.builder with itemBuilder instead of a child
It will allow you to only render what is on the screen or what is likely to be on scrolled in the very near future - your performance will be considerably improved
I recommend watching this video from the Flutter Team on this topic (lazy load a big list view) at flutter.io - if you'd like to go deeper into the topic
use .builder when ever you can find.
Creates a scrollable, linear array of widgets that are created on demand.
This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.
for more follow ListView.builder
I've been Googling like crazy for a while now, and I simply can't find any answers to the question: is it possible to implement the Android List scrolling, without using an actual list UI?
I'm trying to make a grid of rectangles such as the kind you would find in a typical game app respond to finger movement in the same way that it does using Android lists (bounce on the bounds, the 'flick' effect, etc), but all of the approaches I've found involve over-complicated solutions involving extending the list, defining XML layouts, etc.
Would it not be possible to simply give an object variables for 'document' height, 'viewable' height and y-offset? I'm happy to give the delta (MS since last update) to the object on every update. It would also be good if the actual interactive region was also definable.
Additionally; are there strong advantages to using the ListView instead that I'm missing? I assume responsiveness comes into play, but I'm quite happily managing that manually at the moment.
Just use ScrollView directly, assuming you only need vertical scrolling.
I'm trying to develop a scrollable tile map in Cocos2D which uses an UIPanGestureRecognizer to do the dirty work, but while developing it, stumbled upon some problems for which I would like to ask for an advice.
The basic scrolling management works fine, it's precise and accurate and works by adding the translation recognized by the pan gesture manager to the tiles of the map. The problem is that the map is large and I just draw a small viewport of it, while I want to manage it like it's scrollable without any problem.
What I was thinking about is that, as soon as a whole row or column get out of the visible screen, it is moved to the opposite side, the corresponding texture rects are updated (I'm working entirely with a CCSpriteBatchNode), so that it will continuously update the viewport to make the whole thing work. This seems fine but I've found many problems in dealing with when to move the row/column, how to keep track of this issue (eg when pan changes direction from forth to back) and many little details which make me think that I should find a better approach.
Is there a common solution to my problem? That is: managing a scrollable viewport of a tilemap which should move over the whole map so the to the end user it seems like as if the map is infinite.
Thanks in advance
I solved my issue by developing a viewport in which rows and columns are effectively moved from left side to right side and from top side to bottom side.
This is done automatically when a new column or row enters the viewport and it's made by expanding the drawn viewport over the real one by an amount which is enough to avoid any graphical issue to the user.