flutter_expandable_table icon indicating copy to clipboard operation
flutter_expandable_table copied to clipboard

UI become slow and unresponsive when you have more than 100 rowsCount

Open ArslanAsghar123 opened this issue 2 years ago • 8 comments

https://github.com/rickypid/flutter_expandable_table/assets/56467320/c2707f43-509f-492a-a5fe-e220b27fc6b7

i set the data as follow static const int columnsCount = 29; static const int subColumnsCount = 2; static const int rowsCount = 100; static const int subRowsCount = 10; static const int totalColumns = columnsCount + subColumnsCount;

PTN: i used the same code in example

ArslanAsghar123 avatar Dec 06 '23 10:12 ArslanAsghar123

Is this solved? Currently I'm getting very laggy UI with the data static const int columnsCount = 6; static const int subColumnsCount = 0; static const int rowsCount = 100; static const int subRowsCount = 100; static const int totalColumns = columnsCount + subColumnsCount;

coderof19clc7 avatar Nov 15 '24 01:11 coderof19clc7

Hi @rickypid , after exploring the code of the package, I think the problem may come from the SingleChildScrollView and ListView as they will surely always render everything in the list all the time. So can you try to use ListView.builder or CustomScrollView instead and test with the large amount of item? Thanks

coderof19clc7 avatar Nov 15 '24 06:11 coderof19clc7

Hi @coderof19clc7,

unfortunately I am in a very busy work period, it may be that the problem is related to SingleChildScrollView/ListView, I would have to do some tests to understand the impact of this change, I hope in the next few weeks to have a chance to look into the problem. Sorry

rickypid avatar Nov 15 '24 10:11 rickypid

@coderof19clc7 I resolved this issue by creating a custom table, and you're right — the ListView was causing the problem. However, you can also achieve the desired result using a ListView.builder with each row as a child. Additionally, I added an API call for expanded rows, which provides a faster UI experience by loading data for a row only when it's developed. The drawback of ListView.builder is its default behaviour of collapsing expanded rows when the view scrolls off-screen, as it optimizes performance by recycling views.

ArslanAsghar123 avatar Nov 18 '24 09:11 ArslanAsghar123

Hi @ArslanAsghar123,

Could you create a PR with the changes to solve this issue?

Thank you!!!

rickypid avatar Nov 18 '24 09:11 rickypid

@rickypid I'll handle it as soon as possible, although I'm currently managing a busy schedule. (Note: I built a custom table with a mapper to manage row and column data, and I will transfer its logic to your repository)

ArslanAsghar123 avatar Nov 18 '24 09:11 ArslanAsghar123

@ArslanAsghar123 As soon as you have time, I would like to solve this performance problem and if you have a suggestion, it is welcome!!!! 🚀

rickypid avatar Nov 18 '24 09:11 rickypid

Hi @ArslanAsghar123 and sorry for the reminder, have you had a chance to prepare a PR draft to propose your changes?

rickypid avatar Dec 26 '24 17:12 rickypid