build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Override this method to build widgets that depend on the state of the listenable (e.g., the current value of the animation).

Implementation

@override
Widget build(BuildContext context) {
  final Animation<double> animation = listenable as Animation<double>;
  // final scorePosition = (animation.value * 200) + width;
  final scorePosition = (animation.value * 600) + 16;

  Color color1 = const Color(0x5532CD32);
  Color color2 = const Color(0x0032CD32);

  if (animation.status == AnimationStatus.reverse) {
    color1 = const Color(0x0032CD32);
    color2 = const Color(0x5532CD32);
  }

  return Positioned(
      // top: scorePosition - 120,
    bottom: scorePosition,
      left: 5.0,
      right: 5.0,
      // top: 5.0,
      child: Opacity(
          opacity: (stopped) ? 0.0 : 1.0,
          child: Container(
            height: 60.0,
            width: width,
            decoration: BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  stops: const [0.1, 0.9],
                  colors: [color1, color2],
                )),
          )));
}