Line data Source code
1 : import 'package:flutter/material.dart'; 2 : 3 : class AnimatedProgressBar extends AnimatedWidget { 4 : final AnimationController animationController; 5 : final Animation<Color> valueColor; 6 : final Color backgroundColor; 7 : final Animation<double> progressValueAnim; 8 : 9 1 : AnimatedProgressBar({ 10 : Key key, 11 : @required this.animationController, 12 : this.valueColor, 13 : this.backgroundColor = Colors.grey, 14 2 : }) : this.progressValueAnim = Tween<double>(begin: 0, end: 1).animate(animationController), 15 1 : super(key: key, listenable: animationController); 16 : 17 1 : @override 18 : Widget build(BuildContext context) { 19 1 : return LinearProgressIndicator( 20 2 : value: progressValueAnim.value, 21 2 : valueColor: valueColor ?? AlwaysStoppedAnimation<Color>(Colors.white), 22 1 : backgroundColor: backgroundColor, 23 : ); 24 : } 25 : }