nice_page_indicator 0.0.3 copy "nice_page_indicator: ^0.0.3" to clipboard
nice_page_indicator: ^0.0.3 copied to clipboard

nice page indicator.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'nice-page-indicator',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: const MyHomePage());
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final PageController pageController = PageController();

  List<Widget> contents = [
    const Page(
      color: Colors.red,
    ),
    const Page(
      color: Colors.yellow,
    ),
    const Page(
      color: Colors.green,
    ),
    const Page(
      color: Colors.blue,
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return NicePageIndicator(
      pageController: pageController,
      physics: const ScrollPhysics(),
      pageWidgets: contents,
      pageIndicatorStyle: const PageIndicatorStyle(
        activeColor: Colors.cyan,
      ),
      pageIndicatorLocation: PageIndicatorLocation.topRight,
      pageIndicatorPadding: const EdgeInsets.all(16),
    );
  }
}

class Page extends StatelessWidget {
  const Page({Key? key, required this.color}) : super(key: key);

  final Color color;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: color,
    );
  }
}
copied to clipboard
2
likes
140
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

2024.07.08 - 2025.01.20

nice page indicator.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on nice_page_indicator