bookmark message color change

This commit is contained in:
Kalonkarthik 2025-02-28 12:31:34 +05:30
parent cd1bb0fc8c
commit de820662f7
4 changed files with 127 additions and 142 deletions

View File

@ -6,6 +6,7 @@ import 'package:pocketbase/pocketbase.dart';
import 'package:uae_stat/config/api_config.dart'; import 'package:uae_stat/config/api_config.dart';
import 'package:uae_stat/config/my_router.dart'; import 'package:uae_stat/config/my_router.dart';
import 'package:uae_stat/domain/use_cases/language.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/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
import 'package:uae_stat/presentation/Screens/profilepage.dart'; import 'package:uae_stat/presentation/Screens/profilepage.dart';
import 'package:uae_stat/presentation/components/indicators/locale_provider.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:uae_stat/presentation/components/space.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.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 { class CreateNewPw extends ConsumerStatefulWidget {
final String userId; final String userId;
@ -38,6 +39,11 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
String? _newPassword; String? _newPassword;
String? _confirmPassword; String? _confirmPassword;
final fcscBanner = Image.asset(
BannerAssetPath.fcsc,
height: 40,
);
String? _validateOldPassword(String? value) { String? _validateOldPassword(String? value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return AppLocalizations.of(context)!.old_password_is_required; return AppLocalizations.of(context)!.old_password_is_required;
@ -624,16 +630,17 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
), ),
SizedBox(height: screenHeight / 5), SizedBox(height: screenHeight / 5),
Center( Center(
child: Container( // child: Container(
height: screenHeight / 16, // height: screenHeight / 16,
width: screenWidth / 2.5, // width: screenWidth / 2.5,
decoration: BoxDecoration( // decoration: BoxDecoration(
image: DecorationImage( // image: DecorationImage(
image: AssetImage("assets/splash_screen/logo.png"), // image: AssetImage("assets/splash_screen/logo.png"),
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
), // ),
), // ),
child: fcscBanner,
), ),
], ],
), ),
@ -718,16 +725,17 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
), ),
SizedBox(height: screenHeight / 2.2), SizedBox(height: screenHeight / 2.2),
Center( Center(
child: Container( // child: Container(
height: 40, // height: 40,
width: screenWidth / 2.5, // width: screenWidth / 2.5,
decoration: BoxDecoration( // decoration: BoxDecoration(
image: DecorationImage( // image: DecorationImage(
image: AssetImage("assets/splash_screen/logo.png"), // image: AssetImage("assets/splash_screen/logo.png"),
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
), // ),
), // ),
child: fcscBanner,
), ),
], ],
), ),

View File

