👆🏻 Builds indication marks for PageView.

Overview

PageViewIndicator Pub Package

Builds indication marks for PageView.

Import

import 'package:page_view_indicator/page_view_indicator.dart';

Usage

Default Material behavior

return PageViewIndicator(
  pageIndexNotifier: pageIndexNotifier,
  length: length,
  normalBuilder: (animationController, index) => Circle(
        size: 8.0,
        color: Colors.black87,
      ),
  highlightedBuilder: (animationController, index) => ScaleTransition(
        scale: CurvedAnimation(
          parent: animationController,
          curve: Curves.ease,
        ),
        child: Circle(
          size: 12.0,
          color: Colors.black45,
        ),
      ),
);

Example 1


Custom animations

return PageViewIndicator(
  pageIndexNotifier: pageIndexNotifier,
  length: length,
  normalBuilder: (animationController, index) => Circle(
        size: 8.0,
        color: Colors.black87,
      ),
  highlightedBuilder: (animationController, index) => ScaleTransition(
        scale: CurvedAnimation(
          parent: animationController,
          curve: Curves.ease,
        ),
        child: Circle(
          size: 8.0,
          color: Colors.white,
        ),
      ),
);

Example 2


Custom icons

It's not just about dots!

return PageViewIndicator(
  pageIndexNotifier: pageIndexNotifier,
  length: length,
  normalBuilder: (animationController, index) => ScaleTransition(
        scale: CurvedAnimation(
          parent: animationController,
          curve: Curves.ease,
        ),
        child: Icon(
          Icons.favorite,
          color: Colors.black87,
        ),
      ),
  highlightedBuilder: (animationController, index) => ScaleTransition(
        scale: CurvedAnimation(
          parent: animationController,
          curve: Curves.ease,
        ),
        child: Icon(
          Icons.star,
          color: Colors.white,
        ),
      ),
);

Example 3

Changing the space bettwen the indicators

You can change the padding around the indicators using the indicatorPadding property:

