From de820662f75e57ca43a406354d5bc980e0e5dff8 Mon Sep 17 00:00:00 2001 From: Kalonkarthik Date: Fri, 28 Feb 2025 12:31:34 +0530 Subject: [PATCH] bookmark message color change --- .../auth_verification/create_new_pw.dart | 50 +++-- .../Screens/charts/screens/chart_screen.dart | 179 +++++++++--------- lib/presentation/Screens/profilepage.dart | 10 +- .../drawer_routes/Drawer Items/bookmark.dart | 30 +-- 4 files changed, 127 insertions(+), 142 deletions(-) diff --git a/lib/presentation/Screens/auth_verification/create_new_pw.dart b/lib/presentation/Screens/auth_verification/create_new_pw.dart index e8391ba0..3d0ad519 100644 --- a/lib/presentation/Screens/auth_verification/create_new_pw.dart +++ b/lib/presentation/Screens/auth_verification/create_new_pw.dart @@ -6,6 +6,7 @@ import 'package:pocketbase/pocketbase.dart'; import 'package:uae_stat/config/api_config.dart'; import 'package:uae_stat/config/my_router.dart'; import 'package:uae_stat/domain/use_cases/language.dart'; +import 'package:uae_stat/infrastructure/services/img_asset_paths/banner_asset_path.dart'; import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart'; import 'package:uae_stat/presentation/Screens/profilepage.dart'; import 'package:uae_stat/presentation/components/indicators/locale_provider.dart'; @@ -13,7 +14,7 @@ import 'package:uae_stat/presentation/components/my_toggle.dart'; import 'package:uae_stat/presentation/components/space.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../../../config/my_theme.dart'; +import 'package:uae_stat/config/my_theme.dart'; class CreateNewPw extends ConsumerStatefulWidget { final String userId; @@ -38,6 +39,11 @@ class _CreateNewPwState extends ConsumerState { String? _newPassword; String? _confirmPassword; + final fcscBanner = Image.asset( + BannerAssetPath.fcsc, + height: 40, + ); + String? _validateOldPassword(String? value) { if (value == null || value.isEmpty) { return AppLocalizations.of(context)!.old_password_is_required; @@ -624,16 +630,17 @@ class _CreateNewPwState extends ConsumerState { ), SizedBox(height: screenHeight / 5), Center( - child: Container( - height: screenHeight / 16, - width: screenWidth / 2.5, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/splash_screen/logo.png"), - fit: BoxFit.fill, - ), - ), - ), + // child: Container( + // height: screenHeight / 16, + // width: screenWidth / 2.5, + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage("assets/splash_screen/logo.png"), + // fit: BoxFit.fill, + // ), + // ), + // ), + child: fcscBanner, ), ], ), @@ -718,16 +725,17 @@ class _CreateNewPwState extends ConsumerState { ), SizedBox(height: screenHeight / 2.2), Center( - child: Container( - height: 40, - width: screenWidth / 2.5, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/splash_screen/logo.png"), - fit: BoxFit.fill, - ), - ), - ), + // child: Container( + // height: 40, + // width: screenWidth / 2.5, + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage("assets/splash_screen/logo.png"), + // fit: BoxFit.fill, + // ), + // ), + // ), + child: fcscBanner, ), ], ), diff --git a/lib/presentation/Screens/charts/screens/chart_screen.dart b/lib/presentation/Screens/charts/screens/chart_screen.dart index a2487614..692800f1 100644 --- a/lib/presentation/Screens/charts/screens/chart_screen.dart +++ b/lib/presentation/Screens/charts/screens/chart_screen.dart @@ -171,10 +171,7 @@ class _ChartScreen1State extends ConsumerState { SnackBar( content: Text( AppLocalizations.of(context)!.added_to_Bookmark, - style: TextStyle( - color: Color(0xFF2F692C), fontWeight: FontWeight.w600), ), - backgroundColor: Color(0xFFD6E9C6), duration: Duration(seconds: 2), ), ); @@ -185,10 +182,10 @@ class _ChartScreen1State extends ConsumerState { SnackBar( content: Text( AppLocalizations.of(context)!.failed_To_Remove, - style: TextStyle( - color: Color(0xFF544C4C), fontWeight: FontWeight.w600), + // style: TextStyle( + // color: Color(0xFF544C4C), fontWeight: FontWeight.w600), ), - backgroundColor: Color(0xFFEB5F24), + // backgroundColor: Color(0xFFEB5F24), duration: Duration(seconds: 2), ), ); @@ -217,10 +214,7 @@ class _ChartScreen1State extends ConsumerState { SnackBar( content: Text( AppLocalizations.of(context)!.removed_from_Bookmark, - style: TextStyle( - color: Color(0xFF2F692C), fontWeight: FontWeight.w600), ), - backgroundColor: Color(0xFFD6E9C6), duration: Duration(seconds: 2), ), ); @@ -231,10 +225,10 @@ class _ChartScreen1State extends ConsumerState { SnackBar( content: Text( 'Failed to Remove', - style: TextStyle( - color: Color(0xFF544C4C), fontWeight: FontWeight.w600), + // style: TextStyle( + // color: Color(0xFF544C4C), fontWeight: FontWeight.w600), ), - backgroundColor: Color(0xFFEB5F24), + // backgroundColor: Color(0xFFEB5F24), duration: Duration(seconds: 2), ), ); @@ -282,49 +276,55 @@ class _ChartScreen1State extends ConsumerState { ), actions: [ SizedBox(height: 20), - SizedBox( - width: 100, // Set the desired width - child: TextButton( - onPressed: () => Navigator.pop(context), - style: TextButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 10.0), // Adjust the radius as needed - ), - side: BorderSide( - color: Color(0xFFAA8E83), // Set the outline color - width: 1, // Set the border width + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + width: 100, // Set the desired width + child: TextButton( + onPressed: () => Navigator.pop(context), + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 10.0), // Adjust the radius as needed + ), + side: BorderSide( + color: Color(0xFFAA8E83), // Set the outline color + width: 1, // Set the border width + ), + ), + child: Text( + context.translate('No', 'لا'), + style: TextStyle( + color: Color(0xFFAA8E83), + fontSize: 16, + ), + ), ), ), - child: Text( - context.translate('No', 'لا'), - style: TextStyle( - color: Color(0xFFAA8E83), - fontSize: 16, + SizedBox( + width: 100, // Set the desired width + child: TextButton( + onPressed: () { + Navigator.pop(context); + removeBookmark(); // Close dialog + }, + style: TextButton.styleFrom( + backgroundColor: Color(0xFFAA8E83), // Set background color + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), // Set text color + ), + ), + child: Text( + context.translate('Yes', 'نعم'), + style: TextStyle(color: Colors.white, fontSize: 16), + ), ), ), - ), - ), - SizedBox( - width: 100, // Set the desired width - child: TextButton( - onPressed: () { - Navigator.pop(context); - removeBookmark(); // Close dialog - }, - style: TextButton.styleFrom( - backgroundColor: Color(0xFFAA8E83), // Set background color - foregroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), // Set text color - ), - ), - child: Text( - context.translate('Yes', 'نعم'), - style: TextStyle(color: Colors.white, fontSize: 16), - ), - ), - ), + ], + ) + ], ), ); @@ -369,48 +369,51 @@ class _ChartScreen1State extends ConsumerState { ), actions: [ SizedBox(height: 20), - SizedBox( - width: 100, // Set the desired width - child: TextButton( - onPressed: () => Navigator.pop(context), - style: TextButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 10.0), // Adjust the radius as needed + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ SizedBox( + width: 100, // Set the desired width + child: TextButton( + onPressed: () => Navigator.pop(context), + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 10.0), // Adjust the radius as needed + ), + side: BorderSide( + color: Color(0xFFAA8E83), // Set the outline color + width: 1, // Set the border width + ), ), - side: BorderSide( - color: Color(0xFFAA8E83), // Set the outline color - width: 1, // Set the border width - ), - ), - child: Text( - context.translate('No', 'لا'), - style: TextStyle( - color: Color(0xFFAA8E83), - fontSize: 16, + child: Text( + context.translate('No', 'لا'), + style: TextStyle( + color: Color(0xFFAA8E83), + fontSize: 16, + ), ), ), ), - ), - SizedBox( - width: 100, // Set the desired width - child: TextButton( - onPressed: () { - Navigator.pop(context); - addBookmark(); // Close dialog - }, - style: TextButton.styleFrom( - backgroundColor: Color(0xFFAA8E83), // Set background color - foregroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), // Set text color + SizedBox( + width: 100, // Set the desired width + child: TextButton( + onPressed: () { + Navigator.pop(context); + addBookmark(); // Close dialog + }, + style: TextButton.styleFrom( + backgroundColor: Color(0xFFAA8E83), // Set background color + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), // Set text color + ), + ), + child: Text( + context.translate('Yes', 'نعم'), + style: TextStyle(color: Colors.white, fontSize: 16), + ), ), - ), - child: Text( - context.translate('Yes', 'نعم'), - style: TextStyle(color: Colors.white, fontSize: 16), - ), - ), + ),], ), ], ), diff --git a/lib/presentation/Screens/profilepage.dart b/lib/presentation/Screens/profilepage.dart index 104b5e24..bbdc7403 100644 --- a/lib/presentation/Screens/profilepage.dart +++ b/lib/presentation/Screens/profilepage.dart @@ -1018,7 +1018,7 @@ class ConfirmationDialog extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - "Are you sure you want to save this page?", + AppLocalizations.of(context)!.sure_save_page, style: const TextStyle( fontSize: 14, color: Color(0xFF898C81), @@ -1030,7 +1030,7 @@ class ConfirmationDialog extends StatelessWidget { SizedBox(height: 8), Text.rich( TextSpan( - text: "Once saved, you will not be able to change your ", + text: AppLocalizations.of(context)!.not_able_to_change, style: TextStyle( fontSize: 14, color: Color(0xFF898C81), @@ -1039,15 +1039,15 @@ class ConfirmationDialog extends StatelessWidget { ), children: [ TextSpan( - text: "Name", + text: AppLocalizations.of(context)!.name, style: TextStyle(fontWeight: FontWeight.w700), // Bold for "name" ), TextSpan( - text: " or ", + text: context.translate(' or ','أو'), ), TextSpan( - text: "Date of birth", + text: AppLocalizations.of(context)!.dob, style: TextStyle( fontWeight: FontWeight.w700), // Bold for "date of birth" ), diff --git a/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart b/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart index 510d727d..a3c79491 100644 --- a/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart +++ b/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart @@ -151,18 +151,6 @@ class _BookMarkState extends ConsumerState { await _pb.collection('bookmark').delete(bookmarkId!, headers: { 'Authorization': adminToken, }); - // Show success SnackBar - // ScaffoldMessenger.of(context).showSnackBar( - // const SnackBar( - // content: Text( - // 'Removed from Bookmark.', - // style: TextStyle( - // color: Color(0xFF2F692C), fontWeight: FontWeight.w600), - // ), - // backgroundColor: Color(0xFFD6E9C6), - // duration: Duration(seconds: 2), - // ), - // ); final locale = ref.read(localeProvider); fetchBookmarks(locale?.languageCode ?? 'en'); // ToastUtil.showSuccessToast("Removed from Bookmark."); @@ -170,11 +158,8 @@ class _BookMarkState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - 'Removed From Bookmark', - style: TextStyle(color: Color(0xFF2F692C), - fontWeight: FontWeight.w500), + AppLocalizations.of(context)!.removed_from_Bookmark, ), - backgroundColor: Color(0xFFD6E9C6), duration: Duration(seconds: 2), ), ); @@ -613,18 +598,7 @@ class _BookMarkState extends ConsumerState { GestureDetector( onTap: () { debugPrint("Icon clicked in: ${data['title']}"); - removeBookmark(data['id']); - // ScaffoldMessenger.of(context).showSnackBar( - // SnackBar( - // content: Text( - // context.translate('Removed From Bookmark','تمت الإزالة من العلامات المرجعية'), - // // style: TextStyle(color: Color(0xFF2F692C), - // // fontWeight: FontWeight.w500), - // ), - // // backgroundColor: Color(0xFFD6E9C6), - // duration: Duration(seconds: 2), - // ), - // ); + showRemoveBookmarkDialog(data['id']); }, child: SvgPicture.asset( BookmarkAssetPath.delete,