inview_notifier_list 3.0.0 copy "inview_notifier_list: ^3.0.0" to clipboard
inview_notifier_list: ^3.0.0 copied to clipboard

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(),
          ],
        ),
      ),
    );
  }
}
478
likes
140
points
11.9k
downloads

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, stream_transform

More

Packages that depend on inview_notifier_list