@ -171,10 +171,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
SnackBar( SnackBar(
content: Text( content: Text(
AppLocalizations.of(context)!.added_to_Bookmark, AppLocalizations.of(context)!.added_to_Bookmark,
style: TextStyle(
color: Color(0xFF2F692C), fontWeight: FontWeight.w600),
), ),
backgroundColor: Color(0xFFD6E9C6),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
); );
@ -185,10 +182,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
SnackBar( SnackBar(
content: Text( content: Text(
AppLocalizations.of(context)!.failed_To_Remove, AppLocalizations.of(context)!.failed_To_Remove,
style: TextStyle( // style: TextStyle(
color: Color(0xFF544C4C), fontWeight: FontWeight.w600), // color: Color(0xFF544C4C), fontWeight: FontWeight.w600),
), ),
backgroundColor: Color(0xFFEB5F24), // backgroundColor: Color(0xFFEB5F24),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
); );
@ -217,10 +214,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
SnackBar( SnackBar(
content: Text( content: Text(
AppLocalizations.of(context)!.removed_from_Bookmark, AppLocalizations.of(context)!.removed_from_Bookmark,
style: TextStyle(
color: Color(0xFF2F692C), fontWeight: FontWeight.w600),
), ),
backgroundColor: Color(0xFFD6E9C6),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
); );
@ -231,10 +225,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
SnackBar( SnackBar(
content: Text( content: Text(
'Failed to Remove', 'Failed to Remove',
style: TextStyle( // style: TextStyle(
color: Color(0xFF544C4C), fontWeight: FontWeight.w600), // color: Color(0xFF544C4C), fontWeight: FontWeight.w600),
), ),
backgroundColor: Color(0xFFEB5F24), // backgroundColor: Color(0xFFEB5F24),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
); );
@ -282,49 +276,55 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
actions: [ actions: [
SizedBox(height: 20), SizedBox(height: 20),
SizedBox( Row(
width: 100, // Set the desired width mainAxisAlignment: MainAxisAlignment.spaceEvenly,
child: TextButton( children: [
onPressed: () => Navigator.pop(context), SizedBox(
style: TextButton.styleFrom( width: 100, // Set the desired width
shape: RoundedRectangleBorder( child: TextButton(
borderRadius: BorderRadius.circular( onPressed: () => Navigator.pop(context),
10.0), // Adjust the radius as needed style: TextButton.styleFrom(
), shape: RoundedRectangleBorder(
side: BorderSide( borderRadius: BorderRadius.circular(
color: Color(0xFFAA8E83), // Set the outline color 10.0), // Adjust the radius as needed
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( SizedBox(
context.translate('No', 'لا'), width: 100, // Set the desired width
style: TextStyle( child: TextButton(
color: Color(0xFFAA8E83), onPressed: () {
fontSize: 16, 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<ChartScreen1> {
), ),
actions: [ actions: [
SizedBox(height: 20), SizedBox(height: 20),
SizedBox( Row(
width: 100, // Set the desired width mainAxisAlignment: MainAxisAlignment.spaceEvenly,
child: TextButton( children: [ SizedBox(
onPressed: () => Navigator.pop(context), width: 100, // Set the desired width
style: TextButton.styleFrom( child: TextButton(
shape: RoundedRectangleBorder( onPressed: () => Navigator.pop(context),
borderRadius: BorderRadius.circular( style: TextButton.styleFrom(
10.0), // Adjust the radius as needed 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( child: Text(
color: Color(0xFFAA8E83), // Set the outline color context.translate('No', 'لا'),
width: 1, // Set the border width style: TextStyle(
), color: Color(0xFFAA8E83),
), fontSize: 16,
child: Text( ),
context.translate('No', 'لا'),
style: TextStyle(
color: Color(0xFFAA8E83),
fontSize: 16,
), ),
), ),
), ),
), SizedBox(
SizedBox( width: 100, // Set the desired width
width: 100, // Set the desired width child: TextButton(
child: TextButton( onPressed: () {
onPressed: () { Navigator.pop(context);
Navigator.pop(context); addBookmark(); // Close dialog
addBookmark(); // Close dialog },
}, style: TextButton.styleFrom(
style: TextButton.styleFrom( backgroundColor: Color(0xFFAA8E83), // Set background color
backgroundColor: Color(0xFFAA8E83), // Set background color foregroundColor: Colors.white,
foregroundColor: Colors.white, shape: RoundedRectangleBorder(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), // Set text color
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),
),
),
), ),
], ],
), ),

View File

@ -1018,7 +1018,7 @@ class ConfirmationDialog extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
"Are you sure you want to save this page?", AppLocalizations.of(context)!.sure_save_page,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF898C81), color: Color(0xFF898C81),
@ -1030,7 +1030,7 @@ class ConfirmationDialog extends StatelessWidget {
SizedBox(height: 8), SizedBox(height: 8),
Text.rich( Text.rich(
TextSpan( TextSpan(
text: "Once saved, you will not be able to change your ", text: AppLocalizations.of(context)!.not_able_to_change,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF898C81), color: Color(0xFF898C81),
@ -1039,15 +1039,15 @@ class ConfirmationDialog extends StatelessWidget {
), ),
children: [ children: [
TextSpan( TextSpan(
text: "Name", text: AppLocalizations.of(context)!.name,
style: style:
TextStyle(fontWeight: FontWeight.w700), // Bold for "name" TextStyle(fontWeight: FontWeight.w700), // Bold for "name"
), ),
TextSpan( TextSpan(
text: " or ", text: context.translate(' or ','أو'),
), ),
TextSpan( TextSpan(
text: "Date of birth", text: AppLocalizations.of(context)!.dob,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700), // Bold for "date of birth" fontWeight: FontWeight.w700), // Bold for "date of birth"
), ),

View File

@ -151,18 +151,6 @@ class _BookMarkState extends ConsumerState<BookMark> {
await _pb.collection('bookmark').delete(bookmarkId!, headers: { await _pb.collection('bookmark').delete(bookmarkId!, headers: {
'Authorization': adminToken, '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); final locale = ref.read(localeProvider);
fetchBookmarks(locale?.languageCode ?? 'en'); fetchBookmarks(locale?.languageCode ?? 'en');
// ToastUtil.showSuccessToast("Removed from Bookmark."); // ToastUtil.showSuccessToast("Removed from Bookmark.");
@ -170,11 +158,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
'Removed From Bookmark', AppLocalizations.of(context)!.removed_from_Bookmark,
style: TextStyle(color: Color(0xFF2F692C),
fontWeight: FontWeight.w500),
), ),
backgroundColor: Color(0xFFD6E9C6),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
); );
@ -613,18 +598,7 @@ class _BookMarkState extends ConsumerState<BookMark> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
debugPrint("Icon clicked in: ${data['title']}"); debugPrint("Icon clicked in: ${data['title']}");
removeBookmark(data['id']); showRemoveBookmarkDialog(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),
// ),
// );
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
BookmarkAssetPath.delete, BookmarkAssetPath.delete,