return PageViewIndicator(
  pageIndexNotifier: pageIndexNotifier,
  length: length,
  indicatorPadding: const EdgeInsets.all(4.0)
  ...

Default is const EdgeInsets.all(8.0).

Comments
  • Page Indicator overflowed, if we have many Pages

    Page Indicator overflowed, if we have many Pages

    The issue is this, if I use the Page Indicator and set the length property to a large value, it overflowed from the screen which make the app look like it crashes. The code is PageViewIndicator( pageIndexNotifier: _currentPageNotifier, length: 20, indicatorPadding: EdgeInsets.all(5.0), normalBuilder: (animationController, index) => Circle( size: 8.0, color: Colors.black87, ), highlightedBuilder: (animationController, index) => ScaleTransition( scale: CurvedAnimation( parent: animationController, curve: Curves.ease, ), child: Circle( size: 20.0, color: Colors.grey, ), ), ); Screenshot_1592486410

    question 
    opened by ParagSaini 3
  • Page indicator length not updated if dynamically changed

    Page indicator length not updated if dynamically changed

    Hi, basically same issue as this one - https://github.com/leocavalcante/page_view_indicator/issues/1 If PageViewIndicator is inside StreamBuilder and item count is dynamically changed, the number of indicators stays the same. Here is a quick code to reproduce the issue:

    import 'dart:async';
    
    import 'package:flutter/material.dart';
    import 'package:page_view_indicator/page_view_indicator.dart';
    
    class App extends StatefulWidget {
      @override
      _AppState createState() => _AppState();
    }
    
    class _AppState extends State<App> {
      final pageIndexNotifier = ValueNotifier<int>(0);
      int _counter = 2;
      StreamController<int> _events;
    
      @override
      void initState() {
        super.initState();
        _events = StreamController<int>();
        _events.add(_counter);
      }
    
      void _incrementCounter() {
        _counter++;
        _events.add(_counter);
      }
    
      void _decrementCounter() {
        if (_counter > 1) {
          _counter--;
          _events.add(_counter);
        }
      }
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: StreamBuilder<int>(
              stream: _events.stream,
              builder: (context, snapshot) {
                if (!snapshot.hasData) {
                  return const SizedBox.shrink();
                }
    
                return Stack(
                  alignment: FractionalOffset.bottomCenter,
                  children: <Widget>[
                    PageView.builder(
                      onPageChanged: (index) => pageIndexNotifier.value = index,
                      itemCount: snapshot.data,
                      itemBuilder: (context, index) {
                        return Container(
                          decoration: BoxDecoration(color: Colors.accents[index]),
                        );
                      },
                    ),
                    _buildExample1(snapshot.data),
                    Center(
                      child: Text(snapshot.data.toString()),
                    ),
                  ],
                );
              },
            ),
            floatingActionButton: Column(
              crossAxisAlignment: CrossAxisAlignment.end,
              mainAxisAlignment: MainAxisAlignment.end,
              children: <Widget>[
                FloatingActionButton(
                  onPressed: _incrementCounter,
                  tooltip: 'Increment',
                  child: Icon(Icons.exposure_plus_1),
                ),
                const SizedBox(height: 16),
                FloatingActionButton(
                  onPressed: _decrementCounter,
                  tooltip: 'Decrement',
                  child: Icon(Icons.exposure_neg_1),
                ),
              ],
            ),
          ),
        );
      }
    
      PageViewIndicator _buildExample1(int length) {
        return PageViewIndicator(
          pageIndexNotifier: pageIndexNotifier,
          length: length,
          normalBuilder: (animationController, index) => Circle(
            size: 8.0,
            color: Colors.black87,
          ),
          highlightedBuilder: (animationController, index) => ScaleTransition(
            scale: CurvedAnimation(
              parent: animationController,
              curve: Curves.ease,
            ),
            child: Circle(
              size: 12.0,
              color: Colors.accents.elementAt(9),
            ),
          ),
        );
      }
    }
    
    void main() => runApp(App());
    
    bug 
    opened by liri2006 3
  • Widget length not updated

    Widget length not updated

    I'm using the PageViewIndicator inside a StreamBuilder. The streamBuilder returns a List of object. When object is added in the list and the StreamBuilder is triggered, the PageViewIndicator is NOT updated (number of dot stays the same).

    If I try to insert a "basic" Text Widget, the Text is updated correctly with the number of objects in my list

    invalid 
    opened by fvisticot 2
  • Fix indicator unmark issue when currentPage is different than 0

    Fix indicator unmark issue when currentPage is different than 0

    There was a bug with marking the previous page as normal if currentPage was different than 0. e.g: CurrentPage is (5) PageIndexNotifier is (5)

    After changing page from 5 to 6 listener will invoke and it will mark _prevPage indicator as normal but _prevPage was 0, not 5.

    enhancement 
    opened by Szfymen 1
  • How do you adjust padding or spaces between the dots?

    How do you adjust padding or spaces between the dots?

    Great work on this. How do you adjust padding or spaces between the dots? For instance, I might want the dots to be aligned much closer together. How can this be achieved? If possible, it will be helpful to include that somewhere in the README.md examples.

    question 
    opened by ojiofong 1
  • duplicate listener issue

    duplicate listener issue

    Can I ask why _addIndicatorsListener is called in didUpdateWidget? Currently everytime the widget tree gets rebuilt, duplicate listener is added to the list of widget.pageIndexNotifier listeners and it can sum up to infinite number of duplicate listeners.

    https://github.com/leocavalcante/page_view_indicator/blob/1876bb6e3a49157a205f44980eae12b0f4e1c16d/lib/page_view_indicator.dart#L94

    As the pageIndexNotifier is the same object every rebuild time, it's safe to add the listener only in initState.

    question 
    opened by krokyze 0
  • Change Indicator Error

    Change Indicator Error

    if I build widget currentPage: 1,then setpageIndexNotifier.value = 0,the indicator don't change.

    because the initial value of _prevPage in _PageViewIndicatorState is 0.

    maybe the initial value of _prevPage should be null.

    bug 
    opened by oliverlife 0
  • Moving pageIndexNotifier.addListener from initState to a separated method

    Moving pageIndexNotifier.addListener from initState to a separated method

    The pageIndexNotifier.addListener was being invoked in initState but initState is called only once in the widget's life cycle so when you navigated from one screen to another the indicator stops working. I moved the call to a method that is called in build.

    help wanted invalid 
    opened by eudangeld 0
  • Navigate to the page by tapping on the dot

    Navigate to the page by tapping on the dot

    Thank you for the nice plugin, easy to use, works perfectly. Have one issue though - didn't find a way to navigate PageView on certain page when user tap on the page's dot. It is quite standard behavior for such kind of navigation. Will appreciate a help with how to get such behavior.

    opened by ashemetov 0
