From 96f72fcdb3c8aa6fbf915f758b7d665d498e99aa Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 5 Jan 2023 20:13:48 +0100 Subject: [PATCH] tv: overscan --- lib/utils/constants.dart | 364 --------------------- lib/utils/dependencies.dart | 366 ++++++++++++++++++++++ lib/widgets/about/about_page.dart | 5 +- lib/widgets/about/app_ref.dart | 17 +- lib/widgets/about/licenses.dart | 9 +- lib/widgets/aves_app.dart | 35 ++- lib/widgets/settings/settings_page.dart | 13 +- lib/widgets/viewer/info/info_app_bar.dart | 62 ++-- 8 files changed, 458 insertions(+), 413 deletions(-) create mode 100644 lib/utils/dependencies.dart diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index aa618c6c7..859ae55f6 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -1,6 +1,5 @@ import 'dart:ui'; -import 'package:aves/app_flavor.dart'; import 'package:flutter/material.dart'; import 'package:latlong2/latlong.dart'; @@ -69,367 +68,4 @@ class Constants { static const int infoGroupMaxValueLength = 140; static const String avesGithub = 'https://github.com/deckerst/aves'; - - static const String apache2 = 'Apache License 2.0'; - static const String bsd2 = 'BSD 2-Clause "Simplified" License'; - static const String bsd3 = 'BSD 3-Clause "Revised" License'; - static const String eclipse1 = 'Eclipse Public License 1.0'; - static const String mit = 'MIT License'; - - static const List androidDependencies = [ - Dependency( - name: 'AndroidSVG', - license: apache2, - sourceUrl: 'https://github.com/BigBadaboom/androidsvg', - ), - Dependency( - name: 'AndroidX (Core Kotlin, Exifinterface, Lifecycle Process, Multidex)', - license: apache2, - licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/LICENSE.txt', - sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/core/core-ktx', - ), - Dependency( - name: 'CWAC-Document', - license: apache2, - sourceUrl: 'https://github.com/commonsguy/cwac-document', - ), - Dependency( - name: 'Glide', - license: '$apache2, $bsd2', - sourceUrl: 'https://github.com/bumptech/glide', - ), - Dependency( - name: 'Metadata Extractor', - license: apache2, - sourceUrl: 'https://github.com/drewnoakes/metadata-extractor', - ), - Dependency( - name: 'MP4 Parser (Aves fork)', - license: apache2, - sourceUrl: 'https://github.com/deckerst/mp4parser', - ), - Dependency( - name: 'PixyMeta Android (Aves fork)', - license: eclipse1, - sourceUrl: 'https://github.com/deckerst/pixymeta-android', - ), - Dependency( - name: 'Tiff Bitmap Factory (Aves fork)', - license: mit, - licenseUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory/blob/master/license.txt', - sourceUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory', - ), - ]; - - static const List _flutterPluginsCommon = [ - Dependency( - name: 'Connectivity Plus', - license: bsd3, - licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/connectivity_plus/connectivity_plus/LICENSE', - sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus', - ), - Dependency( - name: 'Device Info Plus', - license: bsd3, - licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/device_info_plus/device_info_plus/LICENSE', - sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus', - ), - Dependency( - name: 'Dynamic Color', - license: bsd3, - sourceUrl: 'https://github.com/material-foundation/material-dynamic-color-flutter', - ), - Dependency( - name: 'fijkplayer (Aves fork)', - license: mit, - sourceUrl: 'https://github.com/deckerst/fijkplayer', - ), - Dependency( - name: 'Flutter Display Mode', - license: mit, - sourceUrl: 'https://github.com/ajinasokan/flutter_displaymode', - ), - Dependency( - name: 'Package Info Plus', - license: bsd3, - licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/package_info_plus/package_info_plus/LICENSE', - sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/package_info_plus', - ), - Dependency( - name: 'Permission Handler', - license: mit, - sourceUrl: 'https://github.com/Baseflow/flutter-permission-handler', - ), - Dependency( - name: 'Printing', - license: apache2, - sourceUrl: 'https://github.com/DavBfr/dart_pdf', - ), - Dependency( - name: 'Screen Brightness', - license: mit, - sourceUrl: 'https://github.com/aaassseee/screen_brightness', - ), - Dependency( - name: 'Shared Preferences', - license: bsd3, - licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/shared_preferences/shared_preferences/LICENSE', - sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences', - ), - Dependency( - name: 'sqflite', - license: bsd2, - sourceUrl: 'https://github.com/tekartik/sqflite', - ), - Dependency( - name: 'Streams Channel (Aves fork)', - license: apache2, - sourceUrl: 'https://github.com/deckerst/aves_streams_channel', - ), - Dependency( - name: 'URL Launcher', - license: bsd3, - licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/LICENSE', - sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher', - ), - ]; - - static const List _googleMobileServices = [ - Dependency( - name: 'Google API Availability', - license: mit, - sourceUrl: 'https://github.com/Baseflow/flutter-google-api-availability', - ), - Dependency( - name: 'Google Maps for Flutter', - license: bsd3, - licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/google_maps_flutter/google_maps_flutter/LICENSE', - sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter', - ), - ]; - - static const List _huaweiMobileServices = [ - Dependency( - name: 'Huawei Mobile Services (Availability, Map)', - license: apache2, - licenseUrl: 'https://github.com/HMS-Core/hms-flutter-plugin/blob/master/LICENCE', - sourceUrl: 'https://github.com/HMS-Core/hms-flutter-plugin', - ), - ]; - - static const List _flutterPluginsHuaweiOnly = [ - ..._huaweiMobileServices, - ]; - - static const List _flutterPluginsIzzyOnly = [ - ..._googleMobileServices, - ]; - - static const List _flutterPluginsLibreOnly = []; - - static const List _flutterPluginsPlayOnly = [ - ..._googleMobileServices, - Dependency( - name: 'FlutterFire (Core, Crashlytics)', - license: bsd3, - sourceUrl: 'https://github.com/FirebaseExtended/flutterfire', - ), - ]; - - static List flutterPlugins(AppFlavor flavor) => [ - ..._flutterPluginsCommon, - if (flavor == AppFlavor.huawei) ..._flutterPluginsHuaweiOnly, - if (flavor == AppFlavor.izzy) ..._flutterPluginsIzzyOnly, - if (flavor == AppFlavor.libre) ..._flutterPluginsLibreOnly, - if (flavor == AppFlavor.play) ..._flutterPluginsPlayOnly, - ]; - - static const List flutterPackages = [ - Dependency( - name: 'Charts', - license: apache2, - sourceUrl: 'https://github.com/google/charts', - ), - Dependency( - name: 'Custom rounded rectangle border', - license: mit, - sourceUrl: 'https://github.com/lekanbar/custom_rounded_rectangle_border', - ), - Dependency( - name: 'Decorated Icon', - license: mit, - sourceUrl: 'https://github.com/benPesso/flutter_decorated_icon', - ), - Dependency( - name: 'Expansion Tile Card (Aves fork)', - license: bsd3, - sourceUrl: 'https://github.com/deckerst/expansion_tile_card', - ), - Dependency( - name: 'FlexColorPicker', - license: bsd3, - sourceUrl: 'https://github.com/rydmike/flex_color_picker', - ), - Dependency( - name: 'Flutter Highlight', - license: mit, - sourceUrl: 'https://github.com/git-touch/highlight', - ), - Dependency( - name: 'Flutter Map', - license: bsd3, - sourceUrl: 'https://github.com/fleaflet/flutter_map', - ), - Dependency( - name: 'Flutter Markdown', - license: bsd3, - licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/flutter_markdown/LICENSE', - sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/flutter_markdown', - ), - Dependency( - name: 'Flutter Staggered Animations', - license: mit, - sourceUrl: 'https://github.com/mobiten/flutter_staggered_animations', - ), - Dependency( - name: 'Material Design Icons Flutter', - license: mit, - sourceUrl: 'https://github.com/ziofat/material_design_icons_flutter', - ), - Dependency( - name: 'Overlay Support', - license: apache2, - sourceUrl: 'https://github.com/boyan01/overlay_support', - ), - Dependency( - name: 'Palette Generator', - license: bsd3, - licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/palette_generator/LICENSE', - sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/palette_generator', - ), - Dependency( - name: 'Panorama (Aves fork)', - license: apache2, - sourceUrl: 'https://github.com/zesage/panorama', - ), - Dependency( - name: 'Percent Indicator', - license: bsd2, - sourceUrl: 'https://github.com/diegoveloper/flutter_percent_indicator', - ), - Dependency( - name: 'Provider', - license: mit, - sourceUrl: 'https://github.com/rrousselGit/provider', - ), - Dependency( - name: 'Smooth Page Indicator', - license: mit, - sourceUrl: 'https://github.com/Milad-Akarie/smooth_page_indicator', - ), - ]; - - static const List dartPackages = [ - Dependency( - name: 'Collection', - license: bsd3, - sourceUrl: 'https://github.com/dart-lang/collection', - ), - Dependency( - name: 'Country Code', - license: mit, - sourceUrl: 'https://github.com/denixport/dart.country', - ), - Dependency( - name: 'Equatable', - license: mit, - sourceUrl: 'https://github.com/felangel/equatable', - ), - Dependency( - name: 'Event Bus', - license: mit, - sourceUrl: 'https://github.com/marcojakob/dart-event-bus', - ), - Dependency( - name: 'Fluster', - license: mit, - sourceUrl: 'https://github.com/alfonsocejudo/fluster', - ), - Dependency( - name: 'Flutter Lints', - license: bsd3, - licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/flutter_lints/LICENSE', - sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/flutter_lints', - ), - Dependency( - name: 'Get It', - license: mit, - sourceUrl: 'https://github.com/fluttercommunity/get_it', - ), - Dependency( - name: 'Intl', - license: bsd3, - sourceUrl: 'https://github.com/dart-lang/intl', - ), - Dependency( - name: 'LatLong2', - license: apache2, - sourceUrl: 'https://github.com/jifalops/dart-latlong', - ), - Dependency( - name: 'Material Color Utilities', - license: apache2, - licenseUrl: 'https://github.com/material-foundation/material-color-utilities/tree/main/dart/LICENSE', - sourceUrl: 'https://github.com/material-foundation/material-color-utilities/tree/main/dart', - ), - Dependency( - name: 'Path', - license: bsd3, - sourceUrl: 'https://github.com/dart-lang/path', - ), - Dependency( - name: 'PDF for Dart and Flutter', - license: apache2, - sourceUrl: 'https://github.com/DavBfr/dart_pdf', - ), - Dependency( - name: 'Proj4dart', - license: mit, - sourceUrl: 'https://github.com/maRci002/proj4dart', - ), - Dependency( - name: 'Stack Trace', - license: bsd3, - sourceUrl: 'https://github.com/dart-lang/stack_trace', - ), - Dependency( - name: 'Transparent Image', - license: mit, - sourceUrl: 'https://github.com/brianegan/transparent_image', - ), - Dependency( - name: 'Tuple', - license: bsd2, - sourceUrl: 'https://github.com/google/tuple.dart', - ), - Dependency( - name: 'XML', - license: mit, - sourceUrl: 'https://github.com/renggli/dart-xml', - ), - ]; -} - -class Dependency { - final String name; - final String license; - final String sourceUrl; - final String licenseUrl; - - const Dependency({ - required this.name, - required this.license, - String? licenseUrl, - required this.sourceUrl, - }) : licenseUrl = licenseUrl ?? '$sourceUrl/blob/master/LICENSE'; } diff --git a/lib/utils/dependencies.dart b/lib/utils/dependencies.dart new file mode 100644 index 000000000..354e113d3 --- /dev/null +++ b/lib/utils/dependencies.dart @@ -0,0 +1,366 @@ +import 'package:aves/app_flavor.dart'; + +class Dependencies { + static const String apache2 = 'Apache License 2.0'; + static const String bsd2 = 'BSD 2-Clause "Simplified" License'; + static const String bsd3 = 'BSD 3-Clause "Revised" License'; + static const String eclipse1 = 'Eclipse Public License 1.0'; + static const String mit = 'MIT License'; + + static const List androidDependencies = [ + Dependency( + name: 'AndroidSVG', + license: apache2, + sourceUrl: 'https://github.com/BigBadaboom/androidsvg', + ), + Dependency( + name: 'AndroidX (Core Kotlin, Exifinterface, Lifecycle Process, Multidex)', + license: apache2, + licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/LICENSE.txt', + sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-main/core/core-ktx', + ), + Dependency( + name: 'CWAC-Document', + license: apache2, + sourceUrl: 'https://github.com/commonsguy/cwac-document', + ), + Dependency( + name: 'Glide', + license: '$apache2, $bsd2', + sourceUrl: 'https://github.com/bumptech/glide', + ), + Dependency( + name: 'Metadata Extractor', + license: apache2, + sourceUrl: 'https://github.com/drewnoakes/metadata-extractor', + ), + Dependency( + name: 'MP4 Parser (Aves fork)', + license: apache2, + sourceUrl: 'https://github.com/deckerst/mp4parser', + ), + Dependency( + name: 'PixyMeta Android (Aves fork)', + license: eclipse1, + sourceUrl: 'https://github.com/deckerst/pixymeta-android', + ), + Dependency( + name: 'Tiff Bitmap Factory (Aves fork)', + license: mit, + licenseUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory/blob/master/license.txt', + sourceUrl: 'https://github.com/deckerst/Android-TiffBitmapFactory', + ), + ]; + + static const List _flutterPluginsCommon = [ + Dependency( + name: 'Connectivity Plus', + license: bsd3, + licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/connectivity_plus/connectivity_plus/LICENSE', + sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus', + ), + Dependency( + name: 'Device Info Plus', + license: bsd3, + licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/device_info_plus/device_info_plus/LICENSE', + sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus', + ), + Dependency( + name: 'Dynamic Color', + license: bsd3, + sourceUrl: 'https://github.com/material-foundation/material-dynamic-color-flutter', + ), + Dependency( + name: 'fijkplayer (Aves fork)', + license: mit, + sourceUrl: 'https://github.com/deckerst/fijkplayer', + ), + Dependency( + name: 'Flutter Display Mode', + license: mit, + sourceUrl: 'https://github.com/ajinasokan/flutter_displaymode', + ), + Dependency( + name: 'Package Info Plus', + license: bsd3, + licenseUrl: 'https://github.com/fluttercommunity/plus_plugins/blob/main/packages/package_info_plus/package_info_plus/LICENSE', + sourceUrl: 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/package_info_plus', + ), + Dependency( + name: 'Permission Handler', + license: mit, + sourceUrl: 'https://github.com/Baseflow/flutter-permission-handler', + ), + Dependency( + name: 'Printing', + license: apache2, + sourceUrl: 'https://github.com/DavBfr/dart_pdf', + ), + Dependency( + name: 'Screen Brightness', + license: mit, + sourceUrl: 'https://github.com/aaassseee/screen_brightness', + ), + Dependency( + name: 'Shared Preferences', + license: bsd3, + licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/shared_preferences/shared_preferences/LICENSE', + sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences', + ), + Dependency( + name: 'sqflite', + license: bsd2, + sourceUrl: 'https://github.com/tekartik/sqflite', + ), + Dependency( + name: 'Streams Channel (Aves fork)', + license: apache2, + sourceUrl: 'https://github.com/deckerst/aves_streams_channel', + ), + Dependency( + name: 'URL Launcher', + license: bsd3, + licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/LICENSE', + sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher', + ), + ]; + + static const List _googleMobileServices = [ + Dependency( + name: 'Google API Availability', + license: mit, + sourceUrl: 'https://github.com/Baseflow/flutter-google-api-availability', + ), + Dependency( + name: 'Google Maps for Flutter', + license: bsd3, + licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/google_maps_flutter/google_maps_flutter/LICENSE', + sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter', + ), + ]; + + static const List _huaweiMobileServices = [ + Dependency( + name: 'Huawei Mobile Services (Availability, Map)', + license: apache2, + licenseUrl: 'https://github.com/HMS-Core/hms-flutter-plugin/blob/master/LICENCE', + sourceUrl: 'https://github.com/HMS-Core/hms-flutter-plugin', + ), + ]; + + static const List _flutterPluginsHuaweiOnly = [ + ..._huaweiMobileServices, + ]; + + static const List _flutterPluginsIzzyOnly = [ + ..._googleMobileServices, + ]; + + static const List _flutterPluginsLibreOnly = []; + + static const List _flutterPluginsPlayOnly = [ + ..._googleMobileServices, + Dependency( + name: 'FlutterFire (Core, Crashlytics)', + license: bsd3, + sourceUrl: 'https://github.com/FirebaseExtended/flutterfire', + ), + ]; + + static List flutterPlugins(AppFlavor flavor) => [ + ..._flutterPluginsCommon, + if (flavor == AppFlavor.huawei) ..._flutterPluginsHuaweiOnly, + if (flavor == AppFlavor.izzy) ..._flutterPluginsIzzyOnly, + if (flavor == AppFlavor.libre) ..._flutterPluginsLibreOnly, + if (flavor == AppFlavor.play) ..._flutterPluginsPlayOnly, + ]; + + static const List flutterPackages = [ + Dependency( + name: 'Charts', + license: apache2, + sourceUrl: 'https://github.com/google/charts', + ), + Dependency( + name: 'Custom rounded rectangle border', + license: mit, + sourceUrl: 'https://github.com/lekanbar/custom_rounded_rectangle_border', + ), + Dependency( + name: 'Decorated Icon', + license: mit, + sourceUrl: 'https://github.com/benPesso/flutter_decorated_icon', + ), + Dependency( + name: 'Expansion Tile Card (Aves fork)', + license: bsd3, + sourceUrl: 'https://github.com/deckerst/expansion_tile_card', + ), + Dependency( + name: 'FlexColorPicker', + license: bsd3, + sourceUrl: 'https://github.com/rydmike/flex_color_picker', + ), + Dependency( + name: 'Flutter Highlight', + license: mit, + sourceUrl: 'https://github.com/git-touch/highlight', + ), + Dependency( + name: 'Flutter Map', + license: bsd3, + sourceUrl: 'https://github.com/fleaflet/flutter_map', + ), + Dependency( + name: 'Flutter Markdown', + license: bsd3, + licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/flutter_markdown/LICENSE', + sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/flutter_markdown', + ), + Dependency( + name: 'Flutter Staggered Animations', + license: mit, + sourceUrl: 'https://github.com/mobiten/flutter_staggered_animations', + ), + Dependency( + name: 'Material Design Icons Flutter', + license: mit, + sourceUrl: 'https://github.com/ziofat/material_design_icons_flutter', + ), + Dependency( + name: 'Overlay Support', + license: apache2, + sourceUrl: 'https://github.com/boyan01/overlay_support', + ), + Dependency( + name: 'Palette Generator', + license: bsd3, + licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/palette_generator/LICENSE', + sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/palette_generator', + ), + Dependency( + name: 'Panorama (Aves fork)', + license: apache2, + sourceUrl: 'https://github.com/zesage/panorama', + ), + Dependency( + name: 'Percent Indicator', + license: bsd2, + sourceUrl: 'https://github.com/diegoveloper/flutter_percent_indicator', + ), + Dependency( + name: 'Provider', + license: mit, + sourceUrl: 'https://github.com/rrousselGit/provider', + ), + Dependency( + name: 'Smooth Page Indicator', + license: mit, + sourceUrl: 'https://github.com/Milad-Akarie/smooth_page_indicator', + ), + ]; + + static const List dartPackages = [ + Dependency( + name: 'Collection', + license: bsd3, + sourceUrl: 'https://github.com/dart-lang/collection', + ), + Dependency( + name: 'Country Code', + license: mit, + sourceUrl: 'https://github.com/denixport/dart.country', + ), + Dependency( + name: 'Equatable', + license: mit, + sourceUrl: 'https://github.com/felangel/equatable', + ), + Dependency( + name: 'Event Bus', + license: mit, + sourceUrl: 'https://github.com/marcojakob/dart-event-bus', + ), + Dependency( + name: 'Fluster', + license: mit, + sourceUrl: 'https://github.com/alfonsocejudo/fluster', + ), + Dependency( + name: 'Flutter Lints', + license: bsd3, + licenseUrl: 'https://github.com/flutter/packages/blob/master/packages/flutter_lints/LICENSE', + sourceUrl: 'https://github.com/flutter/packages/tree/master/packages/flutter_lints', + ), + Dependency( + name: 'Get It', + license: mit, + sourceUrl: 'https://github.com/fluttercommunity/get_it', + ), + Dependency( + name: 'Intl', + license: bsd3, + sourceUrl: 'https://github.com/dart-lang/intl', + ), + Dependency( + name: 'LatLong2', + license: apache2, + sourceUrl: 'https://github.com/jifalops/dart-latlong', + ), + Dependency( + name: 'Material Color Utilities', + license: apache2, + licenseUrl: 'https://github.com/material-foundation/material-color-utilities/tree/main/dart/LICENSE', + sourceUrl: 'https://github.com/material-foundation/material-color-utilities/tree/main/dart', + ), + Dependency( + name: 'Path', + license: bsd3, + sourceUrl: 'https://github.com/dart-lang/path', + ), + Dependency( + name: 'PDF for Dart and Flutter', + license: apache2, + sourceUrl: 'https://github.com/DavBfr/dart_pdf', + ), + Dependency( + name: 'Proj4dart', + license: mit, + sourceUrl: 'https://github.com/maRci002/proj4dart', + ), + Dependency( + name: 'Stack Trace', + license: bsd3, + sourceUrl: 'https://github.com/dart-lang/stack_trace', + ), + Dependency( + name: 'Transparent Image', + license: mit, + sourceUrl: 'https://github.com/brianegan/transparent_image', + ), + Dependency( + name: 'Tuple', + license: bsd2, + sourceUrl: 'https://github.com/google/tuple.dart', + ), + Dependency( + name: 'XML', + license: mit, + sourceUrl: 'https://github.com/renggli/dart-xml', + ), + ]; +} + +class Dependency { + final String name; + final String license; + final String sourceUrl; + final String licenseUrl; + + const Dependency({ + required this.name, + required this.license, + String? licenseUrl, + required this.sourceUrl, + }) : licenseUrl = licenseUrl ?? '$sourceUrl/blob/master/LICENSE'; +} diff --git a/lib/widgets/about/about_page.dart b/lib/widgets/about/about_page.dart index 4d2303594..c5c1e654b 100644 --- a/lib/widgets/about/about_page.dart +++ b/lib/widgets/about/about_page.dart @@ -20,6 +20,7 @@ class AboutPage extends StatelessWidget { @override Widget build(BuildContext context) { final appBarTitle = Text(context.l10n.aboutPageTitle); + final useTvLayout = settings.useTvLayout; final body = CustomScrollView( slivers: [ SliverPadding( @@ -27,7 +28,7 @@ class AboutPage extends StatelessWidget { sliver: SliverList( delegate: SliverChildListDelegate( [ - const AppReference(), + AppReference(showLogo: !useTvLayout), if (!settings.useTvLayout) ...[ const Divider(), const BugReport(), @@ -46,7 +47,7 @@ class AboutPage extends StatelessWidget { ], ); - if (settings.useTvLayout) { + if (useTvLayout) { return Scaffold( body: AvesPopScope( handlers: const [TvNavigationPopHandler.pop], diff --git a/lib/widgets/about/app_ref.dart b/lib/widgets/about/app_ref.dart index f9c05ac66..ce4a94ba4 100644 --- a/lib/widgets/about/app_ref.dart +++ b/lib/widgets/about/app_ref.dart @@ -10,7 +10,12 @@ import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; class AppReference extends StatefulWidget { - const AppReference({super.key}); + final bool showLogo; + + const AppReference({ + super.key, + required this.showLogo, + }); @override State createState() => _AppReferenceState(); @@ -52,10 +57,12 @@ class _AppReferenceState extends State { return Row( mainAxisSize: MainAxisSize.min, children: [ - AvesLogo( - size: style.fontSize! * MediaQuery.textScaleFactorOf(context) * 1.3, - ), - const SizedBox(width: 8), + if (widget.showLogo) ...[ + AvesLogo( + size: style.fontSize! * MediaQuery.textScaleFactorOf(context) * 1.3, + ), + const SizedBox(width: 8), + ], Text( '${context.l10n.appName} ${snapshot.data?.version}', style: style, diff --git a/lib/widgets/about/licenses.dart b/lib/widgets/about/licenses.dart index 08088bfdd..813776474 100644 --- a/lib/widgets/about/licenses.dart +++ b/lib/widgets/about/licenses.dart @@ -2,6 +2,7 @@ import 'package:aves/app_flavor.dart'; import 'package:aves/ref/brand_colors.dart'; import 'package:aves/theme/colors.dart'; import 'package:aves/utils/constants.dart'; +import 'package:aves/utils/dependencies.dart'; import 'package:aves/widgets/common/basic/link_chip.dart'; import 'package:aves/widgets/common/extensions/build_context.dart'; import 'package:aves/widgets/common/identity/aves_expansion_tile.dart'; @@ -24,10 +25,10 @@ class _LicensesState extends State { @override void initState() { super.initState(); - _platform = List.from(Constants.androidDependencies); - _flutterPlugins = List.from(Constants.flutterPlugins(context.read())); - _flutterPackages = List.from(Constants.flutterPackages); - _dartPackages = List.from(Constants.dartPackages); + _platform = List.from(Dependencies.androidDependencies); + _flutterPlugins = List.from(Dependencies.flutterPlugins(context.read())); + _flutterPackages = List.from(Dependencies.flutterPackages); + _dartPackages = List.from(Dependencies.dartPackages); _sortPackages(); } diff --git a/lib/widgets/aves_app.dart b/lib/widgets/aves_app.dart index 4d6b723b6..009a5008c 100644 --- a/lib/widgets/aves_app.dart +++ b/lib/widgets/aves_app.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:math'; import 'dart:ui'; import 'package:aves/app_flavor.dart'; @@ -436,10 +437,36 @@ class _AvesAppState extends State with WidgetsBindingObserver { settings.applyTvSettings(); _pageTransitionsBuilderNotifier.value = const TvPageTransitionsBuilder(); - _tvMediaQueryModifierNotifier.value = (mq) => mq.copyWith( - textScaleFactor: 1.1, - navigationMode: NavigationMode.directional, - ); + _tvMediaQueryModifierNotifier.value = (mq) { + // cf https://developer.android.com/training/tv/start/layouts.html#overscan + final screenSize = mq.size; + const overscanFactor = .05; + final overscanInsets = EdgeInsets.symmetric( + vertical: screenSize.shortestSide * overscanFactor, + horizontal: screenSize.longestSide * overscanFactor, + ); + final oldViewPadding = mq.viewPadding; + final newViewPadding = EdgeInsets.only( + top: max(oldViewPadding.top, overscanInsets.top), + right: max(oldViewPadding.right, overscanInsets.right), + bottom: max(oldViewPadding.bottom, overscanInsets.bottom), + left: max(oldViewPadding.left, overscanInsets.left), + ); + var newPadding = newViewPadding - mq.viewInsets; + newPadding = EdgeInsets.only( + top: max(0.0, newPadding.top), + right: max(0.0, newPadding.right), + bottom: max(0.0, newPadding.bottom), + left: max(0.0, newPadding.left), + ); + + return mq.copyWith( + textScaleFactor: 1.1, + padding: newPadding, + viewPadding: newViewPadding, + navigationMode: NavigationMode.directional, + ); + }; if (settings.forceTvLayout) { await windowService.requestOrientation(Orientation.landscape); } diff --git a/lib/widgets/settings/settings_page.dart b/lib/widgets/settings/settings_page.dart index b32bfc941..21f480fb4 100644 --- a/lib/widgets/settings/settings_page.dart +++ b/lib/widgets/settings/settings_page.dart @@ -86,10 +86,15 @@ class _SettingsPageState extends State with FeedbackMixin { child: Column( children: [ const SizedBox(height: 8), - AppBar( - automaticallyImplyLeading: false, - title: appBarTitle, - elevation: 0, + DirectionalSafeArea( + start: false, + bottom: false, + child: AppBar( + automaticallyImplyLeading: false, + title: appBarTitle, + elevation: 0, + primary: false, + ), ), Expanded( child: ValueListenableBuilder( diff --git a/lib/widgets/viewer/info/info_app_bar.dart b/lib/widgets/viewer/info/info_app_bar.dart index 71115e927..03ccc2f30 100644 --- a/lib/widgets/viewer/info/info_app_bar.dart +++ b/lib/widgets/viewer/info/info_app_bar.dart @@ -35,9 +35,9 @@ class InfoAppBar extends StatelessWidget { Widget build(BuildContext context) { final commonActions = EntryActions.commonMetadataActions.where((v) => actionDelegate.isVisible(entry, v)); final formatSpecificActions = EntryActions.formatSpecificMetadataActions.where((v) => actionDelegate.isVisible(entry, v)); - + final useTvLayout = settings.useTvLayout; return SliverAppBar( - leading: settings.useTvLayout + leading: useTvLayout ? null : IconButton( // key is expected by test driver @@ -53,34 +53,36 @@ class InfoAppBar extends StatelessWidget { child: Text(context.l10n.viewerInfoPageTitle), ), ), - actions: [ - IconButton( - icon: const Icon(AIcons.search), - onPressed: () => _goToSearch(context), - tooltip: MaterialLocalizations.of(context).searchFieldLabel, - ), - if (entry.canEdit) - MenuIconTheme( - child: PopupMenuButton( - itemBuilder: (context) => [ - ...commonActions.map((action) => _toMenuItem(context, action, enabled: actionDelegate.canApply(entry, action))), - if (formatSpecificActions.isNotEmpty) ...[ - const PopupMenuDivider(), - ...formatSpecificActions.map((action) => _toMenuItem(context, action, enabled: actionDelegate.canApply(entry, action))), - ], - if (!kReleaseMode) ...[ - const PopupMenuDivider(), - _toMenuItem(context, EntryAction.debug, enabled: true), - ] - ], - onSelected: (action) async { - // wait for the popup menu to hide before proceeding with the action - await Future.delayed(Durations.popupMenuAnimation * timeDilation); - actionDelegate.onActionSelected(context, entry, collection, action); - }, - ), - ), - ], + actions: useTvLayout + ? [] + : [ + IconButton( + icon: const Icon(AIcons.search), + onPressed: () => _goToSearch(context), + tooltip: MaterialLocalizations.of(context).searchFieldLabel, + ), + if (entry.canEdit) + MenuIconTheme( + child: PopupMenuButton( + itemBuilder: (context) => [ + ...commonActions.map((action) => _toMenuItem(context, action, enabled: actionDelegate.canApply(entry, action))), + if (formatSpecificActions.isNotEmpty) ...[ + const PopupMenuDivider(), + ...formatSpecificActions.map((action) => _toMenuItem(context, action, enabled: actionDelegate.canApply(entry, action))), + ], + if (!kReleaseMode) ...[ + const PopupMenuDivider(), + _toMenuItem(context, EntryAction.debug, enabled: true), + ] + ], + onSelected: (action) async { + // wait for the popup menu to hide before proceeding with the action + await Future.delayed(Durations.popupMenuAnimation * timeDilation); + actionDelegate.onActionSelected(context, entry, collection, action); + }, + ), + ), + ], floating: true, ); }