|
1234567891011121314151617181920212223242526272829303132333435 |
- import 'package:flutter/material.dart';
- import 'finger_painter.dart';
- class Finger extends StatefulWidget {
- @override
- _FingerState createState() => _FingerState();
- }
-
- class _FingerState extends State<Finger> with SingleTickerProviderStateMixin {
- double _fraction = 0.0;
- Animation<double> animation;
- int animationDuration = 10000;
-
- @override
- void initState() {
- super.initState();
- var controller = AnimationController(
- duration: Duration(milliseconds: animationDuration), vsync: this);
- animation = Tween(begin: 0.0, end: 1.0).animate(controller)
- ..addListener((){
- setState(() {
- //print(animation.value);
- _fraction = animation.value;
- });
- print(animation.value);
- });
- controller.forward();
- }
-
-
-
- @override
- Widget build(BuildContext context) {
- return CustomPaint(painter: FingerPainter(_fraction));
- }
- }
|