page_view_indicator_ns 1.0.0+1 copy "page_view_indicator_ns: ^1.0.0+1" to clipboard
page_view_indicator_ns: ^1.0.0+1 copied to clipboard

Builds indication marks for PageView from any Widget and/or Animation.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:page_view_indicator_ns/page_view_indicator_ns.dart';

class App extends StatelessWidget {
  static const length = 3;
  final pageIndexNotifier = ValueNotifier<int>(0);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Stack(
          alignment: FractionalOffset.bottomCenter,
          children: <Widget>[
            PageView.builder(
              onPageChanged: (index) => pageIndexNotifier.value = index,
              itemCount: length,
              itemBuilder: (context, index) {
                return Container(
                  decoration: BoxDecoration(color: Colors.accents[index]),
                );
              },
            ),
            _buildExample1()
          ],
        ),
      ),
    );
  }

  PageViewIndicator _buildExample1() {
    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((index + 3) * 3),
        ),
      ),
    );
  }
}

void main() => runApp(App());
9
likes
150
pub points
73%
popularity

Publisher

verified publisherrodrigobastos.dev

Builds indication marks for PageView from any Widget and/or Animation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on page_view_indicator_ns