Update flushbar (#568)

* Replace old flushbar package with its updated version
Fix flushbars throughtout the app

* Fix Navigation happening all at once causing debugLocked error

* Remove un-necessary async/await

* Remove un-necessary future delayed

* Make process text flushbar indefinite

* Fix show seeds/keys popping page after being pushed instead of popping the auth route
This commit is contained in:
Omar Hatem
2022-10-26 14:13:44 -04:00
committed by GitHub
parent 4f2cf983de
commit 33935c9b1d
8 changed files with 123 additions and 117 deletions
+64 -51
View File
@@ -1,58 +1,71 @@
// import 'package:flushbar/flushbar.dart';
import 'package:flutter/cupertino.dart';
import 'package:another_flushbar/flushbar.dart';
import 'package:flutter/material.dart';
Future<T?> showBar<T>(BuildContext context, String messageText,
{bool isDark = false,
Duration duration = const Duration(seconds: 1),
bool isDismissible = true,
String? titleText}) async {
// FIX-ME: Unimplemented Flushbar
// final bar = Flushbar<T>(
// boxShadows: [
// BoxShadow(
// color: Colors.black.withOpacity(0.09),
// blurRadius: 8,
// offset: Offset(0, 2))
// ],
// backgroundColor: isDark ? Colors.black : Colors.white,
// borderRadius: 35,
// margin: EdgeInsets.all(50),
// titleText: titleText != null
// ? Text(titleText,
// textAlign: TextAlign.center,
// style: TextStyle(color: isDark ? Colors.white : Colors.black, fontWeight: FontWeight.bold, fontSize: 24.0))
// : null,
// messageText: Text(messageText,
// textAlign: TextAlign.center,
// style: TextStyle(color: isDark ? Colors.white : Colors.black, fontSize: 16)),
// duration: duration,
// isDismissible: isDismissible,
// flushbarPosition: FlushbarPosition.TOP,
// flushbarStyle: FlushbarStyle.FLOATING);
Duration? duration = const Duration(seconds: 1), // pass explicitly by null to make the duration indefinite
bool isDismissible = true,
String? titleText}) async {
final bar = Flushbar<T>(
boxShadows: [
BoxShadow(
color: Colors.black.withOpacity(0.09),
blurRadius: 8,
offset: Offset(0, 2),
)
],
backgroundColor: isDark ? Colors.black : Colors.white,
borderRadius: BorderRadius.circular(35),
margin: EdgeInsets.all(50),
titleText: titleText != null
? Text(
titleText,
textAlign: TextAlign.center,
style: TextStyle(
color: isDark ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
fontSize: 24.0,
),
)
: null,
messageText: Text(
messageText,
textAlign: TextAlign.center,
style: TextStyle(
color: isDark ? Colors.white : Colors.black,
fontSize: 16,
),
),
duration: duration,
isDismissible: isDismissible,
flushbarPosition: FlushbarPosition.TOP,
flushbarStyle: FlushbarStyle.FLOATING,
);
// return bar.show(context);
return null;
return bar.show(context);
}
// FIX-ME: Unimplemented Flushbar
// Flushbar<T> createBar<T>(String text,
// {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) {
// return Flushbar<T>(
// boxShadows: [
// BoxShadow(
// color: Colors.black.withOpacity(0.09),
// blurRadius: 8,
// offset: Offset(0, 2))
// ],
// backgroundColor: isDark ? Colors.black : Colors.white,
// borderRadius: 35,
// margin: EdgeInsets.all(50),
// messageText: Text(text,
// textAlign: TextAlign.center,
// style: TextStyle(color: isDark ? Colors.white : Colors.black)),
// duration: duration,
// isDismissible: isDismissible,
// flushbarPosition: FlushbarPosition.TOP,
// flushbarStyle: FlushbarStyle.FLOATING);
// }
Flushbar<T> createBar<T>(String text,
{bool isDark = false,
Duration? duration = const Duration(seconds: 1), // pass explicitly by null to make the duration indefinite
bool isDismissible = true}) {
return Flushbar<T>(
boxShadows: [
BoxShadow(
color: Colors.black.withOpacity(0.09),
blurRadius: 8,
offset: Offset(0, 2),
)
],
backgroundColor: isDark ? Colors.black : Colors.white,
borderRadius: BorderRadius.circular(35),
margin: EdgeInsets.all(50),
messageText: Text(text,
textAlign: TextAlign.center,
style: TextStyle(color: isDark ? Colors.white : Colors.black)),
duration: duration,
isDismissible: isDismissible,
flushbarPosition: FlushbarPosition.TOP,
flushbarStyle: FlushbarStyle.FLOATING,
);
}