loading_more_listview 1.0.1

loading_more_listview #

A Simple LoadingMore ListView

Use #

  • add library to your pubspec.yaml

dependencies:
  loading_more_listview: 1.0.0

  • import library in dart file

  import 'package:loading_more_listview/loading_more_listview.dart';

Argument #

all of the LisView arguments are supported except ScrollController(because i use it internally). other argumets are:

argumentdescriptiondefault
onLoadMorea void callBack for when ListView is ready for new items to be inserted.required
enableLoadMoreWhether ListView should show loadingIndicator at the end of itself or not.true
loadingIndicatora Widget that will be shown at end of the ListView Until new data is Inserted in it.CircularProgressIndicator

[1.0.0] - December 15, 2019

  • initial release.

example/main.dart

import 'dart:math';

import 'package:flutter/material.dart';

import 'package:loading_more_listview/loading_more_listview.dart';

void main() => runApp(ExamplePage());

class ExamplePage extends StatefulWidget {
  @override
  _ExamplePageState createState() => _ExamplePageState();
}

class _ExamplePageState extends State<ExamplePage> {
  List<String> _list = <String>[
    'item: 1',
    'item: 2',
    'item: 3',
    'item: 4',
    'item: 5',
    'item: 6',
    'item: 7',
    'item: 8',
    'item: 9',
    'item: 10',
  ];
  bool _enableLoadMore = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'LoadingMore ListView Example',
      home: Scaffold(
        appBar: AppBar(
          title: Text('LoadingMore ListView Example'),
        ),
        body: LoadMoreListView(
          itemCount: _list.length,
          enableLoadMore: _enableLoadMore,
          itemBuilder: _itemBuilder,
          onLoadMore: _onLoadMore,
        ),
      ),
    );
  }

  Widget _itemBuilder(BuildContext context, int index) {
    return ListTile(
      leading: FlutterLogo(),
      title: Text(
        _list.elementAt(index),
      ),
    );
  }

  void _onLoadMore() {
    setState(() {
      _list.addAll(_generateItems());
      _enableLoadMore = _list.length < 30;
    });
  }

  List<String> _generateItems() {
    final Random random = Random();
    return List<String>.generate(
      10,
      (_) => 'generated Item: ${random.nextInt(256)}',
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  loading_more_listview: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:loading_more_listview/loading_more_listview.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
10
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test