infinity_page_view 1.0.0

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 pub get

Alternatively, your editor might support flutter pub 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
69
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

We analyzed this package on Jul 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/infinity_page_view.dart.

Run flutter format to format lib/infinity_page_view.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is getting outdated. (-10.96 points)

The package was last published 57 weeks ago.

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.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin