diff --git a/lib/Screens/article.dart b/lib/Screens/article.dart index b0a955a..d656093 100644 --- a/lib/Screens/article.dart +++ b/lib/Screens/article.dart @@ -151,7 +151,8 @@ class _ArticleScreenState extends State { valueListenable: articleTitle, builder: (context, value, _) { return value.toString() == 'Loading...' || - championshipOfArticle != 'Formula 1' + championshipOfArticle != 'Formula 1' || + kIsWeb ? Container() : IconButton( onPressed: () async { @@ -285,8 +286,10 @@ class ArticleProvider extends StatelessWidget { Future
getArticleFromFormula1( String articleId, Function updateArticleTitle) async { - String? filePath = await DownloadUtils() - .downloadedFilePathIfExists('article_f1_${articleId}'); + String? filePath = kIsWeb + ? null + : await DownloadUtils() + .downloadedFilePathIfExists('article_f1_${articleId}'); if (filePath != null) { File file = File(filePath); Map savedArticle = await json.decode(await file.readAsString()); diff --git a/lib/Screens/video.dart b/lib/Screens/video.dart index de28811..f5da2c0 100644 --- a/lib/Screens/video.dart +++ b/lib/Screens/video.dart @@ -23,6 +23,7 @@ import 'package:background_downloader/background_downloader.dart'; import 'package:boxbox/api/videos.dart'; import 'package:boxbox/helpers/download.dart'; import 'package:boxbox/helpers/news.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:fluttertoast/fluttertoast.dart'; @@ -134,7 +135,7 @@ class _VideoScreenState extends State { ), ), actions: [ - championship == 'Formula 1' + championship == 'Formula 1' && !kIsWeb ? IconButton( onPressed: () async { if (downloads diff --git a/lib/api/brightcove.dart b/lib/api/brightcove.dart index 15bd636..ae1408a 100644 --- a/lib/api/brightcove.dart +++ b/lib/api/brightcove.dart @@ -115,8 +115,10 @@ class BrightCove { Future> getVideoLinks(String videoId, {String? player, String? articleChampionship}) async { - String? filePath = - await DownloadUtils().downloadedFilePathIfExists('video_f1_${videoId}'); + String? filePath = kIsWeb + ? null + : await DownloadUtils() + .downloadedFilePathIfExists('video_f1_${videoId}'); if (filePath != null) { return {'file': filePath}; diff --git a/lib/helpers/bottom_navigation_bar.dart b/lib/helpers/bottom_navigation_bar.dart index 5d4f911..9df3797 100644 --- a/lib/helpers/bottom_navigation_bar.dart +++ b/lib/helpers/bottom_navigation_bar.dart @@ -101,25 +101,27 @@ class _MainBottomNavigationBarState extends State { : Hive.box('settings').put('darkMode', true); bool useDarkMode = Hive.box('settings').get('darkMode', defaultValue: true) as bool; - FileDownloader().configureNotification( - running: TaskNotification( - AppLocalizations.of(context)!.downloadRunning, - '{displayName}', - ), - complete: TaskNotification( - AppLocalizations.of(context)!.downloadComplete, - '{displayName}', - ), - error: TaskNotification( - AppLocalizations.of(context)!.downloadFailed, - '{displayName}', - ), - paused: TaskNotification( - AppLocalizations.of(context)!.downloadPaused, - '{displayName}', - ), - progressBar: true, - ); + if (!kIsWeb) { + FileDownloader().configureNotification( + running: TaskNotification( + AppLocalizations.of(context)!.downloadRunning, + '{displayName}', + ), + complete: TaskNotification( + AppLocalizations.of(context)!.downloadComplete, + '{displayName}', + ), + error: TaskNotification( + AppLocalizations.of(context)!.downloadFailed, + '{displayName}', + ), + paused: TaskNotification( + AppLocalizations.of(context)!.downloadPaused, + '{displayName}', + ), + progressBar: true, + ); + } List screens = [ HomeScreen(scrollController), diff --git a/lib/helpers/drawer.dart b/lib/helpers/drawer.dart index fa4bbda..5d7184e 100644 --- a/lib/helpers/drawer.dart +++ b/lib/helpers/drawer.dart @@ -27,6 +27,7 @@ import 'package:boxbox/Screens/history.dart'; import 'package:boxbox/Screens/MixedNews/mixed_news.dart'; import 'package:boxbox/Screens/settings.dart'; import 'package:boxbox/Screens/test.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:hive_flutter/hive_flutter.dart'; @@ -133,23 +134,25 @@ class MainDrawer extends StatelessWidget { ); }, ), - ListTile( - title: Text( - AppLocalizations.of(context)!.downloads, - ), - leading: Icon( - Icons.save_alt_rounded, - ), - onTap: () { - Navigator.of(context).pop(); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const DownloadsScreen(), - ), - ); - }, - ), + !kIsWeb + ? ListTile( + title: Text( + AppLocalizations.of(context)!.downloads, + ), + leading: Icon( + Icons.save_alt_rounded, + ), + onTap: () { + Navigator.of(context).pop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DownloadsScreen(), + ), + ); + }, + ) + : Container(), Divider( indent: 15, endIndent: 15, diff --git a/lib/main.dart b/lib/main.dart index f17c32e..96aa4a9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -47,7 +47,9 @@ void main() async { final compareBox = await Hive.openBox('compare'); final downloads = await Hive.openBox('downloads'); - await FileDownloader().trackTasks(); + if (!kIsWeb) { + await FileDownloader().trackTasks(); + } /* if (!kIsWeb) { AwesomeNotifications().initialize( diff --git a/story_view/pubspec.lock b/story_view/pubspec.lock index 1301b84..8b499bc 100644 --- a/story_view/pubspec.lock +++ b/story_view/pubspec.lock @@ -128,38 +128,62 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider: dependency: transitive description: @@ -313,10 +337,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" typed_data: dependency: transitive description: @@ -381,14 +405,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" - web: + vm_service: dependency: transitive description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "14.2.1" win32: dependency: transitive description: @@ -406,5 +430,5 @@ packages: source: hosted version: "1.0.3" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.13.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54"