added firebase config

This commit is contained in:
Vaibhav Surve 2025-07-16 12:45:34 +05:30
parent 990bf737dc
commit 5cc4bfd9f6
5 changed files with 138 additions and 58 deletions

View File

@ -1,55 +1,37 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:label="Marco_Stage"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application android:label="Marco_Stage" android:name="${applicationName}" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
to determine the Window background behind the Flutter UI. -->
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="high_importance_channel"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2"/>
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>

View File

@ -19,7 +19,9 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
id("com.google.gms.google-services") version "4.4.2" apply false
}
include ":app"

View File

@ -0,0 +1,53 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:logger/logger.dart';
class FirebaseNotificationService {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
final Logger _logger = Logger();
Future<void> initialize() async {
await Firebase.initializeApp();
_logger.i('Firebase initialized.');
NotificationSettings settings = await _firebaseMessaging.requestPermission();
_logger.i('FCM permission status: ${settings.authorizationStatus}');
// Foreground messages
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
_logger.i('🔔 Foreground Notification Received');
_logNotificationDetails(message);
});
// When app is opened from background via notification
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
_logger.i('📲 App opened via notification');
_handleNotificationTap(message);
});
// Background handler registration
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}
void _handleNotificationTap(RemoteMessage message) {
_logger.i('Notification tapped with data: ${message.data}');
}
void _logNotificationDetails(RemoteMessage message) {
_logger.i('Notification ID: ${message.messageId}');
_logger.i('Title: ${message.notification?.title}');
_logger.i('Body: ${message.notification?.body}');
_logger.i('Data: ${message.data}');
}
}
// Background handler
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
final Logger _logger = Logger();
_logger.i('🕓 Handling background notification...');
_logger.i('Notification ID: ${message.messageId}');
_logger.i('Title: ${message.notification?.title}');
_logger.i('Body: ${message.notification?.body}');
_logger.i('Data: ${message.data}');
}

View File

@ -38,16 +38,56 @@ class AttendanceDashboardChart extends StatelessWidget {
final Map<String, Color> _roleColorMap = {};
final List<Color> flatColors = [
const Color(0xFFE57373),
const Color(0xFF64B5F6),
const Color(0xFF81C784),
const Color(0xFFFFB74D),
const Color(0xFFBA68C8),
const Color(0xFFFF8A65),
const Color(0xFF4DB6AC),
const Color(0xFFA1887F),
const Color(0xFFDCE775),
const Color(0xFF9575CD),
const Color(0xFFE57373), // Red
const Color(0xFF64B5F6), // Blue
const Color(0xFF81C784), // Green
const Color(0xFFFFB74D), // Orange
const Color(0xFFBA68C8), // Purple
const Color(0xFFFF8A65), // Deep Orange
const Color(0xFF4DB6AC), // Teal
const Color(0xFFA1887F), // Brown
const Color(0xFFDCE775), // Lime
const Color(0xFF9575CD), // Violet`
const Color(0xFF7986CB), // Indigo
const Color(0xFFAED581), // Light Green
const Color(0xFF4FC3F7), // Light Blue
const Color(0xFFF06292), // Pink
const Color(0xFFE0E0E0), // Grey
const Color(0xFFCE93D8), // Lavender
const Color(0xFFFFF176), // Yellow
const Color(0xFFA5D6A7), // Mint Green
const Color(0xFF90CAF9), // Sky Blue
const Color(0xFFFFAB91), // Salmon
const Color(0xFFE6EE9C), // Pale Lime
const Color(0xFFFFCC80), // Apricot
const Color(0xFFB39DDB), // Soft Purple
const Color(0xFF80DEEA), // Light Cyan
const Color(0xFFB0BEC5), // Blue Grey
const Color(0xFFEF9A9A), // Soft Red
const Color(0xFFFFCDD2), // Rose
const Color(0xFFC5CAE9), // Periwinkle
const Color(0xFFF8BBD0), // Baby Pink
const Color(0xFFD1C4E9), // Lilac
const Color(0xFFFFF9C4), // Pastel Yellow
const Color(0xFFC8E6C9), // Pastel Green
const Color(0xFFBBDEFB), // Pastel Blue
const Color(0xFFFFECB3), // Butter
const Color(0xFFE1BEE7), // Orchid
const Color(0xFFB2EBF2), // Powder Blue
const Color(0xFFCFD8DC), // Cool Grey
const Color(0xFFFBE9E7), // Peach Cream
const Color(0xFFF3E5F5), // Lavender Mist
const Color(0xFFFFFDE7), // Soft Sunlight
const Color(0xFFDCEDC8), // Soft Apple
const Color(0xFFB3E5FC), // Ice Blue
const Color(0xFFFFF3E0), // Cream
const Color(0xFFFCE4EC), // Candy Pink
const Color(0xFFEDE7F6), // Wisteria
const Color(0xFFE0F7FA), // Arctic Blue
const Color(0xFFECEFF1), // Frost
const Color(0xFFFFE0B2), // Sandy Orange
const Color(0xFFFFD54F), // Mango
const Color(0xFFFFA726), // Tangerine
];
Color _getRoleColor(String role) {

View File

@ -77,6 +77,9 @@ dependencies:
html_editor_enhanced: ^2.7.0
flutter_quill_delta_from_html: ^1.5.2
quill_delta: ^3.0.0-nullsafety.2
firebase_core: ^3.14.0
firebase_messaging: ^15.2.7
googleapis_auth: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter