build method
Widget
build(
- AnimationController controller,
- Widget? child,
- AntdAnimatedContext<
AntdDropdown, AntdDropdownState> context
override
Implementation
@override
Widget build(AnimationController controller, Widget? child,
AntdAnimatedContext<AntdDropdown, AntdDropdownState> context) {
var state = context.state;
var renderBox = state.contentRenderBox;
if (renderBox == null) {
return AntdBox(
style: const AntdBoxStyle(visibility: AntdVisibility.visible),
child: child,
);
}
var offsetY = state.getOffsetY();
var tween =
Tween(begin: offsetY - renderBox.size.height, end: offsetY).animate(
CurvedAnimation(
parent: controller,
curve: const Interval(0, 1, curve: Curves.easeOutCubic),
),
);
var animatedChild = AnimatedBuilder(
animation: tween,
builder: (ctx, _) {
return Stack(
fit: StackFit.loose,
children: [
Positioned(
top: tween.value,
left: 0,
right: 0,
child: child ?? const AntdBox())
],
);
});
return ClipPath(
clipper: AntdMaskHoleClipper(hole: state.targetHole),
child: animatedChild,
);
}