49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:another_flushbar/flushbar.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AppFlushbar {
|
|
static void showSuccess(BuildContext context, String message) {
|
|
Flushbar(
|
|
messageText: Text(
|
|
message,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
icon: const Icon(
|
|
Icons.check_circle,
|
|
color: Colors.white,
|
|
),
|
|
duration: const Duration(seconds: 2),
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
backgroundColor: Colors.green,
|
|
borderRadius: BorderRadius.circular(12),
|
|
margin: const EdgeInsets.all(12),
|
|
).show(context);
|
|
}
|
|
|
|
static void showError(BuildContext context, String message) {
|
|
Flushbar(
|
|
messageText: Text(
|
|
message,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
icon: const Icon(
|
|
Icons.error,
|
|
color: Colors.white,
|
|
),
|
|
duration: const Duration(seconds: 3),
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
backgroundColor: Colors.red,
|
|
borderRadius: BorderRadius.circular(12),
|
|
margin: const EdgeInsets.all(12),
|
|
).show(context);
|
|
}
|
|
}
|