2025-07-10 18:52:04 -05:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
SnackBar errorSnackbar(
|
|
|
|
|
Object e, {
|
|
|
|
|
Color backgroundColor = const Color.fromARGB(255, 196, 26, 14),
|
|
|
|
|
Duration duration = const Duration(seconds: 3),
|
|
|
|
|
}) {
|
2026-01-01 12:53:20 -06:00
|
|
|
final errorText = e is String
|
|
|
|
|
? e
|
|
|
|
|
: (e.toString().contains(':')
|
|
|
|
|
? e.toString().substring(e.toString().indexOf(':') + 1).trim()
|
|
|
|
|
: e.toString());
|
|
|
|
|
|
2025-07-10 18:52:04 -05:00
|
|
|
return SnackBar(
|
|
|
|
|
backgroundColor: Color.fromARGB(255, 196, 26, 14),
|
|
|
|
|
content: Text(
|
2026-01-01 12:53:20 -06:00
|
|
|
errorText,
|
2025-07-10 18:52:04 -05:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
color: Colors.white
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|