infinite_listview 1.0.0 copy "infinite_listview: ^1.0.0" to clipboard
infinite_listview: ^1.0.0 copied to clipboard

outdated

ListView with items that can be scrolled infinitely in both directions.

example/lib/main.dart

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

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

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: ExampleScreen(),
    );
  }
}

class ExampleScreen extends StatefulWidget {
  @override
  _ExampleScreenState createState() => _ExampleScreenState();
}

class _ExampleScreenState extends State<ExampleScreen> {
  final InfiniteScrollController _infiniteController = InfiniteScrollController(
    initialScrollOffset: 0.0,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Example'),
        actions: <Widget>[
          IconButton(
            icon: const Icon(Icons.arrow_downward),
            onPressed: () {
              _infiniteController.animateTo(_infiniteController.offset + 2000.0, duration: const Duration(milliseconds: 250), curve: Curves.easeIn);
            },
          ),
          IconButton(
            icon: const Icon(Icons.arrow_upward),
            onPressed: () {
              _infiniteController.animateTo(_infiniteController.offset - 2000.0, duration: const Duration(milliseconds: 250), curve: Curves.easeIn);
            },
          ),
        ],
      ),
      body: InfiniteListView.separated(
        controller: _infiniteController,
        itemBuilder: _buildItem,
        separatorBuilder: (BuildContext context, int index) => const Divider(height: 2.0),
      ),
    );
  }

  Widget _buildItem(BuildContext context, int index) {
    return Material(
      child: InkWell(
        onTap: () {},
        child: ListTile(
          title: Text('Item #$index'),
          subtitle: Text('Subtitle $index'),
          trailing: const Icon(Icons.chevron_right),
        ),
      ),
    );
  }
}
125
likes
0
pub points
94%
popularity

Publisher

verified publisherfluttercommunity.dev

ListView with items that can be scrolled infinitely in both directions.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on infinite_listview