mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
Organized Settings With Headers
Settings are now organized into headers. Account and donations have been moved to the top to improve the experience of first time users.
This commit is contained in:
parent
3b24018bba
commit
b179d2a945
@ -63,6 +63,95 @@ class Settings extends HookConsumerWidget {
|
|||||||
constraints: const BoxConstraints(maxWidth: 1366),
|
constraints: const BoxConstraints(maxWidth: 1366),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
|
AdaptiveListTile(
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.favorite_border_rounded,
|
||||||
|
color: Colors.pink,
|
||||||
|
),
|
||||||
|
title: const AutoSizeText(
|
||||||
|
"We know you Love Spotube",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.pink,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: (context, update) => ElevatedButton.icon(
|
||||||
|
icon: const Icon(Icons.favorite_outline_rounded),
|
||||||
|
label: const Text("Please Sponsor/Donate"),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.red[100],
|
||||||
|
onPrimary: Colors.pinkAccent,
|
||||||
|
padding: const EdgeInsets.all(15),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://opencollective.com/spotube",
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
" Account",
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
|
),
|
||||||
|
if (auth.isAnonymous)
|
||||||
|
AdaptiveListTile(
|
||||||
|
leading: Icon(
|
||||||
|
Icons.login_rounded,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
title: AutoSizeText(
|
||||||
|
"Login with your Spotify account",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: (context, update) => 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 ListTile(
|
||||||
|
leading: const Icon(Icons.logout_rounded),
|
||||||
|
title: const AutoSizeText(
|
||||||
|
"Log out of this account",
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
trailing: ElevatedButton(
|
||||||
|
child: const Text("Logout"),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.all(Colors.red),
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(Colors.white),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
auth.logout();
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const Text(
|
||||||
|
" Appearance",
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
|
),
|
||||||
AdaptiveListTile(
|
AdaptiveListTile(
|
||||||
leading: const Icon(Icons.dark_mode_outlined),
|
leading: const Icon(Icons.dark_mode_outlined),
|
||||||
title: const Text("Theme"),
|
title: const Text("Theme"),
|
||||||
@ -122,6 +211,55 @@ class Settings extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
onTap: pickColorScheme(ColorSchemeType.background),
|
onTap: pickColorScheme(ColorSchemeType.background),
|
||||||
),
|
),
|
||||||
|
const Text(
|
||||||
|
" Playback",
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
|
),
|
||||||
|
AdaptiveListTile(
|
||||||
|
leading: const Icon(Icons.multitrack_audio_rounded),
|
||||||
|
title: const Text("Audio Quality"),
|
||||||
|
trailing: (context, update) =>
|
||||||
|
DropdownButton<AudioQuality>(
|
||||||
|
value: preferences.audioQuality,
|
||||||
|
items: const [
|
||||||
|
DropdownMenuItem(
|
||||||
|
child: Text(
|
||||||
|
"High",
|
||||||
|
),
|
||||||
|
value: AudioQuality.high,
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
child: Text("Low"),
|
||||||
|
value: AudioQuality.low,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value != null) {
|
||||||
|
preferences.setAudioQuality(value);
|
||||||
|
update?.call(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.fast_forward_rounded),
|
||||||
|
title: const Text(
|
||||||
|
"Skip non-music segments (SponsorBlock)",
|
||||||
|
),
|
||||||
|
trailing: Switch.adaptive(
|
||||||
|
activeColor: Theme.of(context).primaryColor,
|
||||||
|
value: preferences.skipSponsorSegments,
|
||||||
|
onChanged: (state) {
|
||||||
|
preferences.setSkipSponsorSegments(state);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
" Search",
|
||||||
|
style:
|
||||||
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
|
),
|
||||||
AdaptiveListTile(
|
AdaptiveListTile(
|
||||||
leading: const Icon(Icons.shopping_bag_rounded),
|
leading: const Icon(Icons.shopping_bag_rounded),
|
||||||
title: Text(
|
title: Text(
|
||||||
@ -155,16 +293,6 @@ class Settings extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.file_download_outlined),
|
|
||||||
title: const Text("Download Location"),
|
|
||||||
subtitle: Text(preferences.downloadLocation),
|
|
||||||
trailing: ElevatedButton(
|
|
||||||
child: const Icon(Icons.folder_rounded),
|
|
||||||
onPressed: pickDownloadLocation,
|
|
||||||
),
|
|
||||||
onTap: pickDownloadLocation,
|
|
||||||
),
|
|
||||||
AdaptiveListTile(
|
AdaptiveListTile(
|
||||||
leading: const Icon(Icons.screen_search_desktop_rounded),
|
leading: const Icon(Icons.screen_search_desktop_rounded),
|
||||||
title: const AutoSizeText(
|
title: const AutoSizeText(
|
||||||
@ -195,66 +323,6 @@ class Settings extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.fast_forward_rounded),
|
|
||||||
title: const Text(
|
|
||||||
"Skip non-music segments (SponsorBlock)",
|
|
||||||
),
|
|
||||||
trailing: Switch.adaptive(
|
|
||||||
activeColor: Theme.of(context).primaryColor,
|
|
||||||
value: preferences.skipSponsorSegments,
|
|
||||||
onChanged: (state) {
|
|
||||||
preferences.setSkipSponsorSegments(state);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.lyrics_rounded),
|
|
||||||
title: const Text("Download lyrics along with the Track"),
|
|
||||||
trailing: Switch.adaptive(
|
|
||||||
activeColor: Theme.of(context).primaryColor,
|
|
||||||
value: preferences.saveTrackLyrics,
|
|
||||||
onChanged: (state) {
|
|
||||||
preferences.setSaveTrackLyrics(state);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (auth.isAnonymous)
|
|
||||||
AdaptiveListTile(
|
|
||||||
leading: Icon(
|
|
||||||
Icons.login_rounded,
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
title: AutoSizeText(
|
|
||||||
"Login with your Spotify account",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: (context, update) => ElevatedButton(
|
|
||||||
child: Text("Connect with Spotify".toUpperCase()),
|
|
||||||
onPressed: () {
|
|
||||||
GoRouter.of(context).push("/login");
|
|
||||||
},
|
|
||||||
style: ButtonStyle(
|
|
||||||
shape: MaterialStateProperty.all(
|
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.update_rounded),
|
|
||||||
title: const Text("Check for Update"),
|
|
||||||
trailing: Switch.adaptive(
|
|
||||||
activeColor: Theme.of(context).primaryColor,
|
|
||||||
value: preferences.checkUpdate,
|
|
||||||
onChanged: (checked) =>
|
|
||||||
preferences.setCheckUpdate(checked),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
AdaptiveListTile(
|
AdaptiveListTile(
|
||||||
leading: const Icon(Icons.low_priority_rounded),
|
leading: const Icon(Icons.low_priority_rounded),
|
||||||
title: const AutoSizeText(
|
title: const AutoSizeText(
|
||||||
@ -290,83 +358,45 @@ class Settings extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AdaptiveListTile(
|
const Text(
|
||||||
leading: const Icon(Icons.multitrack_audio_rounded),
|
" Downloads",
|
||||||
title: const Text("Audio Quality"),
|
style:
|
||||||
trailing: (context, update) =>
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
DropdownButton<AudioQuality>(
|
|
||||||
value: preferences.audioQuality,
|
|
||||||
items: const [
|
|
||||||
DropdownMenuItem(
|
|
||||||
child: Text(
|
|
||||||
"High",
|
|
||||||
),
|
|
||||||
value: AudioQuality.high,
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
child: Text("Low"),
|
|
||||||
value: AudioQuality.low,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value != null) {
|
|
||||||
preferences.setAudioQuality(value);
|
|
||||||
update?.call(() {});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (auth.isLoggedIn)
|
|
||||||
Builder(builder: (context) {
|
|
||||||
Auth auth = ref.watch(authProvider);
|
|
||||||
return ListTile(
|
|
||||||
leading: const Icon(Icons.logout_rounded),
|
|
||||||
title: const AutoSizeText(
|
|
||||||
"Log out of this account",
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.file_download_outlined),
|
||||||
|
title: const Text("Download Location"),
|
||||||
|
subtitle: Text(preferences.downloadLocation),
|
||||||
trailing: ElevatedButton(
|
trailing: ElevatedButton(
|
||||||
child: const Text("Logout"),
|
child: const Icon(Icons.folder_rounded),
|
||||||
style: ButtonStyle(
|
onPressed: pickDownloadLocation,
|
||||||
backgroundColor:
|
|
||||||
MaterialStateProperty.all(Colors.red),
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(Colors.white),
|
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onTap: pickDownloadLocation,
|
||||||
auth.logout();
|
),
|
||||||
GoRouter.of(context).pop();
|
ListTile(
|
||||||
|
leading: const Icon(Icons.lyrics_rounded),
|
||||||
|
title: const Text("Download lyrics along with the Track"),
|
||||||
|
trailing: Switch.adaptive(
|
||||||
|
activeColor: Theme.of(context).primaryColor,
|
||||||
|
value: preferences.saveTrackLyrics,
|
||||||
|
onChanged: (state) {
|
||||||
|
preferences.setSaveTrackLyrics(state);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
|
||||||
}),
|
|
||||||
AdaptiveListTile(
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.favorite_border_rounded,
|
|
||||||
color: Colors.pink,
|
|
||||||
),
|
),
|
||||||
title: const AutoSizeText(
|
const Text(
|
||||||
"We know you Love Spotube",
|
" About",
|
||||||
maxLines: 1,
|
style:
|
||||||
style: TextStyle(
|
TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||||
color: Colors.pink,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
ListTile(
|
||||||
trailing: (context, update) => ElevatedButton.icon(
|
leading: const Icon(Icons.update_rounded),
|
||||||
icon: const Icon(Icons.favorite_outline_rounded),
|
title: const Text("Check for Update"),
|
||||||
label: const Text("Please Sponsor/Donate"),
|
trailing: Switch.adaptive(
|
||||||
style: ElevatedButton.styleFrom(
|
activeColor: Theme.of(context).primaryColor,
|
||||||
primary: Colors.red[100],
|
value: preferences.checkUpdate,
|
||||||
onPrimary: Colors.pinkAccent,
|
onChanged: (checked) =>
|
||||||
padding: const EdgeInsets.all(15),
|
preferences.setCheckUpdate(checked),
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrlString(
|
|
||||||
"https://opencollective.com/spotube",
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const About()
|
const About()
|
||||||
|
Loading…
Reference in New Issue
Block a user