buildBody method

  1. @override
Widget buildBody(
  1. ToastificationThemeData toastTheme
)
override

Implementation

@override
Widget buildBody(ToastificationThemeData toastTheme) {
  final toastStyle = toastTheme.toastStyle!;

  Widget body = Container(
    constraints: const BoxConstraints(minHeight: 64),
    decoration: BoxDecoration(
      color: toastStyle.blurredBackgroundColor(
        toastTheme.applyBlurEffect,
        toastStyle.backgroundColor,
      ),
      borderRadius: toastStyle.borderRadius,
      border: Border.fromBorderSide(toastStyle.borderSide),
      boxShadow: toastStyle.boxShadow,
    ),
    padding: toastStyle.padding,
    child: Row(
      children: [
        Offstage(
          offstage: !toastTheme.showIcon,
          child: Padding(
            padding: const EdgeInsetsDirectional.only(end: 12),
            child: icon ??
                Icon(
                  toastStyle.icon,
                  size: 24,
                  color: toastStyle.iconColor,
                ),
          ),
        ),
        Expanded(
          child: ToastContent(
            title: title,
            description: description,
            progressBarValue: progressBarValue,
            progressBarWidget: progressBarWidget,
          ),
        ),
        const SizedBox(width: 8),
        ToastCloseButtonHolder(
          onCloseTap: onCloseTap,
          showCloseButton: showCloseButton,
          toastCloseButton: closeButton,
        ),
      ],
    ),
  );

  if (toastTheme.applyBlurEffect) {
    body = ClipRRect(
      borderRadius: toastStyle.borderRadius,
      child: BackdropFilter(
        filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
        child: body,
      ),
    );
  }

  return body;
}