This commit is contained in:
Juki-shiba 2025-02-19 18:28:24 +05:30
parent feca758194
commit 7935d944a2
11 changed files with 370 additions and 153 deletions

View File

@ -1,5 +1,5 @@
{
"projects": {
"default": "uae-stats-demo"
"default": "fcsc-da580"
}
}

View File

@ -26,6 +26,24 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="flutter_deeplinking_enabled"
android:value="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="http" android:host="fcsc-da580.web.app"/>
<data android:scheme="https" />
</intent-filter>
<!-- <intent-filter >-->
<!-- <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="dev-fcsc.web.app"-->
<!-- android:pathPrefix="/" />-->
<!-- </intent-filter>-->
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -0,0 +1,6 @@
package ae.gov.fcsc.frontend;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}

View File

@ -1,5 +0,0 @@
package ae.gov.fcsc.frontend
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()

View File

@ -1,18 +1,6 @@
{
"flutter": {
"platforms": {
"dart": {
"lib/firebase_options.dart": {
"projectId": "uae-stats-demo",
"configurations": {
"web": "1:225888316715:web:b96ad37877684cd2dd296e"
}
}
}
}
},
"hosting": {
"public": "build/web",
"public": "p",
"ignore": [
"firebase.json",
"**/.*",

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pocketbase/pocketbase.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
@ -17,6 +18,11 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
import 'package:uae_stat/presentation/Screens/app_tour/Target_content.dart';
import '../filters/search_filter_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:share_plus/share_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:io';
class ChartScreen1 extends ConsumerStatefulWidget {
final String dataSets;
@ -147,17 +153,17 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
});
// ToastUtil.showSuccessToast("Added to Bookmark.");
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
AppLocalizations.of(context)!.added_to_Bookmark,
style: TextStyle(
color: Color(0xFF2F692C), fontWeight: FontWeight.w600),
),
backgroundColor: Color(0xFFD6E9C6),
duration: Duration(seconds: 2),
),
);
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// AppLocalizations.of(context)!.added_to_Bookmark,
// style: TextStyle(
// color: Color(0xFF2F692C), fontWeight: FontWeight.w600),
// ),
// backgroundColor: Color(0xFFD6E9C6),
// duration: Duration(seconds: 2),
// ),
// );
print("Bookmark added: ${response.id}");
} catch (e) {
@ -225,90 +231,90 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
}
/// Show confirmation dialog before removing bookmark
void showRemoveBookmarkDialog() {
double myheight = MediaQuery.of(context).size.height;
showDialog(
context: context,
barrierDismissible: false, // User must tap button to dismiss dialog
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0), // Rounded corners
),
contentPadding: EdgeInsets.zero,
content: Stack(
children: [
Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: myheight / 30,
),
Text(
context.translate(
'Are you sure you want to remove this bookmark?',
'هل أنت متأكد أنك تريد إزالة هذه الإشارة المرجعية؟'),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: Color(0xFF898C81),
),
)
],
),
),
],
),
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
),
),
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),
),
),
),
],
),
);
}
// void showRemoveBookmarkDialog() {
// double myheight = MediaQuery.of(context).size.height;
// showDialog(
// context: context,
// barrierDismissible: false, // User must tap button to dismiss dialog
// builder: (context) => AlertDialog(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(5.0), // Rounded corners
// ),
// contentPadding: EdgeInsets.zero,
// content: Stack(
// children: [
// Padding(
// padding: const EdgeInsets.all(10.0),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// SizedBox(
// height: myheight / 30,
// ),
// Text(
// context.translate(
// 'Are you sure you want to remove this bookmark?',
// 'هل أنت متأكد أنك تريد إزالة هذه الإشارة المرجعية؟'),
// textAlign: TextAlign.center,
// style: TextStyle(
// fontSize: 18,
// color: Color(0xFF898C81),
// ),
// )
// ],
// ),
// ),
// ],
// ),
// 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
// ),
// ),
// 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),
// ),
// ),
// ),
// ],
// ),
// );
// }
//when the popup need for bookmark
// void showAddBookmarkDialog() {
// double myheight = MediaQuery.of(context).size.height;
@ -400,9 +406,24 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'The bookmark is added successfully',
'Added to Bookmark',
style: TextStyle(color: Colors.white, fontSize: 14),
),
backgroundColor: Colors.green,
backgroundColor: Colors.black, // Match the dark background
duration: Duration(seconds: 2),
),
);
}
void showRemoveBookmarkDialog() {
removeBookmark();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Removed from BookMark',
style: TextStyle(color: Colors.white, fontSize: 14),
),
backgroundColor: Colors.black, // Match the dark background
duration: Duration(seconds: 2),
),
);
@ -2052,7 +2073,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
GestureDetector(
onTap: () {
if (isBookmarked) {
showRemoveBookmarkDialog();
showRemoveBookmarkDialog();
} else {
showAddBookmarkDialog();
}
@ -2127,14 +2148,39 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// width: 24,
// height: 24,
// ),
GestureDetector(
onTap: () async {
try {
final svgAssetPath = 'assets/images/sample.svg'; // Update with your actual path
final directory = await getTemporaryDirectory();
final file = File('${directory.path}/shared_image.svg');
// Load the SVG asset and write to the temp file
final svgData = await DefaultAssetBundle.of(context).loadString(svgAssetPath);
await file.writeAsString(svgData);
// Share the file
await Share.shareXFiles([XFile(file.path)], text: "Check this out!");
} catch (e) {
print("Error sharing file: $e");
}
},
child: SvgPicture.asset(
UaeNumbersAssetPath.share,
semanticsLabel: 'share',
width: 24,
height: 24,
),
)
SvgPicture.asset(
UaeNumbersAssetPath.share,
semanticsLabel: 'share',
width: 24,
height: 24,
),
// SvgPicture.asset(
// UaeNumbersAssetPath.share,
// semanticsLabel: 'share',
// width: 24,
// height: 24,
// ),
],
)
],

