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

Use ListView.builder for rendering transactions lists #192

Open
DanielOsorio01 opened this issue Nov 26, 2023 · 2 comments
Open

Use ListView.builder for rendering transactions lists #192

DanielOsorio01 opened this issue Nov 26, 2023 · 2 comments

Comments

@DanielOsorio01
Copy link

Hello. Regarding the following code:
https://github.com/appditto/natrium_wallet_flutter/blob/1e046ea64a23d54ec30138361d68ed5993a1efd5/lib/ui/home_page.dart#L547C3-L644C6

For better perfomance, it is recommended to use ListView.builder

@DanielOsorio01
Copy link
Author

This is an example of how to implement it:

// Return widget for list
Widget _getListWidget(BuildContext context) {
  if (StateContainer.of(context).wallet == null ||
      StateContainer.of(context).wallet.historyLoading) {
    // Loading Animation
    return ReactiveRefreshIndicator(
      backgroundColor: StateContainer.of(context).curTheme.backgroundDark,
      onRefresh: _refresh,
      isRefreshing: _isRefreshing,
      child: ListView.builder(
        padding: EdgeInsetsDirectional.fromSTEB(0, 5.0, 0, 15.0),
        itemCount: _getLoadingTransactionCount(), // Define this function
        itemBuilder: (context, index) {
          return _buildLoadingTransactionCard(index, context);
        },
      ),
    );
  } else if (StateContainer.of(context).wallet.history.length == 0) {
    // Code for when wallet history is empty
  } else {
    // Code for when wallet history is not empty
  }
  // Additional code for other cases
}

@arshnirmal
Copy link

Hey, i would like to work on this issue, can you assign it to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants