bug fix and forgot password

This commit is contained in:
venbaittech 2025-03-27 18:43:32 +05:30
parent a0d7a733a4
commit efb0d38664
11 changed files with 636 additions and 502 deletions

View File

@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
def flutterVersionCode = localProperties.getProperty("flutter.versionCode") def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = "43" flutterVersionCode = "44"
} }
def flutterVersionName = localProperties.getProperty("flutter.versionName") def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = "1.0.42" flutterVersionName = "1.0.43"
} }
def keystorePropertiesFile = rootProject.file("key.properties") def keystorePropertiesFile = rootProject.file("key.properties")

View File

@ -30,13 +30,27 @@
<meta-data android:name="flutter_deeplinking_enabled" <meta-data android:name="flutter_deeplinking_enabled"
android:value="true"/> android:value="true"/>
<intent-filter android:autoVerify="true"> <intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="www.fcsc.com"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data <data
android:scheme="https" android:scheme="flutterdeeplink"
android:host="fcsc-a161c.web.app" android:host="fcsc"
android:pathPrefix="/login" />
<data
android:scheme="flutterdeeplink"
android:host="fcsc"
android:pathPrefix="/chartScreen"/> android:pathPrefix="/chartScreen"/>
<data
android:scheme="flutterdeeplink"
android:host="fcsc"
android:pathPrefix="/forgot-password"/>
</intent-filter> </intent-filter>
<!-- <intent-filter >--> <!-- <intent-filter >-->
<!-- <action android:name="android.intent.action.VIEW" />--> <!-- <action android:name="android.intent.action.VIEW" />-->

View File

@ -667,7 +667,8 @@ final GoRouter router = GoRouter(
redirect: (context, state) async { redirect: (context, state) async {
if (state.uri.path == '/SessionCheckScreen' || if (state.uri.path == '/SessionCheckScreen' ||
state.uri.path == '/login' || state.uri.path == '/login' ||
state.uri.path == '/register') { state.uri.path == '/register' ||
state.uri.path == '/forgot-password/:email') {
return null; return null;
} }

View File

@ -240,7 +240,8 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
onChanged: (value) { onChanged: (value) {
filterData( filterData(
value); // Call filter function directly on input change value); // Call filter function directly on input change
}, }, // Ensures vertical alignment
// Centers text horizontally
decoration: InputDecoration( decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.search, hintText: AppLocalizations.of(context)!.search,
hintStyle: TextStyle(color: Color(0xFFAA8E83)), hintStyle: TextStyle(color: Color(0xFFAA8E83)),
@ -261,8 +262,9 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
// // fit: BoxFit.contain, // // fit: BoxFit.contain,
// ), // ),
border: InputBorder.none, border: InputBorder.none,
contentPadding: // contentPadding:
EdgeInsets.symmetric(vertical: 9, horizontal: 18.0), // EdgeInsets.symmetric(vertical: 9, horizontal: 18.0),
contentPadding: EdgeInsets.zero,
), ),
), ),
), ),

View File

