showMessage method

void showMessage(
  1. String message, {
  2. String? title,
  3. MessageVariant type = MessageVariant.success,
  4. MessagePosition position = MessagePosition.top,
  5. Color? background,
  6. Style style = Style.flat,
})

show message

Implementation

void showMessage(
  String message, {
  String? title,
  MessageVariant type = MessageVariant.success,
  MessagePosition position = MessagePosition.top,
  Color? background,
  Style style = Style.flat,
}) {
  if (position == MessagePosition.top) {
    showTopSnackBar(
      this,
      _styleButton(
        message: message,
        title: title,
        position: position,
        type: type,
        background: background,
        style: style,
      ),
    );
  } else {
    ScaffoldMessenger.of(this).clearSnackBars();
    ScaffoldMessenger.of(this).showSnackBar(
      SnackBar(
        padding: EdgeInsets.zero,
        elevation: 0,
        backgroundColor: style == Style.flat
            ? Colors.transparent
            : background ?? _bg(type),
        content: _styleButton(
          message: message,
          title: title,
          type: type,
          background: background,
          style: style,
        ),
      ),
    );
  }
}