animated_check 1.0.0 copy "animated_check: ^1.0.0" to clipboard
animated_check: ^1.0.0 copied to clipboard

outdated

A new Flutter package project.

example/lib/main.dart

import 'package:animated_check/animated_check.dart';
import 'package:flutter/material.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: 'Rounded Loading Button Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Rounded Loading Button Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {

  AnimationController _animationController;
  Animation<double> _animation;

  @override
  void initState() { 
    super.initState();
    
    _animationController = AnimationController(vsync: this, duration: Duration(seconds: 1));
    
    _animation = new Tween<double>(begin: 0, end: 1).animate(new CurvedAnimation(parent: _animationController, curve: Curves.easeInOutCirc));
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text("Animated Check Example"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              child: AnimatedCheck(
                progress: _animation,
                size: 200,
              )
            ),
            FlatButton(
              child: Text("Check"),
              onPressed: _animationController.forward),
            FlatButton(
              child: Text("Reset"),
              onPressed: _animationController.reset)
          ],
        ),
      )
    );
  }
}