ToastData constructor

ToastData(
  1. {String msg,
  2. Widget iconPathTop,
  3. Widget iconPathLeft,
  4. Alignment gravity,
  5. Duration duration,
  6. Color bgColor,
  7. Color txtColor,
  8. double txtSize}
)

Implementation

ToastData({
  String msg,
  Widget iconPathTop,
  Widget iconPathLeft,
  Alignment gravity,
  Duration duration,
  Color bgColor,
  Color txtColor,
  double txtSize,
}) {
  this.msg = msg;
  this.iconPathTop = iconPathTop;
  this.iconPathLeft = iconPathLeft;

  this.gravity = gravity ?? ToastStyle.bottom;
  this.duration = duration ?? ToastStyle.shortDuration;
  this.bgColor = bgColor ?? ToastStyle.bgColor;
  this.txtColor = txtColor ?? ToastStyle.txtColor;
  this.txtSize = txtSize ?? ToastStyle.txtSize;

  this.exactDuration = Duration(
    milliseconds: this.duration.inMilliseconds - ToastStyle.threshold,
  );

  this.fadePoint = this.duration;
  this.gonePoint = Duration(
    milliseconds:
        this.duration.inMilliseconds + ToastStyle.fadeOutTime.inMilliseconds,
  );
}