diff --git a/lib/presentation/components/toast/flushbar.dart b/lib/presentation/components/toast/flushbar.dart new file mode 100644 index 0000000..6e1aa52 --- /dev/null +++ b/lib/presentation/components/toast/flushbar.dart @@ -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); + } +} diff --git a/pubspec.lock b/pubspec.lock index ce8fdee..2d97622 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e05cdc1..a257839 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,7 @@ dependencies: line_icons: ^2.0.3 flutter_spinkit: ^5.2.2 fl_chart: ^1.0.0 + another_flushbar: ^1.12.30 dev_dependencies: flutter_test: