mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
Settings & PlayerControls adjusted for ultrawide/4k screens
This commit is contained in:
parent
a7b3073539
commit
d2b4a81029
@ -131,7 +131,7 @@ class Player extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(child: PlayerTrackDetails(albumArt: albumArt)),
|
Expanded(child: PlayerTrackDetails(albumArt: albumArt)),
|
||||||
// controls
|
// controls
|
||||||
Expanded(
|
Flexible(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: PlayerControls(),
|
child: PlayerControls(),
|
||||||
),
|
),
|
||||||
|
@ -43,7 +43,7 @@ class PlayerControls extends HookConsumerWidget {
|
|||||||
final duration = _duration.value ?? Duration.zero;
|
final duration = _duration.value ?? Duration.zero;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints(maxWidth: 700),
|
constraints: const BoxConstraints(maxWidth: 600),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
StreamBuilder<Duration>(
|
StreamBuilder<Duration>(
|
||||||
|
@ -42,245 +42,256 @@ class Settings extends HookConsumerWidget {
|
|||||||
style: Theme.of(context).textTheme.headline5,
|
style: Theme.of(context).textTheme.headline5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Row(
|
||||||
padding: const EdgeInsets.all(16.0),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
Flexible(
|
||||||
Row(
|
child: Container(
|
||||||
children: [
|
constraints: const BoxConstraints(maxWidth: 1366),
|
||||||
Expanded(
|
child: Padding(
|
||||||
flex: 2,
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Text(
|
child: Column(
|
||||||
"Genius Access Token",
|
|
||||||
style: Theme.of(context).textTheme.subtitle1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: TextField(
|
|
||||||
controller: geniusTokenController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: preferences.geniusAccessToken,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: geniusAccessToken.value != null
|
|
||||||
? () async {
|
|
||||||
SharedPreferences localStorage =
|
|
||||||
await SharedPreferences.getInstance();
|
|
||||||
if (geniusAccessToken.value != null &&
|
|
||||||
geniusAccessToken.value!.isNotEmpty) {
|
|
||||||
preferences.setGeniusAccessToken(
|
|
||||||
geniusAccessToken.value!,
|
|
||||||
);
|
|
||||||
localStorage.setString(
|
|
||||||
LocalStorageKeys.geniusAccessToken,
|
|
||||||
geniusAccessToken.value!);
|
|
||||||
}
|
|
||||||
|
|
||||||
geniusAccessToken.value = null;
|
|
||||||
geniusTokenController.text = "";
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
child: const Text("Save"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
if (!Platform.isAndroid && !Platform.isIOS) ...[
|
|
||||||
SettingsHotKeyTile(
|
|
||||||
title: "Next track global shortcut",
|
|
||||||
currentHotKey: preferences.nextTrackHotKey,
|
|
||||||
onHotKeyRecorded: (value) {
|
|
||||||
preferences.setNextTrackHotKey(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsHotKeyTile(
|
|
||||||
title: "Prev track global shortcut",
|
|
||||||
currentHotKey: preferences.prevTrackHotKey,
|
|
||||||
onHotKeyRecorded: (value) {
|
|
||||||
preferences.setPrevTrackHotKey(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsHotKeyTile(
|
|
||||||
title: "Play/Pause global shortcut",
|
|
||||||
currentHotKey: preferences.playPauseHotKey,
|
|
||||||
onHotKeyRecorded: (value) {
|
|
||||||
preferences.setPlayPauseHotKey(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Text("Theme"),
|
|
||||||
DropdownButton<ThemeMode>(
|
|
||||||
value: preferences.themeMode,
|
|
||||||
items: const [
|
|
||||||
DropdownMenuItem(
|
|
||||||
child: Text(
|
|
||||||
"Dark",
|
|
||||||
),
|
|
||||||
value: ThemeMode.dark,
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
child: Text(
|
|
||||||
"Light",
|
|
||||||
),
|
|
||||||
value: ThemeMode.light,
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
child: Text("System"),
|
|
||||||
value: ThemeMode.system,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value != null) {
|
|
||||||
preferences.setThemeMode(value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Text("Market Place (Recommendation Country)"),
|
|
||||||
DropdownButton(
|
|
||||||
value: preferences.recommendationMarket,
|
|
||||||
items: spotifyMarkets
|
|
||||||
.map((country) => (DropdownMenuItem(
|
|
||||||
child: Text(country),
|
|
||||||
value: country,
|
|
||||||
)))
|
|
||||||
.toList(),
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value == null) return;
|
|
||||||
preferences.setRecommendationMarket(value as String);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Text("Download lyrics along with the Track"),
|
|
||||||
Switch.adaptive(
|
|
||||||
value: preferences.saveTrackLyrics,
|
|
||||||
onChanged: (state) {
|
|
||||||
preferences.setSaveTrackLyrics(state);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
"Format of the YouTube Search term (Case sensitive)"),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: TextField(
|
|
||||||
controller: ytSearchFormatController,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
if (auth.isAnonymous)
|
|
||||||
Wrap(
|
|
||||||
spacing: 20,
|
|
||||||
runSpacing: 20,
|
|
||||||
alignment: WrapAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Text("Login with your Spotify account"),
|
|
||||||
ElevatedButton(
|
|
||||||
child: Text("Connect with Spotify".toUpperCase()),
|
|
||||||
onPressed: () {
|
|
||||||
GoRouter.of(context).push("/login");
|
|
||||||
},
|
|
||||||
style: ButtonStyle(
|
|
||||||
shape: MaterialStateProperty.all(
|
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (auth.isLoggedIn)
|
|
||||||
Builder(builder: (context) {
|
|
||||||
Auth auth = ref.watch(authProvider);
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
const Text("Log out of this account"),
|
Row(
|
||||||
ElevatedButton(
|
children: [
|
||||||
child: const Text("Logout"),
|
Expanded(
|
||||||
style: ButtonStyle(
|
flex: 2,
|
||||||
backgroundColor:
|
child: Text(
|
||||||
MaterialStateProperty.all(Colors.red),
|
"Genius Access Token",
|
||||||
),
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
onPressed: () async {
|
),
|
||||||
SharedPreferences localStorage =
|
),
|
||||||
await SharedPreferences.getInstance();
|
Expanded(
|
||||||
await localStorage.clear();
|
flex: 1,
|
||||||
auth.logout();
|
child: TextField(
|
||||||
GoRouter.of(context).pop();
|
controller: geniusTokenController,
|
||||||
},
|
decoration: InputDecoration(
|
||||||
|
hintText: preferences.geniusAccessToken,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: geniusAccessToken.value != null
|
||||||
|
? () async {
|
||||||
|
SharedPreferences localStorage =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
if (geniusAccessToken.value != null &&
|
||||||
|
geniusAccessToken.value!.isNotEmpty) {
|
||||||
|
preferences.setGeniusAccessToken(
|
||||||
|
geniusAccessToken.value!,
|
||||||
|
);
|
||||||
|
localStorage.setString(
|
||||||
|
LocalStorageKeys.geniusAccessToken,
|
||||||
|
geniusAccessToken.value!);
|
||||||
|
}
|
||||||
|
|
||||||
|
geniusAccessToken.value = null;
|
||||||
|
geniusTokenController.text = "";
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: const Text("Save"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) ...[
|
||||||
|
SettingsHotKeyTile(
|
||||||
|
title: "Next track global shortcut",
|
||||||
|
currentHotKey: preferences.nextTrackHotKey,
|
||||||
|
onHotKeyRecorded: (value) {
|
||||||
|
preferences.setNextTrackHotKey(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsHotKeyTile(
|
||||||
|
title: "Prev track global shortcut",
|
||||||
|
currentHotKey: preferences.prevTrackHotKey,
|
||||||
|
onHotKeyRecorded: (value) {
|
||||||
|
preferences.setPrevTrackHotKey(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsHotKeyTile(
|
||||||
|
title: "Play/Pause global shortcut",
|
||||||
|
currentHotKey: preferences.playPauseHotKey,
|
||||||
|
onHotKeyRecorded: (value) {
|
||||||
|
preferences.setPlayPauseHotKey(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text("Theme"),
|
||||||
|
DropdownButton<ThemeMode>(
|
||||||
|
value: preferences.themeMode,
|
||||||
|
items: const [
|
||||||
|
DropdownMenuItem(
|
||||||
|
child: Text(
|
||||||
|
"Dark",
|
||||||
|
),
|
||||||
|
value: ThemeMode.dark,
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
child: Text(
|
||||||
|
"Light",
|
||||||
|
),
|
||||||
|
value: ThemeMode.light,
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
child: Text("System"),
|
||||||
|
value: ThemeMode.system,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value != null) {
|
||||||
|
preferences.setThemeMode(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text("Market Place (Recommendation Country)"),
|
||||||
|
DropdownButton(
|
||||||
|
value: preferences.recommendationMarket,
|
||||||
|
items: spotifyMarkets
|
||||||
|
.map((country) => (DropdownMenuItem(
|
||||||
|
child: Text(country),
|
||||||
|
value: country,
|
||||||
|
)))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value == null) return;
|
||||||
|
preferences
|
||||||
|
.setRecommendationMarket(value as String);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text("Download lyrics along with the Track"),
|
||||||
|
Switch.adaptive(
|
||||||
|
value: preferences.saveTrackLyrics,
|
||||||
|
onChanged: (state) {
|
||||||
|
preferences.setSaveTrackLyrics(state);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text(
|
||||||
|
"Format of the YouTube Search term (Case sensitive)"),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: TextField(
|
||||||
|
controller: ytSearchFormatController,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
if (auth.isAnonymous)
|
||||||
|
Wrap(
|
||||||
|
spacing: 20,
|
||||||
|
runSpacing: 20,
|
||||||
|
alignment: WrapAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Text("Login with your Spotify account"),
|
||||||
|
ElevatedButton(
|
||||||
|
child: Text("Connect with Spotify".toUpperCase()),
|
||||||
|
onPressed: () {
|
||||||
|
GoRouter.of(context).push("/login");
|
||||||
|
},
|
||||||
|
style: ButtonStyle(
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (auth.isLoggedIn)
|
||||||
|
Builder(builder: (context) {
|
||||||
|
Auth auth = ref.watch(authProvider);
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text("Log out of this account"),
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text("Logout"),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.all(Colors.red),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
SharedPreferences localStorage =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
await localStorage.clear();
|
||||||
|
auth.logout();
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
const Text("Spotube v2.0.0"),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text("Author: "),
|
||||||
|
Hyperlink(
|
||||||
|
"Kingkor Roy Tirtho",
|
||||||
|
"https://github.com/KRTirtho",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Hyperlink(
|
||||||
|
"💚 Sponsor/Donate 💚",
|
||||||
|
"https://opencollective.com/spotube",
|
||||||
|
),
|
||||||
|
Text(" • "),
|
||||||
|
Hyperlink(
|
||||||
|
"BSD-4-Clause LICENSE",
|
||||||
|
"https://github.com/KRTirtho/spotube/blob/master/LICENSE",
|
||||||
|
),
|
||||||
|
Text(" • "),
|
||||||
|
Hyperlink(
|
||||||
|
"Bug Report",
|
||||||
|
"https://github.com/KRTirtho/spotube/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Text("© Spotube 2022. All rights reserved")
|
||||||
],
|
],
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 40),
|
|
||||||
const Text("Spotube v2.0.0"),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: const [
|
|
||||||
Text("Author: "),
|
|
||||||
Hyperlink(
|
|
||||||
"Kingkor Roy Tirtho",
|
|
||||||
"https://github.com/KRTirtho",
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
Wrap(
|
],
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: const [
|
|
||||||
Hyperlink(
|
|
||||||
"💚 Sponsor/Donate 💚",
|
|
||||||
"https://opencollective.com/spotube",
|
|
||||||
),
|
|
||||||
Text(" • "),
|
|
||||||
Hyperlink(
|
|
||||||
"BSD-4-Clause LICENSE",
|
|
||||||
"https://github.com/KRTirtho/spotube/blob/master/LICENSE",
|
|
||||||
),
|
|
||||||
Text(" • "),
|
|
||||||
Hyperlink(
|
|
||||||
"Bug Report",
|
|
||||||
"https://github.com/KRTirtho/spotube/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
const Text("© Spotube 2022. All rights reserved")
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -29,6 +29,7 @@ void main() async {
|
|||||||
appWindow.size = const Size(900, 700);
|
appWindow.size = const Size(900, 700);
|
||||||
appWindow.alignment = Alignment.center;
|
appWindow.alignment = Alignment.center;
|
||||||
appWindow.maximize();
|
appWindow.maximize();
|
||||||
|
appWindow.title = "Spotube";
|
||||||
appWindow.show();
|
appWindow.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,7 @@ class UserPreferences extends ChangeNotifier {
|
|||||||
void setRecommendationMarket(String country) {
|
void setRecommendationMarket(String country) {
|
||||||
recommendationMarket = country;
|
recommendationMarket = country;
|
||||||
localStorage?.setString(LocalStorageKeys.recommendationMarket, country);
|
localStorage?.setString(LocalStorageKeys.recommendationMarket, country);
|
||||||
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGeniusAccessToken(String token) {
|
void setGeniusAccessToken(String token) {
|
||||||
|
Loading…
Reference in New Issue
Block a user