I am following a tutorial on how to animate a page view and show progress as one transitions from one page to another. Here is the question and answer Progress Bar Animation In PageView in Flutter
After writing the code I get an error that The argument type 'Animation<double>?' can't be assigned to the parameter type 'Listenable' and Try changing the type of the variable, or casting the right-hand type to 'Animation<double>'.
This is the code where I get the error
class AnimatedProgressBar extends AnimatedWidget {
AnimatedProgressBar({Key? key, Animation<double>? animation})
: super(key: key, listenable: animation);
Widget build(BuildContext context) {
final Animation<double> animation = listenable;
return Container(
height: 6.0,
width: animation.value,
decoration: BoxDecoration(color: Colors.white),
);
}
}
The specific lines with errors are
AnimatedProgressBar({Key? key, Animation<double>? animation}) : super(key: key, listenable: animation);
and
final Animation<double> animation = listenable;