FToastAlignment constructor

FToastAlignment(
  1. AlignmentGeometry _alignment,
  2. double toastAlignment
)

Creates a FToastAlignment with the given alignments.

It is typically recommended to use one of the constants instead. Use this only if you need fine-grained control over the toast's positioning.

AlignmentGeometry controls where the toast appears on the screen while toastAlignment controls how the toasts vertically stack.

// Toasts appear between the top left and top center, and stack downward from the top.
// Top left is (0, 0).
FToastAlignment(Alignment(-0.5, -1), 1);

// Toasts appear at bottom-left and stack upward from the bottom.
FToastAlignment(Alignment.bottomLeft, 1);

// Toasts appear at top-center and stack downward from the top.
FToastAlignment(Alignment.topCenter, -1);

Contract

Throws AssertionError if toastAlignment is not between -1 and 1, inclusive.

Implementation

FToastAlignment(this._alignment, double toastAlignment)
  : assert(
      toastAlignment >= -1 && toastAlignment <= 1,
      'toastAlignment ($toastAlignment) must be between -1 and 1, inclusive.',
    ),
    _toastAlignment = Alignment(0, toastAlignment);