extended_list 0.1.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

extended_list #

pub package GitHub stars GitHub forks GitHub license GitHub issues flutter-candies

Language: English | 中文简体

extended list(ListView/GridView) support track collect garbage of children/viewport indexes, build lastChild as special child in the case that it is loadmore/no more item and enable to layout close to trailing.

Web demo for ExtendedList

Use #

  • add library to your pubspec.yaml

  extended_list: any

  • import library in dart file

  import 'package:extended_list/extended_list.dart';

CollectGarbage #

track the indexes are collect, you can collect garbage at that monment(for example Image cache)

more detail

            extendedListDelegate: ExtendedListDelegate(
                collectGarbage: (List<int> garbages) {
                print("collect garbage : $garbages");

ViewportBuilder #

track the indexes go into the viewport, it's not include cache extent.

            extendedListDelegate: ExtendedListDelegate(
                viewportBuilder: (int firstIndex, int lastIndex) {
                print("viewport : [$firstIndex,$lastIndex]");

LastChildLayoutTypeBuilder #

build lastChild as special child in the case that it is loadmore/no more item.



        enum LastChildLayoutType {
        /// as default child

        /// follow max child trailing layout offset and layout with full cross axis extend
        /// last child as loadmore item/no more item in [ExtendedGridView] and [WaterfallFlow]
        /// with full cross axis extend

        /// as foot at trailing and layout with full cross axis extend
        /// show no more item at trailing when children are not full of viewport
        /// if children is full of viewport, it's the same as fullCrossAxisExtend

        extendedListDelegate: ExtendedListDelegate(
            lastChildLayoutTypeBuilder: (index) => index == length
                ? LastChildLayoutType.foot
                : LastChildLayoutType.none,

CloseToTrailing #

when reverse property of List is true, layout is as following. it likes chat list, and new session will insert to zero index. but it's not right when items are not full of viewport.

|               |
|               |
|     item2     |
|     item1     |
|     item0     |

to solve it, you could set closeToTrailing to true, layout is as following. support [ExtendedGridView],[ExtendedList],[WaterfallFlow]. and it also works when reverse is flase, layout will close to trailing.

|     item2     |
|     item1     |
|     item0     |
|               |
|               |
        reverse: true,
        extendedListDelegate: ExtendedListDelegate(closeToTrailing: true),

[0.1.5] #

  • fix histest when closeToTrailing is true.

[0.1.4] #

  • add web demo.

[0.1.3] #

  • fix issue about last one as foot.

[0.1.2] #

  • add license.

[0.1.1] #

  • reduce description.

[0.1.0] #

  • first release.


import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'example_route.dart';
import 'example_route_helper.dart';

///  create by zmtzawqlp on 2019/11/23

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ExtendedList Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      initialRoute: "fluttercandies://mainpage",
      onGenerateRoute: (RouteSettings settings) {
        var routeName = settings.name;
        //when refresh web, route will as following
        //   /
        //   /fluttercandies:
        //   /fluttercandies:/
        //   /fluttercandies://mainpage
        if (kIsWeb && routeName.startsWith('/')) {
          routeName = routeName.replaceFirst('/', '');

        var routeResult =
            getRouteResult(name: routeName, arguments: settings.arguments);

        if (routeResult.showStatusBar != null ||
            routeResult.routeName != null) {
          settings = FFRouteSettings(
              arguments: settings.arguments,
              name: routeName,
              isInitialRoute: settings.isInitialRoute,
              routeName: routeResult.routeName,
              showStatusBar: routeResult.showStatusBar);

        var page = routeResult.widget ??
                    name: 'fluttercandies://mainpage',
                    arguments: settings.arguments)

        final platform = Theme.of(context).platform;
        switch (routeResult.pageRouteType) {
          case PageRouteType.material:
            return MaterialPageRoute(settings: settings, builder: (c) => page);
          case PageRouteType.cupertino:
            return CupertinoPageRoute(settings: settings, builder: (c) => page);
          case PageRouteType.transparent:
            return FFTransparentPageRoute(
                settings: settings,
                pageBuilder: (BuildContext context, Animation<double> animation,
                        Animation<double> secondaryAnimation) =>
            return platform == TargetPlatform.iOS
                ? CupertinoPageRoute(settings: settings, builder: (c) => page)
                : MaterialPageRoute(settings: settings, builder: (c) => page);

Use this package as a library

1. Depend on it

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

  extended_list: ^0.1.5

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:extended_list/extended_list.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/extended_list.dart.

Run flutter format to format lib/extended_list.dart.

Format lib/src/rendering/sliver_grid.dart.

Run flutter format to format lib/src/rendering/sliver_grid.dart.

Format lib/src/rendering/sliver_list.dart.

Run flutter format to format lib/src/rendering/sliver_list.dart.

Format lib/src/widgets/scroll_view.dart.

Run flutter format to format lib/src/widgets/scroll_view.dart.

Format lib/src/widgets/sliver.dart.

Run flutter format to format lib/src/widgets/sliver.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
extended_list_library ^0.1.3 0.1.3
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