View File

@ -109,17 +109,17 @@ class _BookMarkState extends ConsumerState<BookMark> {
'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),
),
);
// 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.");
@ -329,9 +329,9 @@ class _BookMarkState extends ConsumerState<BookMark> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'The bookmark is removed successfully',
'Removed from BookMark',
),
backgroundColor: Colors.green,
backgroundColor: Colors.black,
duration: Duration(seconds: 2),
),
);

View File

@ -799,23 +799,53 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
SizedBox(
width: mywidth / 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(userId ?? 'Loading user...'), // Display userId here
// Text('Mohammad@fcsc.com')
if (userId == "guest") ...[
Text(userName ?? 'Guest User'),
] else ...[
Text(userName ?? 'Loading...'),
Text(
userEmail ?? 'Loading...',
style: TextStyle(fontSize: 12),
// maxLines: 2, // Allow the text to wrap to the next line
overflow: TextOverflow.ellipsis,
),
]
],
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// // Text(userId ?? 'Loading user...'), // Display userId here
// // Text('Mohammad@fcsc.com')
// if (userId == "guest") ...[
// Text(userName ?? 'Guest User'),
// ] else ...[
// Text(userName ?? 'Loading...'),
// Tooltip(
// message: userEmail ?? 'Loading...',
// child: Text(
// userEmail ?? 'Loading...',
// style: TextStyle(fontSize: 12),
// softWrap: true,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ),
//
// ]
// ],
// ),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (userId == "guest") ...[
Text(userName ?? 'Guest User'),
] else ...[
Text(userName ?? 'Loading...'),
Tooltip(
message: userEmail ?? 'Loading...', // Shows full email on hover
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.6, // Adjust width as needed
child: Text(
userEmail ?? 'Loading...',
style: TextStyle(fontSize: 12),
// softWrap: true,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
),
],
],
),
),
],
),

33
p/404.html Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page Not Found</title>
<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px 16px; border-radius: 3px; }
#message h3 { color: #888; font-weight: normal; font-size: 16px; margin: 16px 0 12px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
</head>
<body>
<div id="message">
<h2>404</h2>
<h1>Page Not Found</h1>
<p>The specified file was not found on this website. Please check the URL for mistakes and try again.</p>
<h3>Why am I seeing this?</h3>
<p>This page was generated by the Firebase Command-Line Interface. To modify it, edit the <code>404.html</code> file in your project's configured <code>public</code> directory.</p>
</div>
</body>
</html>

89
p/index.html Normal file
View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Firebase Hosting</title>
<!-- update the version number as needed -->
<script defer src="/__/firebase/11.3.1/firebase-app-compat.js"></script>
<!-- include only the Firebase features as you need -->
<script defer src="/__/firebase/11.3.1/firebase-auth-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-database-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-firestore-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-functions-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-messaging-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-storage-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-analytics-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-remote-config-compat.js"></script>
<script defer src="/__/firebase/11.3.1/firebase-performance-compat.js"></script>
<!--
initialize the SDK after all desired features are loaded, set useEmulator to false
to avoid connecting the SDK to running emulators.
-->
<script defer src="/__/firebase/init.js?useEmulator=true"></script>
<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px; border-radius: 3px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
</head>
<body>
<div id="message">
<h2>Welcome</h2>
<h1>Firebase Hosting Setup Complete</h1>
<p>You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!</p>
<a target="_blank" href="https://firebase.google.com/docs/hosting/">Open Hosting Documentation</a>
</div>
<p id="load">Firebase SDK Loading&hellip;</p>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loadEl = document.querySelector('#load');
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
// // The Firebase SDK is initialized and available here!
//
// firebase.auth().onAuthStateChanged(user => { });
// firebase.database().ref('/path/to/ref').on('value', snapshot => { });
// firebase.firestore().doc('/foo/bar').get().then(() => { });
// firebase.functions().httpsCallable('yourFunction')().then(() => { });
// firebase.messaging().requestPermission().then(() => { });
// firebase.storage().ref('/path/to/ref').getDownloadURL().then(() => { });
// firebase.analytics(); // call to activate
// firebase.analytics().logEvent('tutorial_completed');
// firebase.performance(); // call to activate
//
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
try {
let app = firebase.app();
let features = [
'auth',
'database',
'firestore',
'functions',
'messaging',
'storage',
'analytics',
'remoteConfig',
'performance',
].filter(feature => typeof app[feature] === 'function');
loadEl.textContent = `Firebase SDK loaded with ${features.join(', ')}`;
} catch (e) {
console.error(e);
loadEl.textContent = 'Error loading the Firebase SDK, check the console.';
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "ae.gov.fcsc.frontend",
"sha256_cert_fingerprints": [
"3D:BB:9E:B6:3E:80:50:6F:52:EB:73:B8:AD:F9:5F:5A:0A:05:BE:E4:CA:D1:AF:F7:26:2C:56:3F:35:1D:4E:81"
]
}
}
]