show method

Future<void> show(
  1. String message, {
  2. Duration? toastDuration,
  3. TextStyle? textStyle,
})

Implementation

Future<void> show(
  String message, {
  Duration? toastDuration,
  TextStyle? textStyle,
}) async {
  final view = Container(
    padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(6.0),
      color: Colors.black.withOpacity(0.8),
    ),
    child: Text(
      message,
      style: textStyle ??
          const TextStyle(
            height: 1.5,
            fontSize: 15,
            color: Colors.white,
          ),
    ),
  );

  showToast(
    child: view,
    toastDuration: toastDuration ?? const Duration(seconds: 2),
    positionedToastBuilder: (_, child) => Positioned(
      left: 16,
      right: 16,
      bottom: 16,
      child: child,
    ),
  );
}