pcasttv/lib/services/snackbar_service.dart

27 lines
734 B
Dart

import 'package:flutter/material.dart';
import 'package:pcasttv/globals.dart';
class SnackBarService {
static void showSnackBar({required String content, bool error = false}) {
snackbarKey.currentState?.showSnackBar(
SnackBar(
content: Text(
content,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
backgroundColor: error ? Colors.red : Colors.green,
duration: const Duration(seconds: 3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 8.0,
),
);
}
}