diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 42e208a..15bff81 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -33,8 +33,10 @@ class Utils { // longDuration is accepted but no longer varies the duration - every caller already used the // default (true), so AppToast.plainSeconds covers both cases with one fixed value. + // Soft red bg + red text - same combo already used elsewhere in the app for + // expired/inactive-style chips (e.g. dependent_details_screen.dart's "Access Off" badge). static void showToast(String message, {bool longDuration = true}) { - AppToast.show(message, seconds: AppToast.plainSeconds, showIcon: false, showCountdownText: false); + AppToast.show( message, seconds: AppToast.plainSeconds, showIcon: false, showCountdownText: true, bgColor: const Color(0xFFF1CECE), textColor: const Color(0xFFC53030)); } static dynamic getNotNullValue(List list, int index) { diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 17ee0d0..065ebf5 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -520,42 +520,42 @@ class _DashboardScreenState extends State with WidgetsBindingOb return model.isOffersLoading ? const OffersShimmerWidget() : InkWell( - onTap: () { - navigateToDetails(data.getOffersList[index]); - }, - child: SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 73, - height: 73, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(100)), - border: Border.all(color: MyColors.lightGreyE3Color, width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(50)), - child: Hero( - tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString(), - transitionOnUserGestures: true, - child: Image.network(data.getOffersList[index].logo ?? "", fit: BoxFit.contain), - ), - ), + onTap: () { + navigateToDetails(data.getOffersList[index]); + }, + child: SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(100)), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), ), - 4.height, - Expanded( - child: - AppState().isArabic(context) - ? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1) - : data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1), + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(50)), + child: Hero( + tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString(), + transitionOnUserGestures: true, + child: Image.network(data.getOffersList[index].logo ?? "", fit: BoxFit.contain), + ), ), - ], - ), + ), + 4.height, + Expanded( + child: + AppState().isArabic(context) + ? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1) + : data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1), + ), + ], ), - ); + ), + ); }, separatorBuilder: (BuildContext cxt, int index) => 8.width, itemCount: model.isOffersLoading ? 9 : (data.getOffersList.length > 9 ? 9 : data.getOffersList.length), diff --git a/lib/ui/landing/dashboard_screen_for_dependet.dart b/lib/ui/landing/dashboard_screen_for_dependet.dart index 175569b..1bc7171 100644 --- a/lib/ui/landing/dashboard_screen_for_dependet.dart +++ b/lib/ui/landing/dashboard_screen_for_dependet.dart @@ -574,7 +574,6 @@ class _DashboardScreenForDependetState extends State @override Widget build(BuildContext context) { bool isAr = AppState().isArabic(context); - return Scaffold( backgroundColor: Colors.white, appBar: AppBar( diff --git a/lib/widgets/toast/app_toast.dart b/lib/widgets/toast/app_toast.dart index 96a39c7..af177e7 100644 --- a/lib/widgets/toast/app_toast.dart +++ b/lib/widgets/toast/app_toast.dart @@ -18,7 +18,7 @@ class AppToast { // change this single value to retune it everywhere that uses it. static const int plainSeconds = 3; - static void show(String message, {int seconds = 5, VoidCallback? onComplete, bool showIcon = true, bool showCountdownText = true}) { + static void show(String message, {int seconds = 5, VoidCallback? onComplete, bool showIcon = true, bool showCountdownText = true, Color? bgColor, Color? textColor}) { OverlayState? overlay = AppRoutes.navigatorKey.currentState?.overlay; if (overlay == null) return; @@ -30,13 +30,16 @@ class AppToast { late OverlayEntry entry; entry = OverlayEntry( - builder: (BuildContext context) => _CountdownToast( - message: message, - seconds: seconds, - showIcon: showIcon, - showCountdownText: showCountdownText, - onDismiss: () => _dismiss(entry, onComplete), - ), + builder: + (BuildContext context) => _CountdownToast( + message: message, + seconds: seconds, + showIcon: showIcon, + showCountdownText: showCountdownText, + bgColor: bgColor, + textColor: textColor, + onDismiss: () => _dismiss(entry, onComplete), + ), ); _entry = entry; overlay.insert(entry); @@ -60,14 +63,10 @@ class _CountdownToast extends StatefulWidget { final VoidCallback onDismiss; final bool showIcon; final bool showCountdownText; + final Color? bgColor; + final Color? textColor; - const _CountdownToast({ - required this.message, - required this.seconds, - required this.onDismiss, - this.showIcon = true, - this.showCountdownText = true, - }); + const _CountdownToast({required this.message, required this.seconds, required this.onDismiss, this.showIcon = true, this.showCountdownText = true, this.bgColor, this.textColor}); @override State<_CountdownToast> createState() => _CountdownToastState(); @@ -97,6 +96,9 @@ class _CountdownToastState extends State<_CountdownToast> { @override Widget build(BuildContext context) { + Color bgColor = widget.bgColor ?? MyColors.darkTextColor; + Color textColor = widget.textColor ?? Colors.white; + return Positioned( left: 16, right: 16, @@ -110,23 +112,23 @@ class _CountdownToastState extends State<_CountdownToast> { child: Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), decoration: BoxDecoration( - color: MyColors.darkTextColor, - borderRadius: BorderRadius.circular(12), + color: bgColor, + borderRadius: BorderRadius.circular(10), boxShadow: const [BoxShadow(color: Color(0x33000000), blurRadius: 12, offset: Offset(0, 4))], ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (widget.showIcon) ...[const Icon(Icons.error_outline, color: Colors.white, size: 20), const SizedBox(width: 10)], + if (widget.showIcon) ...[Icon(Icons.error_outline, color: textColor, size: 20), const SizedBox(width: 10)], Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(widget.message, style: const TextStyle(color: Colors.white, fontSize: 14, height: 1.3)), + Text(widget.message, style: TextStyle(color: textColor, fontSize: 14, height: 1.3, fontWeight: FontWeight.w600)), if (widget.showCountdownText) ...[ const SizedBox(height: 4), - Text("Dismissing in ${_remaining}s", style: const TextStyle(color: Colors.white70, fontSize: 11)), + Text("Dismissing in ${_remaining}s", style: TextStyle(color: textColor.withOpacity(0.7), fontSize: 12, fontWeight: FontWeight.w500)), ], ], ),