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

Interdependent items builder #175

Merged
merged 9 commits into from
Sep 28, 2023
Merged

Conversation

rafaelsetragni
Copy link
Contributor

Due to difficulties implementing a chat app using the GroupedListView widget with the current itemBuilder and indexedItemBuilder methods, I added a new builder called interdependentItemBuilder to construct the items while bringing in the previous, current, and next elements on each step, resulting in better performance.

I also added:

  • A complete test case to verify that the previous, current, and next elements are delivered in the expected order, in various list sizes and sort orders using the new interdependentItemBuilder method.
  • Support for the Android and iOS platforms in the example app, allowing me to test the app's performance and usability on real devices.
  • An improved chat example app to fix layout mistakes in the previous example, and test its ability to expand the keyboard over the chat list, rebuild the chat list on each infinite scroll reload, and maintain good performance during testing.

Here is a print screen of the new Chat Example App:

A new interdependent builder has been added to construct a more efficient, complex GroupedListView where the current element is dependent on its neighboring elements.
Dart SDK increased from version 2.12 to 2.17 due to new functionalities only available for the new version.
The chat example app has been upgraded to include a more realistic implementation of a chat timeline, utilizing the new interdependent builder. Additionally, an infinite timeline feature was added to test the performance of the new method.
I added a test case to verify that the previous, current, and next elements are delivered in the expected order, in various list sizes and sort orders.
@@ -358,13 +363,25 @@ class _GroupedListViewState<T, E> extends State<GroupedListView<T, E>> {
/// Returns the widget for element positioned at [index]. The widget is
/// retrieved either by [widget.indexedItemBuilder] or [widget.itemBuilder].
Widget _buildItem(context, int index) {
final int elementsLength = _sortedElements.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless to declare it as a variable, just use _sortedElements.length in the one place needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also did the same thing for the variables key and value for the same reason.

rafaelsetragni and others added 4 commits January 29, 2023 08:36
Changed requested
Changed realized to reduce the number of operation inside _buildItem method
Commentary updated
@Dimibe
Copy link
Owner

Dimibe commented Sep 28, 2023

Thank you for your contribution, lgtm!

@Dimibe Dimibe merged commit 5bc586f into Dimibe:main Sep 28, 2023
1 check passed
@Dimibe Dimibe added the new feature New feature or request label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants