diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index cd1b671..2a74574 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties index 1b307fd..fca23ad 100644 --- a/.gradle/buildOutputCleanup/cache.properties +++ b/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Sun May 12 13:50:43 IST 2024 -gradle.version=8.1.1 +#Wed May 29 23:39:38 IST 2024 +gradle.version=8.4 diff --git a/lib/programs screen/google_summer_of_code_screen.dart b/lib/programs screen/google_summer_of_code_screen.dart index 25e7655..ff97c20 100644 --- a/lib/programs screen/google_summer_of_code_screen.dart +++ b/lib/programs screen/google_summer_of_code_screen.dart @@ -5,6 +5,7 @@ import 'package:url_launcher/url_launcher.dart'; import '../modals/GSoC/Gsoc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../modals/book_mark_model.dart'; import '../services/ApiService.dart'; import '../widgets/SearchandFilterWidget.dart'; import '../widgets/year_button.dart'; @@ -20,7 +21,11 @@ class _GoogleSummerOfCodeScreenState extends State { List gsoc2023 = []; List gsoc2022 = []; List gsoc2021 = []; + String currectPage = "/google_summer_of_code"; + String currentProject = "Google Summer of Code"; + bool isBookmarked = true; int selectedYear = 2024; + List languages = [ 'js', 'python', @@ -46,6 +51,14 @@ class _GoogleSummerOfCodeScreenState extends State { void initState() { super.initState(); _dataFetchFuture = getProjectData(); + _checkBookmarkStatus(); + } + + Future _checkBookmarkStatus() async { + bool bookmarkStatus = await HandleBookmark.isBookmarked(currentProject); + setState(() { + isBookmarked = bookmarkStatus; + }); } Future getProjectData() async { @@ -149,9 +162,33 @@ class _GoogleSummerOfCodeScreenState extends State { return RefreshIndicator( onRefresh: _refresh, child: Scaffold( - appBar: AppBar( - title: Text('Google Summer of Code'), - ), + appBar: AppBar(title: const Text('Google Summer of Code'), actions: [ + IconButton( + icon: (isBookmarked) + ? const Icon(Icons.bookmark_add_rounded) + : const Icon(Icons.bookmark_add_outlined), + onPressed: () { + setState(() { + isBookmarked = !isBookmarked; + }); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + isBookmarked ? 'Bookmark added' : 'Bookmark removed'), + duration: const Duration( + seconds: 2), // Adjust the duration as needed + ), + ); + if (isBookmarked) { + print("Adding"); + HandleBookmark.addBookmark(currentProject, currectPage); + } else { + print("Deleting"); + HandleBookmark.deleteBookmark(currentProject); + } + }, + ) + ]), body: FutureBuilder( future: _dataFetchFuture, builder: (context, snapshot) { diff --git a/lib/programs screen/summer_of_bitcoin.dart b/lib/programs screen/summer_of_bitcoin.dart index 12d4a6b..f948acb 100644 --- a/lib/programs screen/summer_of_bitcoin.dart +++ b/lib/programs screen/summer_of_bitcoin.dart @@ -6,6 +6,7 @@ import 'package:opso/modals/sob_project_modal.dart'; import 'package:opso/widgets/sob_project_widget.dart'; import 'package:opso/widgets/year_button.dart'; +import '../modals/book_mark_model.dart'; import '../widgets/SearchandFilterWidget.dart'; class SummerOfBitcoin extends StatefulWidget { @@ -19,6 +20,9 @@ class _SummerOfBitcoinState extends State { List sob2023 = []; List sob2022 = []; List sob2021 = []; + String currectPage = "/summer_of_bitcoin"; + String currentProject = "Summer of Bitcoin"; + bool isBookmarked = true; int selectedYear = 2023; List projectList = []; @@ -49,6 +53,14 @@ class _SummerOfBitcoinState extends State { void initState() { getProjectFunction = initializeProjectLists(); super.initState(); + _checkBookmarkStatus(); + } + + Future _checkBookmarkStatus() async { + bool bookmarkStatus = await HandleBookmark.isBookmarked(currentProject); + setState(() { + isBookmarked = bookmarkStatus; + }); } void searchTag(String searchTag) { @@ -120,9 +132,33 @@ class _SummerOfBitcoinState extends State { return RefreshIndicator( onRefresh: _refresh, child: Scaffold( - appBar: AppBar( - title: const Text('Summer of Bitcoin'), - ), + appBar: AppBar(title: const Text('Summer of Bitcoin'), actions: [ + IconButton( + icon: (isBookmarked) + ? const Icon(Icons.bookmark_add_rounded) + : const Icon(Icons.bookmark_add_outlined), + onPressed: () { + setState(() { + isBookmarked = !isBookmarked; + }); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + isBookmarked ? 'Bookmark added' : 'Bookmark removed'), + duration: const Duration( + seconds: 2), // Adjust the duration as needed + ), + ); + if (isBookmarked) { + print("Adding"); + HandleBookmark.addBookmark(currentProject, currectPage); + } else { + print("Deleting"); + HandleBookmark.deleteBookmark(currentProject); + } + }, + ) + ]), body: FutureBuilder( future: getProjectFunction, builder: (context, snapshot) { diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..31f4503 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Wed May 29 23:39:41 IST 2024 +sdk.dir=C\:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk