From 80959aa0caf0870c0663714bde86410f584ab9ab Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 7 Apr 2023 10:07:31 +0600 Subject: [PATCH] refactor(settings): use dropdown button instead of dropdown menu for smaller selections --- lib/pages/settings/settings.dart | 57 ++++++++++++++++---------------- pubspec.lock | 17 ++++++++++ pubspec.yaml | 5 +++ 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index e5bb3432..ea7a073f 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -133,23 +133,23 @@ class SettingsPage extends HookConsumerWidget { subtitle: const Text( "Override responsive layout mode settings", ), - trailing: (context, update) => DropdownMenu( - dropdownMenuEntries: const [ - DropdownMenuEntry( + trailing: (context, update) => DropdownButton( + items: const [ + DropdownMenuItem( value: LayoutMode.adaptive, - label: "Adaptive", + child: Text("Adaptive"), ), - DropdownMenuEntry( + DropdownMenuItem( value: LayoutMode.compact, - label: "Compact", + child: Text("Compact"), ), - DropdownMenuEntry( + DropdownMenuItem( value: LayoutMode.extended, - label: "Extended", + child: Text("Extended"), ), ], - initialSelection: preferences.layoutMode, - onSelected: (value) { + value: preferences.layoutMode, + onChanged: (value) { if (value != null) { preferences.setLayoutMode(value); update?.call(() {}); @@ -160,23 +160,23 @@ class SettingsPage extends HookConsumerWidget { AdaptiveListTile( leading: const Icon(SpotubeIcons.darkMode), title: const Text("Theme"), - trailing: (context, update) => DropdownMenu( - initialSelection: preferences.themeMode, - dropdownMenuEntries: const [ - DropdownMenuEntry( + trailing: (context, update) => DropdownButton( + value: preferences.themeMode, + items: const [ + DropdownMenuItem( value: ThemeMode.dark, - label: "Dark", + child: Text("Dark"), ), - DropdownMenuEntry( + DropdownMenuItem( value: ThemeMode.light, - label: "Light", + child: Text("Light"), ), - DropdownMenuEntry( + DropdownMenuItem( value: ThemeMode.system, - label: "System", + child: Text("System"), ), ], - onSelected: (value) { + onChanged: (value) { if (value != null) { preferences.setThemeMode(value); update?.call(() {}); @@ -214,19 +214,20 @@ class SettingsPage extends HookConsumerWidget { AdaptiveListTile( leading: const Icon(SpotubeIcons.audioQuality), title: const Text("Audio Quality"), - trailing: (context, update) => DropdownMenu( - initialSelection: preferences.audioQuality, - dropdownMenuEntries: const [ - DropdownMenuEntry( + trailing: (context, update) => + DropdownButton( + value: preferences.audioQuality, + items: const [ + DropdownMenuItem( value: AudioQuality.high, - label: "High", + child: Text("High"), ), - DropdownMenuEntry( + DropdownMenuItem( value: AudioQuality.low, - label: "Low", + child: Text("Low"), ), ], - onSelected: (value) { + onChanged: (value) { if (value != null) { preferences.setAudioQuality(value); update?.call(() {}); diff --git a/pubspec.lock b/pubspec.lock index 86e874cc..bc83a987 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,23 @@ packages: url: "https://pub.dev" source: hosted version: "5.4.0" + animate_gradient: + dependency: "direct main" + description: + path: "." + ref: "2e02ab5d1cb60fc172a5f15f6e91bd34a050af23" + resolved-ref: "2e02ab5d1cb60fc172a5f15f6e91bd34a050af23" + url: "https://github.com/Vikaskumar75/Animated-Gradient" + source: git + version: "0.0.2" + animated_gradient: + dependency: "direct main" + description: + name: animated_gradient + sha256: "9c0c52a093817ae42550e3affec6973a7bae7186d1d5d58749ca9689da3ba245" + url: "https://pub.dev" + source: hosted + version: "0.0.2" app_package_maker: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 294373b0..1d62ded1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,11 @@ environment: sdk: ">=2.17.0 <3.0.0" dependencies: + animate_gradient: + git: + url: https://github.com/Vikaskumar75/Animated-Gradient + ref: 2e02ab5d1cb60fc172a5f15f6e91bd34a050af23 + animated_gradient: ^0.0.2 args: ^2.3.2 async: ^2.9.0 audio_service: ^0.18.9