Show loading widget at bottom of loading lists#1
Open
DouglasValerio wants to merge 2 commits intoLucazzP:mainfrom
Open
Show loading widget at bottom of loading lists#1DouglasValerio wants to merge 2 commits intoLucazzP:mainfrom
DouglasValerio wants to merge 2 commits intoLucazzP:mainfrom
Conversation
LucazzP
reviewed
May 9, 2022
Comment on lines
287
to
294
| if (loadingTile != null) { | ||
| return loadingTile!; | ||
| return _handleLoadingState(index, data, loadingTile!); | ||
| } | ||
| if (loadingTileBuilder != null) { | ||
| return loadingTileBuilder!(); | ||
| return _handleLoadingState(index, data, loadingTileBuilder!()); | ||
| } | ||
| break; | ||
| case Status.success: |
Owner
There was a problem hiding this comment.
In that case, will not be better to return this _handleLoadingState if is with Status.loading or Status.success?
Because you added the success logic on this function, so the correct name for this function should be _mapIndexToTile, or something like that... What you think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the content type?
Why is this change necessary?
How does this address the issue?
The package already provided a well-thought implementation of a loading widget, which was shown when the resource state was set to
loading, so we took advantage of that and only treated the case for when the Resource is in theloadingstate, but already has some data from previous data-fetch calls.Firstly, we made sure that if the resource has some data, the length of the rendered list takes that into account, the actual implementation is quite simple, and can be viewed in: e1f5820
On the second pass, we made some modifications on the
_generateListBuilder(...Args)method, so it can keep rendering the existent data while also showing the loading widget at the bottom.The main change to the aforementioned method was the introduction of the
_handleLoadingState(..Args)which takes upon the role of performing some checks on whether the_generatedListBuildershould return a tile with rendered data or theloadingWidgetitself.The most sensitive task performed by the
_handleLoadingStatemethod is to ensure that we don't run into a range exception, once now, in theloadingstate we are rendering a list whose length is greater than the one on theResourceitself.The implementation of this method can be checked at: a4d7204