worm_indicator 0.1.0 copy "worm_indicator: ^0.1.0" to clipboard
worm_indicator: ^0.1.0 copied to clipboard

outdated

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

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Worm Indicator Example',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: Example(),
    );
  }
}

class Example extends StatefulWidget {

  @override
  State<StatefulWidget> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  PageController _controller;


  @override
  void initState() {
    super.initState();
    _controller = PageController(
      viewportFraction: 0.8,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          PageView.builder(
            controller: _controller,
            itemBuilder: (BuildContext context, int pos) {
              return Container(
                margin: EdgeInsets.all(20),
                child: Image.asset("lib/wall-${pos + 1}.jpg"),
              );
            },
            itemCount: 3,
          ),
          Positioned(
            bottom: 20,
            left: 0,
            right: 0,
            child: WormIndicator(
              length: 3,
              controller: _controller,
              size: 16,
              spacing: 8,
            ),
          ),
        ],
      ),
    );
  }
}
3
likes
0
pub points
41%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on worm_indicator