show static method

void show(
  1. String message, {
  2. String? title,
  3. GpSemanticTone tone = GpSemanticTone.neutral,
  4. Duration duration = const Duration(seconds: 4),
  5. Color? backgroundColor,
  6. Color? textColor,
  7. BuildContext? context,
})

Muestra un SnackBar simple con texto personalizado.

Implementation

static void show(
  String message, {
  String? title,
  GpSemanticTone tone = GpSemanticTone.neutral,
  Duration duration = const Duration(seconds: 4),
  Color? backgroundColor,
  Color? textColor,
  BuildContext? context,
}) {
  final snackBar = _buildSnackBar(
    message,
    title: title,
    tone: tone,
    duration: duration,
    backgroundColor: backgroundColor,
    textColor: textColor,
    context: context,
  );

  if (context != null) {
    ScaffoldMessenger.of(context).showSnackBar(snackBar);
    return;
  }
  final scaffoldMessenger =
      GpScaffoldMessenger.scaffoldMessengerKey.currentState;
  if (scaffoldMessenger != null) {
    scaffoldMessenger.showSnackBar(snackBar);
  }
}