preload_page_view 0.2.0 copy "preload_page_view: ^0.2.0" to clipboard
preload_page_view: ^0.2.0 copied to clipboard

A pre-load PageView widget which you can use it to preload one page before and after current page.

example/lib/main.dart

import 'package:example/page.dart';
import 'package:flutter/material.dart';
import 'package:preload_page_view/preload_page_view.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PreloadPageView Demo',
      home: PreloadPageViewDemo(),
    );
  }
}

class PreloadPageViewDemo extends StatefulWidget {
  PreloadPageViewDemo({Key? key}) : super(key: key);

  @override
  _PreloadPageViewState createState() => _PreloadPageViewState();
}

class _PreloadPageViewState extends State<PreloadPageViewDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("PreloadPageView Demo"),
        ),
        body: Container(
            child: PreloadPageView.builder(
          preloadPagesCount: 5,
          itemBuilder: (BuildContext context, int position) =>
              DemoPage(position),
          controller: PreloadPageController(initialPage: 1),
          onPageChanged: (int position) {
            print('page changed. current: $position');
          },
        )));
  }
}
299
likes
150
points
37k
downloads

Publisher

unverified uploader

Weekly Downloads

A pre-load PageView widget which you can use it to preload one page before and after current page.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on preload_page_view