-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mobile debug and full height player not full height on mobile
- Loading branch information
1 parent
09994f8
commit acb910a
Showing
24 changed files
with
323 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<DesktopMusicPodApp> createState() => _DesktopMusicPodAppState(); | ||
} | ||
|
||
class _DesktopMusicPodAppState extends State<DesktopMusicPodApp> { | ||
late Future<bool> _initFuture; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_initFuture = _init(); | ||
} | ||
|
||
Future<bool> _init() async { | ||
await di<ConnectivityModel>().init(); | ||
await di<LibraryModel>().init(); | ||
await di<RadioModel>().init(); | ||
if (!mounted) return false; | ||
di<ExternalPathService>().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, | ||
}, | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.