Owner
Leo Cavalcante
PHP Software Engineer @PicPay & @swoole Evangelist
Leo Cavalcante
Environment specific config generator for Dart and Flutter applications during CI/CD builds

Environment Config Generator Environment specific config generator. Allows to specify env configuration during CI/CD build. Primarily created to simpl

Denis Beketsky 86 Dec 2, 2022
This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.

Bitrise Artifact Downloader Introduction ??‍♂️ This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise proj

Jens Klingenberg 9 Apr 30, 2021
Meal-App-flutter - Meal App builds with flutter

Meal App - flutter In our complete chat app. I create a nice clean archetecture

null 0 Feb 2, 2022
A nice clean onboarding screen for your e-commerce app that can run both Andriod and iOS devices because it builds with flutter

A nice clean onboarding screen for your e-commerce app that can run both Andriod and iOS devices because it builds with flutter

null 23 Dec 4, 2022
A Flutter package to make your text selectable for web and non-selectable for native builds.

PlatformText A Flutter package to make your text selectable for web and non-selectable for native builds. Features PlatformText returns Text or Select

Piotr Rozpończyk 1 Jun 9, 2022
A sample for having PageView transformation effects in Flutter.

What is it? The end result looks a little something like this: Sample project for creating nice looking PageView parallax effects in Flutter. Read the

Iiro Krankka 811 Dec 22, 2022
The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that frozened column/row,loading more, high performance and better experience in TabBarView/PageView.

flex_grid Language: English| 中文简体 The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that f

FlutterCandies 39 Nov 8, 2022
This is a Flutter app which shows how to use the PageView Class in your Flutter App

page_view_class A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Shehzaan Mansuri 1 Oct 25, 2021
Customizable Flutter widget which syncronize ScrollView with PageView as tabs

scrollable_list_tab_scroller Customizable Flutter widget which syncronize ScrollView with PageView as tabs. Create a custom page view as tabs which sy

Railson Ferreira de Souza 4 Dec 21, 2022
A sample for having PageView transformation effects in Flutter.

What is it? The end result looks a little something like this: Sample project for creating nice looking PageView parallax effects in Flutter. Read the

Iiro Krankka 811 Dec 22, 2022
Flutter Smooth PageView indicators

smooth_page_indicator Customizable animated page indicator with a set of built-in effects. infinite Loop support [new] Scrolling dots effect Effects E

Milad akarie 859 Jan 5, 2023
Flutter pre-load PageView widget

PreloadPageView Like the name, this is the widget to support Pre-load function for PageView widget. For better user experience sometimes we need pre-l

Neil 106 Jan 6, 2023
Easy to use 3D Perspective PageView for Flutter

perspective_pageview With this you will be able to create 3D Perspective PageView in Flutter Easily Getting Started This project is a starting point f

Paras Jain 10 Nov 26, 2022
A Flutter PageView Indicator has Worm animation

Worm Indicator A Flutter PageView indicator insprired by worm animation. It can be easily integrated with any Flutter PageView. Pull requests are welc

Phuc Huynh 11 May 3, 2022