build method

  1. @override
Widget build(
  1. BuildContext context,
  2. TreeState state,
  3. dynamic nodeState
)
override

Implementation

@override
Widget build(
  final BuildContext context,
  final TreeState state,
  final WidgetState nodeState,
) {
  return Lottie.network(
    /// if the image is null, it will return a default image
    image.value != null
        ? image.value!
        : 'https://assets10.lottiefiles.com/packages/lf20_ptplezpy.json',
    width: width.get(
      forPlay: state.forPlay,
      deviceType: state.deviceType,
      deviceInfo: state.deviceInfo,
      context: context,
      isWidth: true,
    ),
    height: height.get(
      forPlay: state.forPlay,
      deviceType: state.deviceType,
      deviceInfo: state.deviceInfo,
      context: context,
      isWidth: false,
    ),
    fit: BoxFit.contain,
    errorBuilder: (context, exception, stackTrace) {
      return Container(
        color: Colors.transparent,
        child: const Placeholder(),
      );
    },
  );
}