copyWith method

ToastTheme copyWith({
  1. ValueGetter<int?>? maxStackedEntries,
  2. ValueGetter<EdgeInsetsGeometry?>? padding,
  3. ValueGetter<ExpandMode?>? expandMode,
  4. ValueGetter<Offset?>? collapsedOffset,
  5. ValueGetter<double?>? collapsedScale,
  6. ValueGetter<Curve?>? expandingCurve,
  7. ValueGetter<Duration?>? expandingDuration,
  8. ValueGetter<double?>? collapsedOpacity,
  9. ValueGetter<double?>? entryOpacity,
  10. ValueGetter<double?>? spacing,
  11. ValueGetter<BoxConstraints?>? toastConstraints,
})

Type definition for toast content builder functions.

Takes a BuildContext and ToastOverlay instance, returning the widget that represents the toast's visual content. The overlay parameter provides control methods for dismissing or manipulating the toast notification.

Example:

ToastBuilder builder = (context, overlay) => Card(
  child: ListTile(
    title: Text('Notification'),
    trailing: IconButton(
      icon: Icon(Icons.close),
      onPressed: overlay.close,
    ),
  ),
);

Implementation

ToastTheme copyWith({
  ValueGetter<int?>? maxStackedEntries,
  ValueGetter<EdgeInsetsGeometry?>? padding,
  ValueGetter<ExpandMode?>? expandMode,
  ValueGetter<Offset?>? collapsedOffset,
  ValueGetter<double?>? collapsedScale,
  ValueGetter<Curve?>? expandingCurve,
  ValueGetter<Duration?>? expandingDuration,
  ValueGetter<double?>? collapsedOpacity,
  ValueGetter<double?>? entryOpacity,
  ValueGetter<double?>? spacing,
  ValueGetter<BoxConstraints?>? toastConstraints,
}) {
  return ToastTheme(
    maxStackedEntries: maxStackedEntries == null
        ? this.maxStackedEntries
        : maxStackedEntries(),
    padding: padding == null ? this.padding : padding(),
    expandMode: expandMode == null ? this.expandMode : expandMode(),
    collapsedOffset:
        collapsedOffset == null ? this.collapsedOffset : collapsedOffset(),
    collapsedScale:
        collapsedScale == null ? this.collapsedScale : collapsedScale(),
    expandingCurve:
        expandingCurve == null ? this.expandingCurve : expandingCurve(),
    expandingDuration: expandingDuration == null
        ? this.expandingDuration
        : expandingDuration(),
    collapsedOpacity:
        collapsedOpacity == null ? this.collapsedOpacity : collapsedOpacity(),
    entryOpacity: entryOpacity == null ? this.entryOpacity : entryOpacity(),
    spacing: spacing == null ? this.spacing : spacing(),
    toastConstraints:
        toastConstraints == null ? this.toastConstraints : toastConstraints(),
  );
}