feat: toast
This commit is contained in:
parent
e13aeefa1c
commit
43153f9b0d
43
lib/presentation/components/toast/flushbar.dart
Normal file
43
lib/presentation/components/toast/flushbar.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:another_flushbar/flushbar.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../common/theme/theme.dart';
|
||||||
|
|
||||||
|
class AppFlushbar {
|
||||||
|
static void showSuccess(BuildContext context, String message) {
|
||||||
|
Flushbar(
|
||||||
|
messageText: Text(
|
||||||
|
message,
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.check_circle, color: Colors.white),
|
||||||
|
duration: const Duration(seconds: 2),
|
||||||
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
|
backgroundColor: AppColor.secondary,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
margin: const EdgeInsets.all(12),
|
||||||
|
).show(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showError(BuildContext context, String message) {
|
||||||
|
Flushbar(
|
||||||
|
messageText: Text(
|
||||||
|
message,
|
||||||
|
style: AppStyle.lg.copyWith(
|
||||||
|
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: AppColor.error,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
margin: const EdgeInsets.all(12),
|
||||||
|
).show(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,6 +17,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.7.1"
|
version: "7.7.1"
|
||||||
|
another_flushbar:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: another_flushbar
|
||||||
|
sha256: "19bf9520230ec40b300aaf9dd2a8fefcb277b25ecd1c4838f530566965befc2a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.12.30"
|
||||||
archive:
|
archive:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -31,6 +31,7 @@ dependencies:
|
|||||||
line_icons: ^2.0.3
|
line_icons: ^2.0.3
|
||||||
flutter_spinkit: ^5.2.2
|
flutter_spinkit: ^5.2.2
|
||||||
fl_chart: ^1.0.0
|
fl_chart: ^1.0.0
|
||||||
|
another_flushbar: ^1.12.30
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user