buildHighlightTransition function

Widget buildHighlightTransition({
  1. required BuildContext context,
  2. required Animation<double> highlight,
  3. required Widget child,
  4. Color? background,
  5. Color? highlightColor,
})

Implementation

Widget buildHighlightTransition({required BuildContext context, required Animation<double> highlight,
  required Widget child, Color? background, Color? highlightColor}) {
  return DecoratedBoxTransition(
    decoration: DecorationTween(
      begin: background != null ?
      BoxDecoration(color: background) :
      BoxDecoration(),
      end: background != null ?
      BoxDecoration(color: background) :
      BoxDecoration(color: highlightColor)
    ).animate(highlight),
    child: child
  );
}