@ -107,6 +107,66 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
return null; return null;
} }
// Future<void> updatePassword(
// String email, String oldPassword, String newPassword) async {
// print(email);
// try {
// setState(() {
// isLoading = true;
// });
// // Authenticate as admin
// final adminAuth = await _pb.admins
// .authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
// final token = adminAuth.token;
//
// final headers = {
// 'Authorization': 'Bearer $token',
// };
//
// // Update password
// await _pb.collection('users').update(
// email,
// body: {
// 'password': newPassword,
// 'passwordConfirm': newPassword,
// },
// headers: headers,
// );
//
// setState(() {
// isLoading = false;
// _isPasswordUpdated = true;
// });
//
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content:
// Text(AppLocalizations.of(context)!.password_update_successfully),
// backgroundColor: Colors.green,
// ),
// );
//
// print('_isPasswordUpdated $_isPasswordUpdated');
//
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) => ProfileScreen(userId: userId)),
// // );
// } catch (e) {
// setState(() {
// isLoading = false;
// });
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(context.translate(
// 'Failed to update password: $e', 'فشل في تحديث كلمة المرور')),
// backgroundColor: Colors.red,
// ),
// );
// }
// }
Future<void> updatePassword( Future<void> updatePassword(
String email, String oldPassword, String newPassword) async { String email, String oldPassword, String newPassword) async {
try { try {
@ -122,9 +182,27 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
'Authorization': 'Bearer $token', 'Authorization': 'Bearer $token',
}; };
// Update password // Step 1: Find User by Email
final result = await _pb.collection('users').getList(
filter: 'email = "$email"',
headers: headers,
);
if (result.items.isEmpty) {
// throw Exception("User not found");
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('User not found'),
backgroundColor: Colors.red,
),
);
}
final userId = result.items.first.id;
// Step 3: Update Password
await _pb.collection('users').update( await _pb.collection('users').update(
email, userId,
body: { body: {
'password': newPassword, 'password': newPassword,
'passwordConfirm': newPassword, 'passwordConfirm': newPassword,
@ -146,19 +224,14 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
); );
print('_isPasswordUpdated $_isPasswordUpdated'); print('_isPasswordUpdated $_isPasswordUpdated');
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ProfileScreen(userId: userId)),
// );
} catch (e) { } catch (e) {
setState(() { setState(() {
isLoading = false; isLoading = false;
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(context.translate('Failed to update password: $e','فشل في تحديث كلمة المرور')), content: Text('Failed to update password: $e'),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
); );

View File

@ -2695,50 +2695,54 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
} }
} }
Future<void> shareCurrentPage(BuildContext context, bool _isSharing) async { Future<void> shareCurrentPage(BuildContext context, bool isSharing) async {
if (_isSharing) return; // Prevent multiple taps if (isSharing) return; // Prevent multiple taps
_isSharing = true; isSharing = true;
try { try {
final String currentRoute = GoRouterState.of(context).uri.toString(); final String currentRoute = GoRouterState.of(context).uri.toString();
final String baseAppLink = 'https://fcsc-a161c.web.app'; final String baseAppLink = 'https://www.fcsc.com';
final String shareLink = '$baseAppLink$currentRoute'; final String shareLink = '$baseAppLink$currentRoute';
final String shareText = 'Check this out!'; final String shareText = 'Check this out!\n\n$shareLink';
final String svgAssetPath = 'assets/backgrounds/share/fcsc.svg'; print('Generated Share Link: $shareLink');
// Optional: Capture SVG to image
final String svgAssetPath = 'assets/backgrounds/share/fcsc.svg';
final screenshotController = ScreenshotController(); final screenshotController = ScreenshotController();
final svgWidget = SvgPicture.asset( final svgWidget = SvgPicture.asset(
svgAssetPath, svgAssetPath,
width: 200, width: 200,
height: 200, height: 200,
); );
final Uint8List? capturedImage = final Uint8List? capturedImage =
await screenshotController.captureFromWidget( await screenshotController.captureFromWidget(
Material(child: svgWidget), Material(child: svgWidget),
); );
if (capturedImage == null) { if (capturedImage == null) {
throw Exception('Failed to capture SVG as image'); print('SVG capture failed, proceeding without image.');
await Share.share(shareText, subject: 'App Link');
} else {
final directory = await getTemporaryDirectory();
final file = File('${directory.path}/share_image.png');
await file.writeAsBytes(capturedImage);
await Share.shareXFiles(
[XFile(file.path)],
text: shareText,
subject: 'Shared Content',
);
await file.delete();
} }
final directory = await getTemporaryDirectory();
final file = File('${directory.path}/share.svg');
await file.writeAsBytes(capturedImage);
await Share.shareXFiles(
[XFile(file.path)],
text: '$shareText\n$shareLink',
subject: 'Shared Content',
);
await file.delete();
} catch (e) { } catch (e) {
print("Error sharing file: $e"); print("Error sharing content: $e");
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error sharing: $e')), SnackBar(content: Text('Error sharing: ${e.toString()}')),
); );
} finally { } finally {
_isSharing = false; // Reset flag after sharing completes isSharing = false; // Reset flag
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -702,6 +702,8 @@ class LoginRoute extends HookConsumerWidget {
); );
final dontHaveAnAccountRegisterBtn = TextButton( final dontHaveAnAccountRegisterBtn = TextButton(
onPressed: () => {context.push('/register')}, onPressed: () => {context.push('/register')},
// onPressed: () =>
// {context.push('/forgot-password/surendar.m@venbainfotech.com')},
child: Text.rich( child: Text.rich(
textAlign: TextAlign.center, textAlign: TextAlign.center,
TextSpan( TextSpan(

View File

@ -152,7 +152,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
isLoading = false; isLoading = false;
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(AppLocalizations.of(context)!.status_success),), SnackBar(
content: Text(AppLocalizations.of(context)!.status_success),
),
); );
} catch (e) { } catch (e) {
setState(() { setState(() {
@ -160,13 +162,16 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(context.translate('Error updating status: $e','$e خطأ في تحديث الحالة: '))), SnackBar(
content: Text(context.translate(
'Error updating status: $e', '$e خطأ في تحديث الحالة: '))),
); );
} }
} }
//Method to show a confirmation dialog when status is changed //Method to show a confirmation dialog when status is changed
Future<void> _showConfirmationDialog(User user, String newStatus,String statusUpdate) async { Future<void> _showConfirmationDialog(
User user, String newStatus, String statusUpdate) async {
print('user $user'); print('user $user');
double myheight = MediaQuery.of(context).size.height; double myheight = MediaQuery.of(context).size.height;
@ -416,8 +421,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
// // fit: BoxFit.contain, // // fit: BoxFit.contain,
// ), // ),
border: InputBorder.none, border: InputBorder.none,
contentPadding: EdgeInsets.symmetric( // contentPadding: EdgeInsets.symmetric(
vertical: 9, horizontal: 18.0), // vertical: 9, horizontal: 18.0),
contentPadding: EdgeInsets.zero,
), ),
onChanged: filterUsers, onChanged: filterUsers,
), ),
@ -444,7 +450,8 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 15), SizedBox(height: 15),
// Space between icon and text // Space between icon and text
Text( Text(
AppLocalizations.of(context)!.no_result_found, AppLocalizations.of(context)!
.no_result_found,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -455,7 +462,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 12), // Space between texts SizedBox(height: 12), // Space between texts
FittedBox( FittedBox(
child: Text( child: Text(
context.translate("We couldn't find anything matching your search.",'لم نعثر على أي شيء يطابق بحثك.'), context.translate(
"We couldn't find anything matching your search.",
'لم نعثر على أي شيء يطابق بحثك.'),
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
color: Color(0xFF898C81)), color: Color(0xFF898C81)),
@ -533,7 +542,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
(index) => DataCell( (index) => DataCell(
index == 0 index == 0
? Text( ? Text(
AppLocalizations.of(context)!.no_result_found, AppLocalizations.of(
context)!
.no_result_found,
style: TextStyle( style: TextStyle(
fontStyle: FontStyle fontStyle: FontStyle
.italic), .italic),
@ -573,7 +584,11 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
print(user); print(user);
if (newStatus != null) { if (newStatus != null) {
_showConfirmationDialog( _showConfirmationDialog(
user, newStatus, statusOptions[newStatus]!,); user,
newStatus,
statusOptions[
newStatus]!,
);
} }
}, },
), ),

View File

@ -298,7 +298,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
createTargetContent( createTargetContent(
text: AppLocalizations.of(context)!.mainMenu, text: AppLocalizations.of(context)!.mainMenu,
alignment: ContentAlign.bottom, alignment: ContentAlign.bottom,
space:55, space: 55,
gap: 55, gap: 55,
), ),
TargetContent( TargetContent(
@ -989,7 +989,9 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
), ),
ListTile( ListTile(
leading: Icon(Icons.mail_outlined), leading: Icon(Icons.mail_outlined),
title: Text(context.translate('Contact Us', 'اتصل بنا'),), title: Text(
context.translate('Contact Us', 'اتصل بنا'),
),
onTap: () => context.push('/contact'), onTap: () => context.push('/contact'),
), ),
if (userId != 'guest') if (userId != 'guest')

View File

@ -1,7 +1,7 @@
name: uae_stat name: uae_stat
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness." description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
publish_to: "none" publish_to: "none"
version: 1.0.42+43 version: 1.0.43+44
environment: environment:
sdk: ">=3.2.3 <4.0.0" sdk: ">=3.2.3 <4.0.0"