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 alignment = this.alignment.resolve(Directionality.of(context));

  final isCenter = alignment.x == 0;

  final slideOffset = isCenter
      ? alignment.y >= 0
          ? const Offset(0, 1)
          : const Offset(0, -1)
      : alignment.x >= 0
          ? const Offset(1, 0)
          : const Offset(-1, 0);

  return FadeTransition(
    opacity: animation,
    child: SlideTransition(
      position: Tween<Offset>(
        begin: slideOffset,
        end: const Offset(0, 0),
      ).animate(animation),
      child: child,
    ),
  );
}