diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..dfd9e54 --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"dart":{"lib/firebase_options.dart":{"projectId":"portfolio-2ba4c","configurations":{"web":"1:358775067466:web:b975a7371586227325a7b3"}}}}}} \ No newline at end of file diff --git a/lib/data.dart b/lib/data.dart index 39a913e..6d51218 100644 --- a/lib/data.dart +++ b/lib/data.dart @@ -10,7 +10,7 @@ final List projectsDATA = [ "subtitle": "The Gamer's Social Network", "thumbnail": qlanThumb, "thumbnail_web": qlanThumbWeb, - "tags": ["Flutter, Firebase, Admob"], + "tags": ["Flutter", "Firebase", "Admob"], "link": "https://play.google.com/store/apps/details?id=com.qlan", "description": "Qlan is a social networking and chat communication app dedicated to gamers. It is suited for everyone who is looking to collaborate or network with other gamers through chat. Users can create custom profiles, sync their in-game statistics, access AI based matchmaking, build squads, share gaming content and much more.\n**Key Responsibilities:**\n\n - Full application setup.\n - Mentorship over the duration of development.", diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..79b3d9d --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,64 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + return web; + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for android - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.iOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for ios - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyDOp3_lq1LqOC-QIDfR2-29jEVn0ppDqZ8', + appId: '1:358775067466:web:b975a7371586227325a7b3', + messagingSenderId: '358775067466', + projectId: 'portfolio-2ba4c', + authDomain: 'portfolio-2ba4c.firebaseapp.com', + storageBucket: 'portfolio-2ba4c.appspot.com', + measurementId: 'G-JKZVJXKJLL', + ); +} diff --git a/lib/main.dart b/lib/main.dart index 42924e1..13d5831 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,6 @@ +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; +import 'package:portfolio_flutter/firebase_options.dart'; import 'package:portfolio_flutter/provider/quiz_provider.dart'; import 'package:portfolio_flutter/screens/pages/home.dart'; import 'package:portfolio_flutter/screens/routes/projects.dart'; @@ -11,7 +13,11 @@ import 'package:portfolio_flutter/theme.dart'; import 'package:provider/provider.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; -void main() { +void main() async{ + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, +); runApp(const MyApp()); } @@ -37,7 +43,7 @@ class MyApp extends StatelessWidget { }, // showPerformanceOverlay: true, themeMode: ThemeMode.dark, - title: 'Flutter Demo', + title: 'Ketan Sharma', theme: darkThemeData, home: const Home(), ), diff --git a/lib/screens/pages/home.dart b/lib/screens/pages/home.dart index bf68dc7..8c1ba20 100644 --- a/lib/screens/pages/home.dart +++ b/lib/screens/pages/home.dart @@ -1,6 +1,7 @@ // ignore_for_file: file_names import 'dart:developer'; +import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -156,11 +157,18 @@ class _HomeState extends State { alignment: WrapAlignment.spaceEvenly, crossAxisAlignment: WrapCrossAlignment.center, children: [ - panel('Projects', () { + panel('Projects', () async { + await FirebaseAnalytics.instance.logEvent( + name: 'screen_view', + parameters: { + 'firebase_screen': "Projects", + 'firebase_screen_class': "Projects", + }, + ); Navigator.pushNamed(context, Projects.routeName); }), contactPanel(context), - panel('Showcase', () { + panel('Showcase', () async { Navigator.pushNamed(context, Showcase.routeName); }), ], @@ -232,7 +240,8 @@ class _HomeState extends State { return Padding( padding: const EdgeInsets.all(defaultPadding), child: InkWell( - onTap: () => onPressed(), + //bcs it is async now, and here it was trying to be sync + onTap: onPressed, child: Container( height: 100, width: MediaQuery.of(context).size.width < 800 ? 300 : 200, diff --git a/lib/screens/routes/components/project_description_map.dart b/lib/screens/routes/components/project_description_map.dart index efa579c..451487a 100644 --- a/lib/screens/routes/components/project_description_map.dart +++ b/lib/screens/routes/components/project_description_map.dart @@ -1,6 +1,7 @@ import 'dart:developer'; import 'package:animate_do/animate_do.dart'; +import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; import 'package:markdown_widget/markdown_widget.dart'; import 'package:portfolio_flutter/constants.dart'; @@ -212,6 +213,12 @@ class ProjectDescriptionMAP extends StatelessWidget { child: ElevatedButton.icon( onPressed: () async { // Text(project.link ?? ""), + await FirebaseAnalytics.instance.logEvent( + name: "open_link", + parameters: { + "project_name": project['title'], + }, + ).then((_) => debugPrint('success ')); await launch(project['link']); }, label: Text( diff --git a/lib/widgets/post_card.dart b/lib/widgets/post_card.dart index 6922608..60b2b0d 100644 --- a/lib/widgets/post_card.dart +++ b/lib/widgets/post_card.dart @@ -1,3 +1,4 @@ +import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; import 'package:portfolio_flutter/constants.dart'; @@ -22,7 +23,14 @@ class PostCard extends StatelessWidget { elevation: 4, color: lightBackground, child: InkWell( - onTap: () { + onTap: () async { + await FirebaseAnalytics.instance.logEvent( + name: 'screen_view', + parameters: { + 'firebase_screen': showcase['routeName'], + 'firebase_screen_class': "Showcase", + }, + ); Navigator.pushNamed(context, showcase['routeName']); }, child: Container( diff --git a/pubspec.lock b/pubspec.lock index 73b03cd..57cb690 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: a315d1c444402c3fa468de626d33a1c666041c87e9e195e8fb355b7084aefcc1 + url: "https://pub.dev" + source: hosted + version: "1.3.38" animate_do: dependency: "direct main" description: @@ -129,6 +137,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + sha256: "726596f4ac3352978238274c33234435e61bdb811484ea3d6a2b857bf47a2715" + url: "https://pub.dev" + source: hosted + version: "11.1.0" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + sha256: db445c727aa38038f91a3c6f6873d045a6740c79d03c0b6c61959e0c6ecfd771 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + firebase_analytics_web: + dependency: "direct main" + description: + name: firebase_analytics_web + sha256: "49a8a5ca0bf7fd7541e4b0915b8eb99816edc7a610d5078b89ae013a813fd567" + url: "https://pub.dev" + source: hosted + version: "0.5.8" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "1e06b0538ab3108a61d895ee16951670b491c4a94fce8f2d30e5de7a5eca4b28" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: "1003a5a03a61fc9a22ef49f37cbcb9e46c86313a7b2e7029b9390cf8c6fc32cb" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "6643fe3dbd021e6ccfb751f7882b39df355708afbdeb4130fc50f9305a9d1a3d" + url: "https://pub.dev" + source: hosted + version: "2.17.2" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1ac8f49..20aa964 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,6 +56,9 @@ dependencies: shimmer: ^3.0.0 google_fonts: ^6.2.1 sensors_plus: ^5.0.1 + firebase_analytics_web: ^0.5.8 + firebase_core: ^3.1.1 + firebase_analytics: ^11.1.0 dev_dependencies: diff --git a/web/favicon.png b/web/favicon.png index 8aaa46a..6b9986d 100644 Binary files a/web/favicon.png and b/web/favicon.png differ