mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
feat: change default platform option and platform specific back button
This commit is contained in:
parent
5e96913ba3
commit
36c5e02f18
@ -55,7 +55,7 @@ class ArtistProfile extends HookConsumerWidget {
|
||||
return SafeArea(
|
||||
child: PlatformScaffold(
|
||||
appBar: const PageWindowTitleBar(
|
||||
leading: BackButton(),
|
||||
leading: PlatformBackButton(),
|
||||
),
|
||||
body: HookBuilder(
|
||||
builder: (context) {
|
||||
|
@ -16,7 +16,7 @@ class TokenLogin extends HookConsumerWidget {
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: const PageWindowTitleBar(leading: BackButton()),
|
||||
appBar: const PageWindowTitleBar(leading: PlatformBackButton()),
|
||||
body: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Container(
|
||||
|
@ -75,7 +75,7 @@ class PlayerView extends HookConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
PageWindowTitleBar(
|
||||
leading: const BackButton(),
|
||||
leading: const PlatformBackButton(),
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: paletteColor.titleTextColor,
|
||||
),
|
||||
|
@ -21,7 +21,7 @@ class PlaylistGenreView extends ConsumerWidget {
|
||||
Widget build(BuildContext context, ref) {
|
||||
return Scaffold(
|
||||
appBar: const PageWindowTitleBar(
|
||||
leading: BackButton(),
|
||||
leading: PlatformBackButton(),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
|
@ -10,6 +10,7 @@ import 'package:spotube/components/Settings/ColorSchemePickerDialog.dart';
|
||||
import 'package:spotube/components/Shared/AdaptiveListTile.dart';
|
||||
import 'package:spotube/components/Shared/PageWindowTitleBar.dart';
|
||||
import 'package:spotube/hooks/useBreakpoints.dart';
|
||||
import 'package:spotube/main.dart';
|
||||
import 'package:spotube/models/SpotifyMarkets.dart';
|
||||
import 'package:spotube/models/SpotubeTrack.dart';
|
||||
import 'package:spotube/provider/Auth.dart';
|
||||
@ -204,6 +205,42 @@ class Settings extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
AdaptiveListTile(
|
||||
leading: const Icon(Icons.ad_units_rounded),
|
||||
title: const PlatformText("Mimic Platform"),
|
||||
trailing: (context, update) =>
|
||||
PlatformDropDownMenu<TargetPlatform>(
|
||||
value: Spotube.of(context).appPlatform,
|
||||
items: [
|
||||
PlatformDropDownMenuItem(
|
||||
value: TargetPlatform.android,
|
||||
child: const PlatformText("Android (Material You)"),
|
||||
),
|
||||
PlatformDropDownMenuItem(
|
||||
value: TargetPlatform.iOS,
|
||||
child: const PlatformText("iOS (Cupertino)"),
|
||||
),
|
||||
PlatformDropDownMenuItem(
|
||||
value: TargetPlatform.macOS,
|
||||
child: const PlatformText("macOS (Aqua)"),
|
||||
),
|
||||
PlatformDropDownMenuItem(
|
||||
value: TargetPlatform.linux,
|
||||
child: const PlatformText("Linux (GTK+Libadwaita)"),
|
||||
),
|
||||
PlatformDropDownMenuItem(
|
||||
value: TargetPlatform.windows,
|
||||
child: const PlatformText("Windows 11 (Fluent UI)"),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
Spotube.of(context).changePlatform(value);
|
||||
update?.call(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
PlatformListTile(
|
||||
leading: const Icon(Icons.palette_outlined),
|
||||
title: const PlatformText("Accent Color Scheme"),
|
||||
|
@ -37,6 +37,7 @@ class AdaptiveListTile extends HookWidget {
|
||||
onTap?.call();
|
||||
showPlatformAlertDialog(
|
||||
context,
|
||||
barrierDismissible: true,
|
||||
builder: (context) {
|
||||
return StatefulBuilder(builder: (context, update) {
|
||||
return PlatformAlertDialog(
|
||||
|
@ -115,7 +115,9 @@ class TrackCollectionView<T> extends HookConsumerWidget {
|
||||
backgroundColor: color?.color,
|
||||
foregroundColor: color?.titleTextColor,
|
||||
leading: Row(
|
||||
children: [BackButton(color: color?.titleTextColor)],
|
||||
children: [
|
||||
PlatformBackButton(color: color?.titleTextColor)
|
||||
],
|
||||
),
|
||||
)
|
||||
: null,
|
||||
|
@ -141,6 +141,11 @@ class Spotube extends StatefulHookConsumerWidget {
|
||||
|
||||
@override
|
||||
SpotubeState createState() => SpotubeState();
|
||||
|
||||
/// ↓↓ ADDED
|
||||
/// InheritedWidget style accessor to our State object.
|
||||
static SpotubeState of(BuildContext context) =>
|
||||
context.findAncestorStateOfType<SpotubeState>()!;
|
||||
}
|
||||
|
||||
class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
|
||||
@ -181,6 +186,13 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
|
||||
prevSize = appWindow.size;
|
||||
}
|
||||
|
||||
TargetPlatform appPlatform = TargetPlatform.android;
|
||||
|
||||
void changePlatform(TargetPlatform targetPlatform) {
|
||||
appPlatform = targetPlatform;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeMode =
|
||||
@ -199,7 +211,7 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
|
||||
};
|
||||
}, []);
|
||||
|
||||
platform = TargetPlatform.macOS;
|
||||
platform = appPlatform;
|
||||
|
||||
return PlatformApp.router(
|
||||
routeInformationParser: router.routeInformationParser,
|
||||
|
Loading…
Reference in New Issue
Block a user