infinity_page_view 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 81

infinity_page_view

A Flutter infinity page view.

build status

Showcase

Usage

Example: add the module to your project pubspec.yaml:

    
    dependencies:
     ...
     infinity_page_view: ^1.0.0
    

And install it using flutter packages get on your project folder. After that, just import the module and use it:

 
 import 'package:infinity_page_view/infinity_page_view.dart';
 
 ...
 
 InfinityPageController infinityPageController = new InfinityPageController(initialPage: 0);
 ...
 
 
 new SizedBox(
   height: 300.0,
   child: new InfinityPageView(
     itemBuilder: (BuildContext context, int index) {
       switch (index) {
         case 0:
           return new Image.network(
             "http://via.placeholder.com/350x150",
             fit: BoxFit.fill,
           );
         case 1:
           return new Image.network(
             "http://via.placeholder.com/250x100",
             fit: BoxFit.fill,
           );
       }
       return new Image.network(
         "http://via.placeholder.com/288x188",
         fit: BoxFit.fill,
       );
     },
     itemCount: itemCount,
     onPageChanged: (int index) {
       setState(() {
         label = "${index+1}/${itemCount}";
       });
     },
     controller: infinityPageController,
   ),
 ),

[0.0.1] - [2018/05/19]

  • Init project
  • Add example
  • Infinity page view

[0.0.2] - [2018/05/19]

  • Update README

[0.0.3] - [2018/05/19]

  • Init itemCount when create the controller

[0.0.4] - [2018/05/21]

  • Fix Init controller error when controller is null

[0.0.5] - [2018/05/24]

  • Fix zero itemCount bug

[1.0.0] - [2018/06/07]

  • Redesign controller
  • Add unit test
  • Add CI

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:infinity_page_view/infinity_page_view.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'infinity_page_view'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String label;
  int itemCount;
  InfinityPageController infinityPageController;

  @override
  void initState() {
    //  infinityPageController = new InfinityPageController(initialPage: 0);
    itemCount = 3;
    label = "1/${itemCount}";
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          title: new Text(widget.title),
        ),
        body: new Column(
          children: <Widget>[
            new SizedBox(
              height: 300.0,
              child: new InfinityPageView(
                itemBuilder: (BuildContext context, int index) {
                  switch (index) {
                    case 0:
                      return new Image.network(
                        "http://via.placeholder.com/350x150",
                        fit: BoxFit.fill,
                      );
                    case 1:
                      return new Image.network(
                        "http://via.placeholder.com/250x100",
                        fit: BoxFit.fill,
                      );
                  }
                  return new Image.network(
                    "http://via.placeholder.com/288x188",
                    fit: BoxFit.fill,
                  );
                },
                itemCount: itemCount,
                onPageChanged: (int index) {
                  setState(() {
                    label = "${index+1}/${itemCount}";
                  });
                },
                controller: infinityPageController,
              ),
            ),
            new Text(
              label,
              style: new TextStyle(fontSize: 100.0),
            ),
            new Row(
              children: <Widget>[
                new FlatButton(
                    onPressed: () {
                      print("the page is ${infinityPageController.page}");

                      infinityPageController.animateToPage(
                          infinityPageController.page - 1,
                          duration: new Duration(milliseconds: 300),
                          curve: Curves.ease);
                    },
                    child: new Text("left")),
                new FlatButton(
                    onPressed: () {
                      print("the page is ${infinityPageController.page}");

                      infinityPageController.animateToPage(
                          infinityPageController.page + 1,
                          duration: new Duration(milliseconds: 300),
                          curve: Curves.ease);
                    },
                    child: new Text("right")),
                new FlatButton(
                    onPressed: () {
                      print("the page is ${infinityPageController.page}");

                      infinityPageController
                          .jumpToPage(infinityPageController.page - 1);
                    },
                    child: new Text("left")),
                new FlatButton(
                    onPressed: () {
                      print("the page is ${infinityPageController.page}");

                      infinityPageController
                          .jumpToPage(infinityPageController.page + 1);
                    },
                    child: new Text("right")),
              ],
            ),
          ],
        ));
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  infinity_page_view: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:infinity_page_view/infinity_page_view.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jun 7, 2018 Go to the documentation of infinity_page_view 1.0.0 Download infinity_page_view 1.0.0 archive
0.0.5 May 24, 2018 Go to the documentation of infinity_page_view 0.0.5 Download infinity_page_view 0.0.5 archive
0.0.4 May 21, 2018 Go to the documentation of infinity_page_view 0.0.4 Download infinity_page_view 0.0.4 archive
0.0.3 May 19, 2018 Go to the documentation of infinity_page_view 0.0.3 Download infinity_page_view 0.0.3 archive
0.0.2 May 19, 2018 Go to the documentation of infinity_page_view 0.0.2 Download infinity_page_view 0.0.2 archive
0.0.1 May 19, 2018 Go to the documentation of infinity_page_view 0.0.1 Download infinity_page_view 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8
  • Flutter: 0.5.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Format lib/infinity_page_view.dart.

Run flutter format to format lib/infinity_page_view.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.48.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.11
meta 1.1.5 1.1.6
sky_engine 0.0.99
typed_data 1.1.5 1.1.6
vector_math 2.0.6 2.0.8
Dev dependencies
flutter_test