thechinkysight / paginable

A Flutter package which makes pagination easier.
https://pub.dev/packages/paginable
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

loads forever if items less than screen height #9

Closed hampsterx closed 2 years ago

hampsterx commented 2 years ago

nice library, almost.

If the list is short (eg 5 items) it will show progressIndicator forever.

eg

import 'package:flutter/material.dart';
import 'package:paginable/paginable.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',

      home: Scaffold(body: PaginableListViewBuilder(
          loadMore: () async {},
          errorIndicatorWidget: (exception, tryAgain) => Container(
            color: Colors.redAccent,
            height: 130,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(
                  exception.toString(),
                  style: const TextStyle(fontSize: 16),
                ),
                const SizedBox(
                  height: 16.0,
                ),
                ElevatedButton(
                  style: ButtonStyle(
                    backgroundColor:
                    MaterialStateProperty.all(Colors.green),
                  ),
                  onPressed: tryAgain,
                  child: const Text('Try Again'),
                ),
              ],
            ),
          ),
          progressIndicatorWidget: const SizedBox(
            height: 20,
            child: Center(
              child: CircularProgressIndicator(),
            ),
          ),
          itemBuilder: (context, index) => ListTile(
            leading: CircleAvatar(
              child: Text(
                index.toString(),
              ),
            ),
          ),
          itemCount: 5),

    ));
  }
}
thechinkysight commented 2 years ago

I had updated the package with a patch, please try using latest version of paginable which is v1.1.1