buildBody method

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

Implementation

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

  Widget body;

  body = Row(
    mainAxisSize: MainAxisSize.min,
    crossAxisAlignment: CrossAxisAlignment.center,
    children: [
      Flexible(
        fit: FlexFit.loose,
        child: ToastContent(
          parentShowProgressBar: false,
          title: title ?? const SizedBox(),
        ),
      ),
      Padding(
        padding: const EdgeInsetsDirectional.only(start: 8),
        child: ToastCloseButtonHolder(
          showCloseButton: showCloseButton,
          onCloseTap: onCloseTap,
          toastCloseButton: closeButton,
        ),
      ),
    ],
  );

  body = Container(
    decoration: BoxDecoration(
      color: toastStyle.blurredBackgroundColor(
        toastTheme.applyBlurEffect,
        toastStyle.backgroundColor,
      ),
      border: Border.fromBorderSide(toastStyle.borderSide),
      boxShadow: toastStyle.boxShadow,
      borderRadius: toastStyle.borderRadius,
    ),
    padding: toastStyle.padding,
    child: body,
  );

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

  return body;
}