number_paginator 0.0.1
number_paginator: ^0.0.1 copied to clipboard

A paginator to switch between page numbers.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int _numPages = 10;
  int _currentPage = 0;

  @override
  Widget build(BuildContext context) {
    var pages = List.generate(
      _numPages,
      (index) => Center(
        child: Text("Page ${index + 1}"),
      ),
    );

    return MaterialApp(
      theme: ThemeData(primarySwatch: Colors.orange),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Number Paginator Example"),
        ),
        body: Column(
          children: [
            Expanded(
              child: Container(
                color: Theme.of(context).backgroundColor,
                child: pages[_currentPage],
              ),
            ),
            NumberPaginator(
              numberPages: _numPages,
              onPageChange: (int index) {
                setState(() {
                  _currentPage = index;
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
120
pub points
34%
popularity

Publisher

wiefel.dev

A paginator to switch between page numbers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on number_paginator