diff --git a/lib/app/app_model.dart b/lib/app/app_model.dart index 956e11ceb..8850167fb 100644 --- a/lib/app/app_model.dart +++ b/lib/app/app_model.dart @@ -1,7 +1,9 @@ +import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:github/github.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:safe_change_notifier/safe_change_notifier.dart'; +import 'package:yaru/theme.dart'; import '../constants.dart'; import '../expose/expose_service.dart'; @@ -61,9 +63,24 @@ class AppModel extends SafeChangeNotifier { bool? _fullWindowMode; bool? get fullWindowMode => _fullWindowMode; - void setFullWindowMode(bool? value) { + Future setFullWindowMode(bool? value) async { if (value == null || value == _fullWindowMode) return; _fullWindowMode = value; + + if (isMobile) { + if (_fullWindowMode == true) { + await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + } else { + await SystemChrome.setEnabledSystemUIMode( + SystemUiMode.manual, + overlays: SystemUiOverlay.values, + ); + await SystemChrome.setPreferredOrientations( + [], + ); + } + } + notifyListeners(); } diff --git a/lib/app/view/app.dart b/lib/app/view/app.dart index da3943693..fdadfc110 100644 --- a/lib/app/view/app.dart +++ b/lib/app/view/app.dart @@ -1,23 +1,10 @@ -import 'dart:ui'; - -import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; -import 'package:phoenix_theme/phoenix_theme.dart' hide ColorX; import 'package:system_theme/system_theme.dart'; -import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; import '../../common/view/theme.dart'; -import '../../constants.dart'; -import '../../external_path/external_path_service.dart'; -import '../../l10n/l10n.dart'; -import '../../library/library_model.dart'; -import '../../radio/radio_model.dart'; -import '../../settings/settings_model.dart'; -import '../connectivity_model.dart'; -import 'desktop_scaffold.dart'; -import 'master_items.dart'; -import 'splash_screen.dart'; +import 'desktop_musicpod_app.dart'; +import 'mobile_musicpod_app.dart'; class YaruMusicPodApp extends StatelessWidget { const YaruMusicPodApp({super.key}); @@ -25,7 +12,7 @@ class YaruMusicPodApp extends StatelessWidget { @override Widget build(BuildContext context) { return YaruTheme( - builder: (context, yaru, child) => _DesktopMusicPodApp( + builder: (context, yaru, child) => DesktopMusicPodApp( highContrastTheme: yaruHighContrastLight, highContrastDarkTheme: yaruHighContrastDark, lightTheme: yaruLightWithTweaks(yaru), @@ -42,165 +29,8 @@ class MaterialMusicPodApp extends StatelessWidget { Widget build(BuildContext context) => SystemThemeBuilder( builder: (context, accent) { return isMobile - ? _MobileMusicPodApp(accent: accent.accent) - : _DesktopMusicPodApp(accent: accent.accent); + ? MobileMusicPodApp(accent: accent.accent) + : DesktopMusicPodApp(accent: accent.accent); }, ); } - -class _DesktopMusicPodApp extends StatefulWidget - with WatchItStatefulWidgetMixin { - const _DesktopMusicPodApp({ - this.lightTheme, - this.darkTheme, - this.accent, - this.highContrastTheme, - this.highContrastDarkTheme, - }); - - final ThemeData? lightTheme, - darkTheme, - highContrastTheme, - highContrastDarkTheme; - final Color? accent; - - @override - State<_DesktopMusicPodApp> createState() => _DesktopMusicPodAppState(); -} - -class _DesktopMusicPodAppState extends State<_DesktopMusicPodApp> { - late Future _initFuture; - - @override - void initState() { - super.initState(); - _initFuture = _init(); - } - - Future _init() async { - await di().init(); - await di().init(); - await di().init(); - if (!mounted) return false; - di().init(); - return true; - } - - @override - Widget build(BuildContext context) { - final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex); - final phoenix = phoenixTheme(color: widget.accent ?? Colors.greenAccent); - return MaterialApp( - debugShowCheckedModeBanner: false, - themeMode: ThemeMode.values[themeIndex], - highContrastTheme: widget.highContrastTheme, - highContrastDarkTheme: widget.highContrastDarkTheme, - theme: widget.lightTheme ?? phoenix.lightTheme, - darkTheme: widget.darkTheme ?? phoenix.darkTheme, - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: supportedLocales, - onGenerateTitle: (context) => kAppTitle, - home: FutureBuilder( - future: _initFuture, - builder: (context, snapshot) { - return snapshot.data == true - ? const DesktopScaffold() - : const SplashScreen(); - }, - ), - scrollBehavior: const MaterialScrollBehavior().copyWith( - dragDevices: { - PointerDeviceKind.mouse, - PointerDeviceKind.touch, - PointerDeviceKind.stylus, - PointerDeviceKind.unknown, - PointerDeviceKind.trackpad, - }, - ), - ); - } -} - -class _MobileMusicPodApp extends StatefulWidget - with WatchItStatefulWidgetMixin { - const _MobileMusicPodApp({this.accent}); - - final Color? accent; - - @override - State<_MobileMusicPodApp> createState() => _MobileMusicPodAppState(); -} - -class _MobileMusicPodAppState extends State<_MobileMusicPodApp> { - late Future _initFuture; - - @override - void initState() { - super.initState(); - _initFuture = _init(); - } - - Future _init() async { - await di().init(); - await di().init(); - await di().init(); - if (!mounted) return false; - di().init(); - return true; - } - - @override - Widget build(BuildContext context) { - final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex); - final phoenix = phoenixTheme(color: widget.accent ?? Colors.greenAccent); - - final libraryModel = watchIt(); - final masterItems = createMasterItems(libraryModel: libraryModel); - - return MaterialApp( - navigatorKey: libraryModel.masterNavigatorKey, - navigatorObservers: [libraryModel], - initialRoute: - isMobile ? (libraryModel.selectedPageId ?? kLocalAudioPageId) : null, - onGenerateRoute: (settings) { - final page = (masterItems.firstWhereOrNull( - (e) => e.pageId == settings.name, - ) ?? - masterItems.elementAt(0)) - .pageBuilder(context); - - return PageRouteBuilder( - settings: settings, - pageBuilder: (_, __, ___) => FutureBuilder( - future: _initFuture, - builder: (context, snapshot) { - return snapshot.data == true ? page : const SplashScreen(); - }, - ), - transitionsBuilder: (_, a, __, c) => - FadeTransition(opacity: a, child: c), - ); - }, - debugShowCheckedModeBanner: false, - themeMode: ThemeMode.values[themeIndex], - theme: phoenix.lightTheme.copyWith( - navigationBarTheme: navigationBarTheme(theme: phoenix.lightTheme), - ), - darkTheme: phoenix.darkTheme.copyWith( - navigationBarTheme: navigationBarTheme(theme: phoenix.darkTheme), - ), - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: supportedLocales, - onGenerateTitle: (context) => kAppTitle, - scrollBehavior: const MaterialScrollBehavior().copyWith( - dragDevices: { - PointerDeviceKind.mouse, - PointerDeviceKind.touch, - PointerDeviceKind.stylus, - PointerDeviceKind.unknown, - PointerDeviceKind.trackpad, - }, - ), - ); - } -} diff --git a/lib/app/view/desktop_musicpod_app.dart b/lib/app/view/desktop_musicpod_app.dart new file mode 100644 index 000000000..76a66ef2e --- /dev/null +++ b/lib/app/view/desktop_musicpod_app.dart @@ -0,0 +1,89 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:phoenix_theme/phoenix_theme.dart'; +import 'package:watch_it/watch_it.dart'; + +import '../../constants.dart'; +import '../../external_path/external_path_service.dart'; +import '../../l10n/l10n.dart'; +import '../../library/library_model.dart'; +import '../../radio/radio_model.dart'; +import '../../settings/settings_model.dart'; +import '../connectivity_model.dart'; +import 'desktop_scaffold.dart'; +import 'splash_screen.dart'; + +class DesktopMusicPodApp extends StatefulWidget + with WatchItStatefulWidgetMixin { + const DesktopMusicPodApp({ + super.key, + this.lightTheme, + this.darkTheme, + this.accent, + this.highContrastTheme, + this.highContrastDarkTheme, + }); + + final ThemeData? lightTheme, + darkTheme, + highContrastTheme, + highContrastDarkTheme; + final Color? accent; + + @override + State createState() => _DesktopMusicPodAppState(); +} + +class _DesktopMusicPodAppState extends State { + late Future _initFuture; + + @override + void initState() { + super.initState(); + _initFuture = _init(); + } + + Future _init() async { + await di().init(); + await di().init(); + await di().init(); + if (!mounted) return false; + di().init(); + return true; + } + + @override + Widget build(BuildContext context) { + final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex); + final phoenix = phoenixTheme(color: widget.accent ?? Colors.greenAccent); + return MaterialApp( + debugShowCheckedModeBanner: false, + themeMode: ThemeMode.values[themeIndex], + highContrastTheme: widget.highContrastTheme, + highContrastDarkTheme: widget.highContrastDarkTheme, + theme: widget.lightTheme ?? phoenix.lightTheme, + darkTheme: widget.darkTheme ?? phoenix.darkTheme, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: supportedLocales, + onGenerateTitle: (context) => kAppTitle, + home: FutureBuilder( + future: _initFuture, + builder: (context, snapshot) { + return snapshot.data == true + ? const DesktopScaffold() + : const SplashScreen(); + }, + ), + scrollBehavior: const MaterialScrollBehavior().copyWith( + dragDevices: { + PointerDeviceKind.mouse, + PointerDeviceKind.touch, + PointerDeviceKind.stylus, + PointerDeviceKind.unknown, + PointerDeviceKind.trackpad, + }, + ), + ); + } +} diff --git a/lib/app/view/mobile_navigation_bar.dart b/lib/app/view/mobile_bottom_bar.dart similarity index 50% rename from lib/app/view/mobile_navigation_bar.dart rename to lib/app/view/mobile_bottom_bar.dart index bed1ced59..9afdeabb6 100644 --- a/lib/app/view/mobile_navigation_bar.dart +++ b/lib/app/view/mobile_bottom_bar.dart @@ -10,13 +10,11 @@ import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; import '../../library/library_model.dart'; import '../../player/view/bottom_player.dart'; -import '../../player/view/full_height_player.dart'; -import '../../player/view/player_view.dart'; import '../app_model.dart'; import 'main_page_icon.dart'; -class MobilePlayerAndNavigationBar extends StatelessWidget with WatchItMixin { - const MobilePlayerAndNavigationBar({ +class MobileBottomBar extends StatelessWidget with WatchItMixin { + const MobileBottomBar({ super.key, }); @@ -24,22 +22,20 @@ class MobilePlayerAndNavigationBar extends StatelessWidget with WatchItMixin { Widget build(BuildContext context) { final fullWindowMode = watchPropertyValue((AppModel m) => m.fullWindowMode) ?? false; - - return RepaintBoundary( - child: Material( - color: context.theme.cardColor, - child: fullWindowMode - ? const FullHeightPlayer( - playerPosition: PlayerPosition.fullWindow, - ) - : const Column( - mainAxisSize: MainAxisSize.min, - children: [ - BottomPlayer(), - SizedBox(height: kMediumSpace), - MobileNavigationBar(), - ], - ), + return SizedBox( + width: context.mediaQuerySize.width, + child: RepaintBoundary( + child: Material( + color: context.theme.cardColor, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: bottomPlayerHeight, child: const BottomPlayer()), + const SizedBox(height: kMediumSpace), + if (!fullWindowMode) const MobileNavigationBar(), + ], + ), + ), ), ); } @@ -55,41 +51,47 @@ class MobileNavigationBar extends StatelessWidget with WatchItMixin { final selectedPageId = watchPropertyValue((LibraryModel m) => m.selectedPageId); - final destinations = { - kLocalAudioPageId: NavigationDestination( + final destinations = { + kLocalAudioPageId: IconButton( + isSelected: selectedPageId == kLocalAudioPageId, selectedIcon: const MainPageIcon(selected: true, audioType: AudioType.local), icon: const MainPageIcon(selected: false, audioType: AudioType.local), - label: l10n.local, + tooltip: l10n.local, + onPressed: () => di().push(pageId: kLocalAudioPageId), ), - kRadioPageId: NavigationDestination( + kRadioPageId: IconButton( + isSelected: selectedPageId == kRadioPageId, selectedIcon: const MainPageIcon(selected: true, audioType: AudioType.radio), icon: const MainPageIcon(selected: false, audioType: AudioType.radio), - label: l10n.radio, + tooltip: l10n.radio, + onPressed: () => di().push(pageId: kRadioPageId), ), - kPodcastsPageId: NavigationDestination( + kPodcastsPageId: IconButton( + isSelected: selectedPageId == kPodcastsPageId, selectedIcon: const MainPageIcon(selected: true, audioType: AudioType.podcast), icon: const MainPageIcon(selected: false, audioType: AudioType.podcast), - label: l10n.podcasts, + tooltip: l10n.podcasts, + onPressed: () => di().push(pageId: kPodcastsPageId), ), - kSettingsPageId: NavigationDestination( + kSettingsPageId: IconButton( + isSelected: selectedPageId == kSettingsPageId, selectedIcon: Icon(Iconz.settingsFilled), icon: Icon(Iconz.settings), - label: l10n.settings, + tooltip: l10n.settings, + onPressed: () => di().push(pageId: kSettingsPageId), ), }; - return NavigationBar( - height: bottomPlayerHeight - 25, - backgroundColor: context.theme.cardColor, - selectedIndex: selectedPageId == null - ? 0 - : destinations.keys.toList().indexOf(selectedPageId), - onDestinationSelected: (index) => - di().push(pageId: destinations.keys.elementAt(index)), - destinations: destinations.values.toList(), + return SizedBox( + height: navigationBarHeight, + width: context.mediaQuerySize.width, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: destinations.values.toList(), + ), ); } } diff --git a/lib/app/view/mobile_musicpod_app.dart b/lib/app/view/mobile_musicpod_app.dart new file mode 100644 index 000000000..2ec26b5be --- /dev/null +++ b/lib/app/view/mobile_musicpod_app.dart @@ -0,0 +1,102 @@ +import '../../common/view/theme.dart'; +import '../../constants.dart'; +import '../../external_path/external_path_service.dart'; +import '../../l10n/l10n.dart'; +import '../../library/library_model.dart'; +import '../../radio/radio_model.dart'; +import '../../settings/settings_model.dart'; +import '../connectivity_model.dart'; +import 'dart:ui'; +import 'master_items.dart'; +import 'mobile_page_with_player.dart'; +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:phoenix_theme/phoenix_theme.dart'; +import 'package:watch_it/watch_it.dart'; +import 'package:yaru/yaru.dart'; +import 'splash_screen.dart'; + +class MobileMusicPodApp extends StatefulWidget with WatchItStatefulWidgetMixin { + const MobileMusicPodApp({super.key, this.accent}); + + final Color? accent; + + @override + State createState() => _MobileMusicPodAppState(); +} + +class _MobileMusicPodAppState extends State { + late Future _initFuture; + + @override + void initState() { + super.initState(); + _initFuture = _init(); + } + + Future _init() async { + await di().init(); + await di().init(); + await di().init(); + if (!mounted) return false; + di().init(); + return true; + } + + @override + Widget build(BuildContext context) { + final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex); + final phoenix = phoenixTheme(color: widget.accent ?? Colors.greenAccent); + + final libraryModel = watchIt(); + final masterItems = createMasterItems(libraryModel: libraryModel); + + return MaterialApp( + navigatorKey: libraryModel.masterNavigatorKey, + navigatorObservers: [libraryModel], + initialRoute: + isMobile ? (libraryModel.selectedPageId ?? kLocalAudioPageId) : null, + onGenerateRoute: (settings) { + final page = (masterItems.firstWhereOrNull( + (e) => e.pageId == settings.name, + ) ?? + masterItems.elementAt(0)) + .pageBuilder(context); + + return PageRouteBuilder( + settings: settings, + pageBuilder: (_, __, ___) => FutureBuilder( + future: _initFuture, + builder: (context, snapshot) { + return snapshot.data == true + ? MobilePageWithPlayer(page: page) + : const SplashScreen(); + }, + ), + transitionsBuilder: (_, a, __, c) => + FadeTransition(opacity: a, child: c), + ); + }, + debugShowCheckedModeBanner: false, + themeMode: ThemeMode.values[themeIndex], + theme: phoenix.lightTheme.copyWith( + navigationBarTheme: navigationBarTheme(theme: phoenix.lightTheme), + ), + darkTheme: phoenix.darkTheme.copyWith( + navigationBarTheme: navigationBarTheme(theme: phoenix.darkTheme), + ), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: supportedLocales, + onGenerateTitle: (context) => kAppTitle, + scrollBehavior: const MaterialScrollBehavior().copyWith( + dragDevices: { + PointerDeviceKind.mouse, + PointerDeviceKind.touch, + PointerDeviceKind.stylus, + PointerDeviceKind.unknown, + PointerDeviceKind.trackpad, + }, + ), + ); + } +} diff --git a/lib/app/view/mobile_page_with_player.dart b/lib/app/view/mobile_page_with_player.dart new file mode 100644 index 000000000..2c287b8ab --- /dev/null +++ b/lib/app/view/mobile_page_with_player.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:watch_it/watch_it.dart'; + +import '../../extensions/build_context_x.dart'; +import '../../player/view/full_height_player.dart'; +import '../../player/view/player_view.dart'; +import '../app_model.dart'; +import 'mobile_bottom_bar.dart'; + +class MobilePageWithPlayer extends StatelessWidget with WatchItMixin { + const MobilePageWithPlayer({ + super.key, + required this.page, + }); + + final Widget page; + + @override + Widget build(BuildContext context) { + final fullWindowMode = + watchPropertyValue((AppModel m) => m.fullWindowMode) ?? false; + + return Material( + color: context.theme.scaffoldBackgroundColor, + child: Stack( + fit: StackFit.expand, + children: [ + page, + if (fullWindowMode) + const Scaffold( + extendBody: true, + extendBodyBehindAppBar: true, + body: FullHeightPlayer( + playerPosition: PlayerPosition.fullWindow, + ), + ) + else + const Positioned( + bottom: 0, + child: MobileBottomBar(), + ), + ], + ), + ); + } +} diff --git a/lib/app/view/music_pod_scaffold.dart b/lib/app/view/music_pod_scaffold.dart deleted file mode 100644 index 4757ae7cc..000000000 --- a/lib/app/view/music_pod_scaffold.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:yaru/yaru.dart'; - -import 'mobile_navigation_bar.dart'; - -class MusicPodScaffold extends StatelessWidget { - const MusicPodScaffold({super.key, required this.body, this.appBar}); - - final Widget body; - final PreferredSizeWidget? appBar; - - @override - Widget build(BuildContext context) => Scaffold( - resizeToAvoidBottomInset: isMobile ? false : null, - body: body, - appBar: appBar, - bottomNavigationBar: - isMobile ? const MobilePlayerAndNavigationBar() : null, - ); -} diff --git a/lib/app_config.dart b/lib/app_config.dart index 47077232e..de7b23ce9 100644 --- a/lib/app_config.dart +++ b/lib/app_config.dart @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart'; // TODO(#946): make discord work inside the snap // or leave it for linux disabled if this won't work -bool allowDiscordRPC = kDebugMode || +bool allowDiscordRPC = (kDebugMode && !Platform.isAndroid) || Platform.isMacOS || Platform.isWindows || bool.tryParse(const String.fromEnvironment('ALLOW_DISCORD_RPC')) == true; diff --git a/lib/common/view/sliver_audio_page.dart b/lib/common/view/sliver_audio_page.dart index 46b3d43fb..bab1e72d5 100644 --- a/lib/common/view/sliver_audio_page.dart +++ b/lib/common/view/sliver_audio_page.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../constants.dart'; import '../../library/library_model.dart'; import '../../search/search_model.dart'; @@ -59,7 +58,7 @@ class SliverAudioPage extends StatelessWidget { @override Widget build(BuildContext context) { - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/common/view/theme.dart b/lib/common/view/theme.dart index 42294ae84..8607c60ab 100644 --- a/lib/common/view/theme.dart +++ b/lib/common/view/theme.dart @@ -281,7 +281,9 @@ double get inputHeight => isMobile double get audioCardDimension => kAudioCardDimension - (isMobile ? 15 : 0); -double get bottomPlayerHeight => isMobile ? 75.0 : 90.0; +double get bottomPlayerHeight => isMobile ? 76.0 : 90.0; + +double get navigationBarHeight => bottomPlayerHeight - 25; NavigationBarThemeData navigationBarTheme({required ThemeData theme}) => theme.navigationBarTheme.copyWith( diff --git a/lib/local_audio/view/artist_page.dart b/lib/local_audio/view/artist_page.dart index 813dd3cdd..d2758f58b 100644 --- a/lib/local_audio/view/artist_page.dart +++ b/lib/local_audio/view/artist_page.dart @@ -2,7 +2,6 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; @@ -70,7 +69,7 @@ class ArtistPage extends StatelessWidget with WatchItMixin { pageId: text, ); - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/local_audio/view/genre_page.dart b/lib/local_audio/view/genre_page.dart index aa18fdd71..4f20c066b 100644 --- a/lib/local_audio/view/genre_page.dart +++ b/lib/local_audio/view/genre_page.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:radio_browser_api/radio_browser_api.dart' hide State; import 'package:watch_it/watch_it.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; import '../../common/view/header_bar.dart'; @@ -45,7 +44,7 @@ class _GenrePageState extends State { @override Widget build(BuildContext context) { - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, titleSpacing: 0, diff --git a/lib/local_audio/view/local_audio_page.dart b/lib/local_audio/view/local_audio_page.dart index 700f3c15b..c974e6fef 100644 --- a/lib/local_audio/view/local_audio_page.dart +++ b/lib/local_audio/view/local_audio_page.dart @@ -2,7 +2,6 @@ import 'package:animated_emoji/animated_emoji.dart'; import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; import '../../common/view/header_bar.dart'; @@ -58,7 +57,7 @@ class _LocalAudioPageState extends State { final index = watchPropertyValue((LocalAudioModel m) => m.localAudioindex); final localAudioView = LocalAudioView.values[index]; - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, titleSpacing: 0, diff --git a/lib/main.dart b/lib/main.dart index fa1f480fc..120a1c176 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,7 +7,6 @@ import 'package:yaru/yaru.dart'; import 'app/view/app.dart'; import 'app_config.dart'; -import 'persistence_utils.dart'; import 'register.dart'; Future main(List args) async { @@ -27,10 +26,7 @@ Future main(List args) async { MediaKit.ensureInitialized(); - await registerDependencies( - args: args, - downloadsDefaultDir: await getDownloadsDefaultDir(), - ); + await registerDependencies(args: args); runApp( isGtkApp diff --git a/lib/playlists/view/playlist_page.dart b/lib/playlists/view/playlist_page.dart index 9496c25ca..1edce80f5 100644 --- a/lib/playlists/view/playlist_page.dart +++ b/lib/playlists/view/playlist_page.dart @@ -6,7 +6,6 @@ import 'package:flutter/material.dart'; import 'package:super_drag_and_drop/super_drag_and_drop.dart'; import 'package:watch_it/watch_it.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; @@ -90,7 +89,7 @@ class PlaylistPage extends StatelessWidget with WatchItMixin { return DropOperation.none; } }, - child: MusicPodScaffold( + child: Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/podcasts/view/podcast_page.dart b/lib/podcasts/view/podcast_page.dart index 88816303a..52ea994b4 100644 --- a/lib/podcasts/view/podcast_page.dart +++ b/lib/podcasts/view/podcast_page.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; @@ -101,7 +100,7 @@ class _PodcastPageState extends State { .map((e) => e.copyWith(path: libraryModel.getDownload(e.url))) .toList(); - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/podcasts/view/podcasts_page.dart b/lib/podcasts/view/podcasts_page.dart index e70933f18..29ded35a0 100644 --- a/lib/podcasts/view/podcasts_page.dart +++ b/lib/podcasts/view/podcasts_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/header_bar.dart'; import '../../common/view/search_button.dart'; @@ -34,7 +33,7 @@ class _PodcastsPageState extends State { @override Widget build(BuildContext context) { - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( titleSpacing: 0, adaptive: true, diff --git a/lib/radio/view/radio_page.dart b/lib/radio/view/radio_page.dart index fd7bd9203..1f7095551 100644 --- a/lib/radio/view/radio_page.dart +++ b/lib/radio/view/radio_page.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import '../../app/connectivity_model.dart'; -import '../../app/view/music_pod_scaffold.dart'; + import '../../common/data/audio_type.dart'; import '../../common/view/header_bar.dart'; import '../../common/view/offline_page.dart'; @@ -23,7 +23,7 @@ class RadioPage extends StatelessWidget with WatchItMixin { final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline); if (!isOnline) return const OfflinePage(); - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/radio/view/station_page.dart b/lib/radio/view/station_page.dart index 1a287f516..e92991240 100644 --- a/lib/radio/view/station_page.dart +++ b/lib/radio/view/station_page.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import '../../app/connectivity_model.dart'; -import '../../app/view/music_pod_scaffold.dart'; + import '../../common/data/audio.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; @@ -39,7 +39,7 @@ class StationPage extends StatelessWidget with WatchItMixin { final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline); if (!isOnline) return const OfflinePage(); - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, actions: [ diff --git a/lib/register.dart b/lib/register.dart index 5b479e04b..cb8409a73 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -26,6 +26,7 @@ import 'package:media_kit/media_kit.dart'; import 'package:media_kit_video/media_kit_video.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:watch_it/watch_it.dart'; +import 'persistence_utils.dart'; import 'player/player_model.dart'; import 'player/player_service.dart'; import 'podcasts/download_model.dart'; @@ -42,10 +43,7 @@ import 'settings/settings_service.dart'; /// Registers all Services, ViewModels and external dependencies /// Note: we want lazy registration whenever possible, preferable without any async calls above. /// Sometimes this is not possible and we need to await a Future before we can register. -Future registerDependencies({ - required List args, - required String? downloadsDefaultDir, -}) async { +Future registerDependencies({required List args}) async { if (allowDiscordRPC) { await FlutterDiscordRPC.initialize(kDiscordApplicationId); di.registerSingleton( @@ -57,6 +55,7 @@ Future registerDependencies({ ); } + final String? downloadsDefaultDir = await getDownloadsDefaultDir(); final sharedPreferences = await SharedPreferences.getInstance(); final packageInfo = await PackageInfo.fromPlatform(); diff --git a/lib/search/view/search_page.dart b/lib/search/view/search_page.dart index aa4784b6c..5a5d2e76d 100644 --- a/lib/search/view/search_page.dart +++ b/lib/search/view/search_page.dart @@ -5,7 +5,6 @@ import 'package:flutter/rendering.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/theme.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../app_config.dart'; import '../../common/data/audio_type.dart'; import '../../common/view/adaptive_container.dart'; @@ -32,7 +31,7 @@ class SearchPage extends StatelessWidget with WatchItMixin { final audioType = watchPropertyValue((SearchModel m) => m.audioType); final loading = watchPropertyValue((SearchModel m) => m.loading); - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: true, title: Padding( diff --git a/lib/settings/view/about_page.dart b/lib/settings/view/about_page.dart index 75d2128bd..7d9951875 100644 --- a/lib/settings/view/about_page.dart +++ b/lib/settings/view/about_page.dart @@ -5,7 +5,7 @@ import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; import '../../app/app_model.dart'; -import '../../app/view/music_pod_scaffold.dart'; + import '../../common/view/header_bar.dart'; import '../../common/view/progress.dart'; import '../../common/view/safe_network_image.dart'; @@ -180,7 +180,7 @@ class _AboutPageState extends State { final title = Text('${context.l10n.about} $kAppTitle'); if (isMobile) { - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: false, title: title, diff --git a/lib/settings/view/settings_page.dart b/lib/settings/view/settings_page.dart index b7941d837..e507cff2c 100644 --- a/lib/settings/view/settings_page.dart +++ b/lib/settings/view/settings_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:yaru/yaru.dart'; -import '../../app/view/music_pod_scaffold.dart'; import '../../common/view/header_bar.dart'; import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; @@ -26,7 +25,7 @@ class SettingsPage extends StatelessWidget { ], ); if (isMobile) { - return MusicPodScaffold( + return Scaffold( appBar: HeaderBar( adaptive: false, title: Text(context.l10n.settings), diff --git a/needs_translation.json b/needs_translation.json index 9b63a3ff4..822b80d14 100644 --- a/needs_translation.json +++ b/needs_translation.json @@ -3224,43 +3224,6 @@ "regionZimbabwe" ], - "sv": [ - "shuffle", - "repeat", - "repeatAll", - "next", - "back", - "fastForward30", - "rewind10", - "fullWindow", - "leaveFullWindow", - "fullScreen", - "leaveFullScreen", - "playbackRate", - "addToFavorites", - "removeFromFavorites", - "share", - "local", - "genre", - "year", - "albumArtist", - "albumArtists", - "track", - "trackNumber", - "diskNumber", - "totalDisks", - "noPodcastSubsFound", - "charts", - "noStarredStations", - "stations", - "copyToClipBoard", - "insertedIntoQueue", - "exposeToListenBrainzTitle", - "exposeToListenBrainzSubTitle", - "listenBrainzApiKey", - "listenBrainzApiKeyEmpty" - ], - "tr": [ "local", "saveAndAuthorize",