inview_notifier_list 1.0.0
inview_notifier_list: ^1.0.0 copied to clipboard

Flutter Android iOS Linux macOS web Windows

A Flutter package that builds a listview and notifies when the widgets are on screen.

example/lib/main.dart

import 'package:example/csv_example.dart';
import 'package:flutter/material.dart';

import 'my_list.dart';
import 'video_list.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        color: Colors.grey.shade300,
        child: HomePage(),
      ),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final List<Tab> myTabs = <Tab>[
    Tab(text: 'Example 1'),
    Tab(text: 'Example 2'),
    Tab(text: 'Autoplay Video'),
    Tab(text: 'Custom Scroll View'),
  ];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: myTabs.length,
      child: Scaffold(
        backgroundColor: Colors.grey.shade300,
        appBar: AppBar(
          title: Text('√ćnViewNotifierList'),
          centerTitle: true,
          bottom: TabBar(
            tabs: myTabs,
          ),
        ),
        body: TabBarView(
          children: <Widget>[
            MyList(
              key: ValueKey("list1"),
              initialInViewIds: ['0'],
              inViewArea: Container(
                height: 1.0,
                color: Colors.redAccent,
              ),
            ),
            MyList(
              initialInViewIds: ['0'],
              inViewPortCondition:
                  (double deltaTop, double deltaBottom, double vpHeight) {
                return (deltaTop < (0.5 * vpHeight) + 100.0 &&
                    deltaBottom > (0.5 * vpHeight) - 100.0);
              },
              inViewArea: Container(
                height: 200.0,
                color: Colors.redAccent.withOpacity(0.2),
              ),
            ),
            VideoList(),
            CSVExample(),
          ],
        ),
      ),
    );
  }
}
119
likes
110
pub points
91%
popularity

A Flutter package that builds a listview and notifies when the widgets are on screen.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

rvamsi1993@gmail.com

License

MIT (LICENSE)

Dependencies

flutter, stream_transform

More

Packages that depend on inview_notifier_list