applyTo method

ComToastConfig applyTo(
  1. ComToastConfig base, {
  2. bool preserveBaseType = true,
})

Implementation

ComToastConfig applyTo(
  ComToastConfig base, {
  bool preserveBaseType = true,
}) {
  const defaults = ComToastConfig.defaults;
  return ComToastConfig(
    type: preserveBaseType && type == ComToastType.normal ? base.type : type,
    presentation: presentation == defaults.presentation
        ? base.presentation
        : presentation,
    position: position == defaults.position ? base.position : position,
    duration: duration == defaults.duration ? base.duration : duration,
    backgroundColor: backgroundColor ?? base.backgroundColor,
    textColor: textColor ?? base.textColor,
    fontSize: fontSize == defaults.fontSize ? base.fontSize : fontSize,
    padding: padding == defaults.padding ? base.padding : padding,
    borderRadius: borderRadius == defaults.borderRadius
        ? base.borderRadius
        : borderRadius,
    maxWidth: maxWidth == defaults.maxWidth ? base.maxWidth : maxWidth,
    animationDuration: animationDuration == defaults.animationDuration
        ? base.animationDuration
        : animationDuration,
    clickThrough: clickThrough == defaults.clickThrough
        ? base.clickThrough
        : clickThrough,
    showShadow:
        showShadow == defaults.showShadow ? base.showShadow : showShadow,
    shadowColor:
        shadowColor == defaults.shadowColor ? base.shadowColor : shadowColor,
    shadowOffset: shadowOffset == defaults.shadowOffset
        ? base.shadowOffset
        : shadowOffset,
    shadowBlurRadius: shadowBlurRadius == defaults.shadowBlurRadius
        ? base.shadowBlurRadius
        : shadowBlurRadius,
    icon: icon ?? base.icon,
    iconWidget: iconWidget ?? base.iconWidget,
    iconSize: iconSize == defaults.iconSize ? base.iconSize : iconSize,
    iconColor: iconColor ?? base.iconColor,
    iconSpacing:
        iconSpacing == defaults.iconSpacing ? base.iconSpacing : iconSpacing,
    builder: builder ?? base.builder,
    onTap: onTap ?? base.onTap,
    showCloseButton: showCloseButton == defaults.showCloseButton
        ? base.showCloseButton
        : showCloseButton,
    topMargin: topMargin == defaults.topMargin ? base.topMargin : topMargin,
    bottomMargin: bottomMargin == defaults.bottomMargin
        ? base.bottomMargin
        : bottomMargin,
  );
}