diff --git a/android/app/build.gradle b/android/app/build.gradle index 056d00345b859a6e975601b888c8c22879ca30b0..9435d1ba4bd53edf604fc5a5bd6c35a595d1fd11 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -37,7 +37,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 33 + compileSdkVersion 34 namespace "org.benoitharrault.spotifyplaylistgenerator" defaultConfig { diff --git a/android/gradle.properties b/android/gradle.properties index aa51064abebb79ba519e600afb7af23779154d4e..135006f9c1386c8757595c43e890e911f732f5a3 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.5 -app.versionCode=5 +app.versionName=0.0.6 +app.versionCode=6 diff --git a/assets/translations/en.json b/assets/translations/en.json index 6a6a8eb8a608cff460ebfd2dad4bb97b5f5c6925..e1557d711cb18bc780e9914ed0ce387a3c449800 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -1,3 +1,15 @@ { - "app_name": "Spotify playlist generator" + "app_name": "Spotify playlist generator", + + "settings_title": "Settings", + "settings_label_theme": "Theme mode", + + "about_title": "Informations", + "about_content": "Spotify playlist generator", + "about_version": "Version: {version}", + + "page_home": "Home", + "page_playlist": "Playlists", + + "": "" } diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 654351d117c90f7cc19a3cff20717023a01ebdd1..f3f7479de907e759058a4c05b29899ffcb058224 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -1,3 +1,15 @@ { - "app_name": "Générateur de playlist Spotify" + "app_name": "Générateur de playlist Spotify", + + "settings_title": "Réglages", + "settings_label_theme": "Thème de couleurs", + + "about_title": "Informations", + "about_content": "Générateur de playlist Spotify.", + "about_version": "Version : {version}", + + "page_home": "Accueil", + "page_playlist": "Playlists", + + "": "" } diff --git a/fastlane/metadata/android/en-US/changelogs/6.txt b/fastlane/metadata/android/en-US/changelogs/6.txt new file mode 100644 index 0000000000000000000000000000000000000000..060b202b87dcd33388eb8a9d1a45cbd276fc8ba3 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/6.txt @@ -0,0 +1 @@ +Improve/normalize app architecture. diff --git a/fastlane/metadata/android/fr-FR/changelogs/6.txt b/fastlane/metadata/android/fr-FR/changelogs/6.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cab228cbe7443782c4b187cbe805e4d0ba8e71a --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/6.txt @@ -0,0 +1 @@ +Amélioration/normalisation de l'architecture de l'application. diff --git a/lib/config/activity_page.dart b/lib/config/activity_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..88dab9895d0b749c67c26880e2ff0e7cd07da657 --- /dev/null +++ b/lib/config/activity_page.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; +import 'package:unicons/unicons.dart'; + +import 'package:spotifyplaylistgenerator/ui/pages/playlist.dart'; +import 'package:spotifyplaylistgenerator/ui/pages/home.dart'; + +class ActivityPageItem { + final Icon icon; + final Widget page; + final String code; + + const ActivityPageItem({ + required this.icon, + required this.page, + required this.code, + }); +} + +class ActivityPage { + static const indexHome = 0; + static const pageHome = ActivityPageItem( + icon: Icon(UniconsLine.home), + page: PageHome(), + code: 'page_home', + ); + + static const indexPlaylist = 1; + static const pagePlaylist = ActivityPageItem( + icon: Icon(UniconsLine.list_ul), + page: PagePlaylist(), + code: 'page_playlist', + ); + + static Map<int, ActivityPageItem> items = { + indexHome: pageHome, + indexPlaylist: pagePlaylist, + }; + + static bool isIndexAllowed(int pageIndex) { + return items.keys.contains(pageIndex); + } + + static ActivityPageItem getPageItem(int pageIndex) { + return items[pageIndex] ?? pageHome; + } + + static Widget getPageWidget(int pageIndex) { + return items[pageIndex]?.page ?? pageHome.page; + } + + static int itemsCount = ActivityPage.items.length; +} diff --git a/lib/config/app_colors.dart b/lib/config/app_colors.dart deleted file mode 100644 index a1ca589a1cef364687bbb2ee76e4073ce17ea650..0000000000000000000000000000000000000000 --- a/lib/config/app_colors.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/material.dart'; - -class AppColors { - static const Color primary = contentColorCyan; - static const Color menuBackground = Color(0xFF090912); - static const Color itemsBackground = Color(0xFF1B2339); - static const Color pageBackground = Color(0xFF282E45); - static const Color mainTextColor1 = Colors.white; - static const Color mainTextColor2 = Colors.white70; - static const Color mainTextColor3 = Colors.white38; - static const Color mainGridLineColor = Colors.white10; - static const Color borderColor = Colors.white54; - static const Color gridLinesColor = Color(0x11FFFFFF); - - static const Color contentColorBlack = Colors.black; - static const Color contentColorWhite = Colors.white; - static const Color contentColorBlue = Color(0xFF2196F3); - static const Color contentColorYellow = Color(0xFFFFC300); - static const Color contentColorOrange = Color(0xFFFF683B); - static const Color contentColorGreen = Color(0xFF3BFF49); - static const Color contentColorPurple = Color(0xFF6E1BFF); - static const Color contentColorPink = Color(0xFFFF3AF2); - static const Color contentColorRed = Color(0xFFE80054); - static const Color contentColorCyan = Color(0xFF50E4FF); -} diff --git a/lib/config/default_global_settings.dart b/lib/config/default_global_settings.dart new file mode 100644 index 0000000000000000000000000000000000000000..5fdf99747786b989caa032b9743d0c40c1fdd5f3 --- /dev/null +++ b/lib/config/default_global_settings.dart @@ -0,0 +1,33 @@ +import 'package:spotifyplaylistgenerator/utils/tools.dart'; + +class DefaultGlobalSettings { + // available global parameters codes + static const String parameterCodeSkin = 'skin'; + static const List<String> availableParameters = [ + parameterCodeSkin, + ]; + + // skin: available values + static const String skinValueDefault = 'default'; + static const List<String> allowedSkinValues = [ + skinValueDefault, + ]; + // skin: default value + static const String defaultSkinValue = skinValueDefault; + + // available values from parameter code + static List<String> getAvailableValues(String parameterCode) { + switch (parameterCode) { + case parameterCodeSkin: + return DefaultGlobalSettings.allowedSkinValues; + } + + printlog('Did not find any available value for global parameter "$parameterCode".'); + return []; + } + + // parameters displayed with assets (instead of painter) + static List<String> displayedWithAssets = [ + // + ]; +} diff --git a/lib/config/screen.dart b/lib/config/screen.dart new file mode 100644 index 0000000000000000000000000000000000000000..d712edf4eba4828f48a11a5bfdb61b7664a122b1 --- /dev/null +++ b/lib/config/screen.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:unicons/unicons.dart'; + +import 'package:spotifyplaylistgenerator/ui/screens/about.dart'; +import 'package:spotifyplaylistgenerator/ui/screens/activity.dart'; +import 'package:spotifyplaylistgenerator/ui/screens/settings.dart'; + +class ScreenItem { + final Icon icon; + final Widget screen; + final bool displayBottomNavBar; + + const ScreenItem({ + required this.icon, + required this.screen, + required this.displayBottomNavBar, + }); +} + +class Screen { + static const indexActivity = 0; + static const screenActivity = ScreenItem( + icon: Icon(UniconsLine.home), + screen: ScreenActivity(), + displayBottomNavBar: true, + ); + + static const indexSettings = 1; + static const screenSettings = ScreenItem( + icon: Icon(UniconsLine.setting), + screen: ScreenSettings(), + displayBottomNavBar: false, + ); + + static const indexAbout = 2; + static const screenAbout = ScreenItem( + icon: Icon(UniconsLine.info_circle), + screen: ScreenAbout(), + displayBottomNavBar: false, + ); + + static Map<int, ScreenItem> items = { + indexActivity: screenActivity, + indexSettings: screenSettings, + indexAbout: screenAbout, + }; + + static bool isIndexAllowed(int screenIndex) { + return items.keys.contains(screenIndex); + } + + static Widget getWidget(int screenIndex) { + return items[screenIndex]?.screen ?? screenActivity.screen; + } + + static bool displayBottomNavBar(int screenIndex) { + return items[screenIndex]?.displayBottomNavBar ?? screenActivity.displayBottomNavBar; + } + + static int itemsCount = Screen.items.length; +} diff --git a/lib/config/theme.dart b/lib/config/theme.dart index be390348c7868e7c63387df13e13c46de43f8a23..74f532fd5abf693979118609564d29167e902009 100644 --- a/lib/config/theme.dart +++ b/lib/config/theme.dart @@ -39,11 +39,9 @@ final ColorScheme lightColorScheme = ColorScheme.light( secondary: primarySwatch.shade500, onSecondary: Colors.white, error: errorColor, - background: textSwatch.shade200, - onBackground: textSwatch.shade500, onSurface: textSwatch.shade500, surface: textSwatch.shade50, - surfaceVariant: Colors.white, + surfaceContainerHighest: Colors.white, shadow: textSwatch.shade900.withOpacity(.1), ); @@ -52,11 +50,9 @@ final ColorScheme darkColorScheme = ColorScheme.dark( secondary: primarySwatch.shade500, onSecondary: Colors.white, error: errorColor, - background: const Color(0xFF171724), - onBackground: textSwatch.shade400, onSurface: textSwatch.shade300, surface: const Color(0xFF262630), - surfaceVariant: const Color(0xFF282832), + surfaceContainerHighest: const Color(0xFF282832), shadow: textSwatch.shade900.withOpacity(.2), ); @@ -192,5 +188,3 @@ final ThemeData darkTheme = lightTheme.copyWith( ), ), ); - -final ThemeData appTheme = darkTheme; diff --git a/lib/cubit/activity_cubit.dart b/lib/cubit/activity_cubit.dart new file mode 100644 index 0000000000000000000000000000000000000000..02d692365b443705e2c6ffc33d18204c2da59e83 --- /dev/null +++ b/lib/cubit/activity_cubit.dart @@ -0,0 +1,82 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import 'package:hydrated_bloc/hydrated_bloc.dart'; + +import 'package:spotifyplaylistgenerator/models/activity/activity.dart'; +import 'package:spotifyplaylistgenerator/models/settings/settings_global.dart'; + +part 'activity_state.dart'; + +class ActivityCubit extends HydratedCubit<ActivityState> { + ActivityCubit() + : super(ActivityState( + currentActivity: Activity.createNull(), + )); + + void updateState(Activity activity) { + emit(ActivityState( + currentActivity: activity, + )); + } + + void refresh() { + final Activity activity = Activity( + // Settings + globalSettings: state.currentActivity.globalSettings, + // State + isConnected: state.currentActivity.isConnected, + // Base data + userId: state.currentActivity.userId, + // Activity data + token: state.currentActivity.token, + ); + // activity.dump(); + + updateState(activity); + } + + void startNewActivity({ + required GlobalSettings globalSettings, + }) { + final Activity newActivity = Activity.createNew( + // Settings + globalSettings: globalSettings, + ); + + newActivity.dump(); + + updateState(newActivity); + refresh(); + } + + void quitActivity() { + state.currentActivity.isConnected = false; + refresh(); + } + + void resumeSavedActivity() { + state.currentActivity.isConnected = true; + refresh(); + } + + void deleteSavedActivity() { + state.currentActivity.isConnected = false; + refresh(); + } + + @override + ActivityState? fromJson(Map<String, dynamic> json) { + final Activity currentActivity = json['currentActivity'] as Activity; + + return ActivityState( + currentActivity: currentActivity, + ); + } + + @override + Map<String, dynamic>? toJson(ActivityState state) { + return <String, dynamic>{ + 'currentActivity': state.currentActivity.toJson(), + }; + } +} diff --git a/lib/cubit/activity_state.dart b/lib/cubit/activity_state.dart new file mode 100644 index 0000000000000000000000000000000000000000..887b45e4255fd7de1cc7744569d82a38a66602f2 --- /dev/null +++ b/lib/cubit/activity_state.dart @@ -0,0 +1,15 @@ +part of 'activity_cubit.dart'; + +@immutable +class ActivityState extends Equatable { + const ActivityState({ + required this.currentActivity, + }); + + final Activity currentActivity; + + @override + List<dynamic> get props => <dynamic>[ + currentActivity, + ]; +} diff --git a/lib/cubit/nav_cubit_pages.dart b/lib/cubit/nav_cubit_pages.dart new file mode 100644 index 0000000000000000000000000000000000000000..d6f50044ab90f7c40a157bb86c631ca9962d4adf --- /dev/null +++ b/lib/cubit/nav_cubit_pages.dart @@ -0,0 +1,25 @@ +import 'package:hydrated_bloc/hydrated_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/activity_page.dart'; + +class NavCubitPage extends HydratedCubit<int> { + NavCubitPage() : super(0); + + void updateIndex(int index) { + if (ActivityPage.isIndexAllowed(index)) { + emit(index); + } else { + emit(ActivityPage.indexHome); + } + } + + @override + int fromJson(Map<String, dynamic> json) { + return ActivityPage.indexHome; + } + + @override + Map<String, dynamic>? toJson(int state) { + return <String, int>{'pageIndex': state}; + } +} diff --git a/lib/cubit/nav_cubit_screens.dart b/lib/cubit/nav_cubit_screens.dart new file mode 100644 index 0000000000000000000000000000000000000000..ff29d15b7853f6869006442d2c4d6f200d81423f --- /dev/null +++ b/lib/cubit/nav_cubit_screens.dart @@ -0,0 +1,37 @@ +import 'package:hydrated_bloc/hydrated_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/screen.dart'; + +class NavCubitScreen extends HydratedCubit<int> { + NavCubitScreen() : super(0); + + void updateIndex(int index) { + if (Screen.isIndexAllowed(index)) { + emit(index); + } else { + goToActivityPage(); + } + } + + void goToActivityPage() { + emit(Screen.indexActivity); + } + + void goToSettingsPage() { + emit(Screen.indexSettings); + } + + void goToAboutPage() { + emit(Screen.indexAbout); + } + + @override + int fromJson(Map<String, dynamic> json) { + return Screen.indexActivity; + } + + @override + Map<String, dynamic>? toJson(int state) { + return <String, int>{'screenIndex': state}; + } +} diff --git a/lib/cubit/settings_global_cubit.dart b/lib/cubit/settings_global_cubit.dart new file mode 100644 index 0000000000000000000000000000000000000000..7db262183898d5b87477a5208e1b3c7caf7d552f --- /dev/null +++ b/lib/cubit/settings_global_cubit.dart @@ -0,0 +1,60 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import 'package:hydrated_bloc/hydrated_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/default_global_settings.dart'; +import 'package:spotifyplaylistgenerator/models/settings/settings_global.dart'; + +part 'settings_global_state.dart'; + +class GlobalSettingsCubit extends HydratedCubit<GlobalSettingsState> { + GlobalSettingsCubit() : super(GlobalSettingsState(settings: GlobalSettings.createDefault())); + + void setValues({ + String? skin, + }) { + emit( + GlobalSettingsState( + settings: GlobalSettings( + skin: skin ?? state.settings.skin, + ), + ), + ); + } + + String getParameterValue(String code) { + switch (code) { + case DefaultGlobalSettings.parameterCodeSkin: + return GlobalSettings.getSkinValueFromUnsafe(state.settings.skin); + } + return ''; + } + + void setParameterValue(String code, String value) { + final String skin = (code == DefaultGlobalSettings.parameterCodeSkin) + ? value + : getParameterValue(DefaultGlobalSettings.parameterCodeSkin); + + setValues( + skin: skin, + ); + } + + @override + GlobalSettingsState? fromJson(Map<String, dynamic> json) { + final String skin = json[DefaultGlobalSettings.parameterCodeSkin] as String; + + return GlobalSettingsState( + settings: GlobalSettings( + skin: skin, + ), + ); + } + + @override + Map<String, dynamic>? toJson(GlobalSettingsState state) { + return <String, dynamic>{ + DefaultGlobalSettings.parameterCodeSkin: state.settings.skin, + }; + } +} diff --git a/lib/cubit/settings_global_state.dart b/lib/cubit/settings_global_state.dart new file mode 100644 index 0000000000000000000000000000000000000000..ebcddd700f252257223ca8e16c85202b04f3ff24 --- /dev/null +++ b/lib/cubit/settings_global_state.dart @@ -0,0 +1,15 @@ +part of 'settings_global_cubit.dart'; + +@immutable +class GlobalSettingsState extends Equatable { + const GlobalSettingsState({ + required this.settings, + }); + + final GlobalSettings settings; + + @override + List<dynamic> get props => <dynamic>[ + settings, + ]; +} diff --git a/lib/cubit/theme_cubit.dart b/lib/cubit/theme_cubit.dart new file mode 100644 index 0000000000000000000000000000000000000000..b793e895dbb0c672d451cd403e0036c3d9ac9b42 --- /dev/null +++ b/lib/cubit/theme_cubit.dart @@ -0,0 +1,31 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import 'package:hydrated_bloc/hydrated_bloc.dart'; + +part 'theme_state.dart'; + +class ThemeCubit extends HydratedCubit<ThemeModeState> { + ThemeCubit() : super(const ThemeModeState()); + + void getTheme(ThemeModeState state) { + emit(state); + } + + @override + ThemeModeState? fromJson(Map<String, dynamic> json) { + switch (json['themeMode']) { + case 'ThemeMode.dark': + return const ThemeModeState(themeMode: ThemeMode.dark); + case 'ThemeMode.light': + return const ThemeModeState(themeMode: ThemeMode.light); + case 'ThemeMode.system': + default: + return const ThemeModeState(themeMode: ThemeMode.system); + } + } + + @override + Map<String, String>? toJson(ThemeModeState state) { + return <String, String>{'themeMode': state.themeMode.toString()}; + } +} diff --git a/lib/cubit/theme_state.dart b/lib/cubit/theme_state.dart new file mode 100644 index 0000000000000000000000000000000000000000..e479a50f12fe72a35a1fd1722ff72afbb692a136 --- /dev/null +++ b/lib/cubit/theme_state.dart @@ -0,0 +1,15 @@ +part of 'theme_cubit.dart'; + +@immutable +class ThemeModeState extends Equatable { + const ThemeModeState({ + this.themeMode, + }); + + final ThemeMode? themeMode; + + @override + List<Object?> get props => <Object?>[ + themeMode, + ]; +} diff --git a/lib/main.dart b/lib/main.dart index ca38cd475a76399f6102e414d3f70bb462ef0246..1241841d7221e5728e084366c54ed83f4abd2287 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,25 +1,42 @@ +import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:hive/hive.dart'; +import 'package:hydrated_bloc/hydrated_bloc.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:spotifyplaylistgenerator/config/theme.dart'; -import 'package:spotifyplaylistgenerator/ui/screens/skeleton_screen.dart'; +import 'package:spotifyplaylistgenerator/cubit/activity_cubit.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_pages.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_screens.dart'; +import 'package:spotifyplaylistgenerator/cubit/settings_global_cubit.dart'; +import 'package:spotifyplaylistgenerator/cubit/theme_cubit.dart'; +import 'package:spotifyplaylistgenerator/ui/skeleton.dart'; void main() async { + // Initialize packages WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); - - runApp( - EasyLocalization( - path: 'assets/translations', - supportedLocales: const <Locale>[ - Locale('en'), - Locale('fr'), - ], - fallbackLocale: const Locale('en'), - useFallbackTranslations: true, - child: const MyApp(), - ), + final Directory tmpDir = await getTemporaryDirectory(); + Hive.init(tmpDir.toString()); + HydratedBloc.storage = await HydratedStorage.build( + storageDirectory: tmpDir, ); + + SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) + .then((value) => runApp(EasyLocalization( + path: 'assets/translations', + supportedLocales: const <Locale>[ + Locale('en'), + Locale('fr'), + ], + fallbackLocale: const Locale('en'), + useFallbackTranslations: true, + child: const MyApp(), + ))); } class MyApp extends StatelessWidget { @@ -27,16 +44,33 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( - title: 'Spotify playlist generator', - theme: appTheme, - home: const SkeletonScreen(), - - // Localization stuff - localizationsDelegates: context.localizationDelegates, - supportedLocales: context.supportedLocales, - locale: context.locale, - debugShowCheckedModeBanner: false, + return MultiBlocProvider( + providers: [ + BlocProvider<NavCubitPage>(create: (context) => NavCubitPage()), + BlocProvider<NavCubitScreen>(create: (context) => NavCubitScreen()), + BlocProvider<ThemeCubit>(create: (context) => ThemeCubit()), + BlocProvider<ActivityCubit>(create: (context) => ActivityCubit()), + BlocProvider<GlobalSettingsCubit>(create: (context) => GlobalSettingsCubit()), + ], + child: BlocBuilder<ThemeCubit, ThemeModeState>( + builder: (BuildContext context, ThemeModeState state) { + return MaterialApp( + title: 'Spotify playlist generator', + home: const SkeletonScreen(), + + // Theme stuff + theme: lightTheme, + darkTheme: darkTheme, + themeMode: state.themeMode, + + // Localization stuff + localizationsDelegates: context.localizationDelegates, + supportedLocales: context.supportedLocales, + locale: context.locale, + debugShowCheckedModeBanner: false, + ); + }, + ), ); } } diff --git a/lib/models/activity/activity.dart b/lib/models/activity/activity.dart new file mode 100644 index 0000000000000000000000000000000000000000..0fe889c5cfd6fdb02193b1fcf0b90e84527093a0 --- /dev/null +++ b/lib/models/activity/activity.dart @@ -0,0 +1,88 @@ +import 'package:spotifyplaylistgenerator/models/settings/settings_global.dart'; +import 'package:spotifyplaylistgenerator/utils/tools.dart'; + +class Activity { + Activity({ + // Settings + required this.globalSettings, + + // State + this.isConnected = false, + + // Base data + this.userId = '', + + // Activity data + this.token = 1, + }); + + // Settings + final GlobalSettings globalSettings; + + // State + bool isConnected; + + // Base data + String userId; + + // Activity data + int token; + + factory Activity.createNull() { + return Activity( + // Settings + globalSettings: GlobalSettings.createDefault(), + // Base data + userId: '', + ); + } + + factory Activity.createNew({ + GlobalSettings? globalSettings, + }) { + final GlobalSettings newGlobalSettings = globalSettings ?? GlobalSettings.createDefault(); + + return Activity( + // Settings + globalSettings: newGlobalSettings, + // State + isConnected: false, + // Base data + userId: '', + ); + } + + void dump() { + printlog(''); + printlog('## Current activity dump:'); + printlog(''); + printlog('$Activity:'); + printlog(' Settings'); + globalSettings.dump(); + printlog(' State'); + printlog(' isConnected: $isConnected'); + printlog(' Base data'); + printlog(' userId: $userId'); + printlog(' Activity data'); + printlog(' token: $token'); + printlog(''); + } + + @override + String toString() { + return '$Activity(${toJson()})'; + } + + Map<String, dynamic>? toJson() { + return <String, dynamic>{ + // Settings + 'globalSettings': globalSettings.toJson(), + // State + 'isConnected': isConnected, + // Base data + 'userId': userId, + // Activity data + 'token': token, + }; + } +} diff --git a/lib/models/settings/settings_global.dart b/lib/models/settings/settings_global.dart new file mode 100644 index 0000000000000000000000000000000000000000..292d91d063a9e31506f3caa7905bb5e3a1651625 --- /dev/null +++ b/lib/models/settings/settings_global.dart @@ -0,0 +1,41 @@ +import 'package:spotifyplaylistgenerator/config/default_global_settings.dart'; +import 'package:spotifyplaylistgenerator/utils/tools.dart'; + +class GlobalSettings { + String skin; + + GlobalSettings({ + required this.skin, + }); + + static String getSkinValueFromUnsafe(String skin) { + if (DefaultGlobalSettings.allowedSkinValues.contains(skin)) { + return skin; + } + + return DefaultGlobalSettings.defaultSkinValue; + } + + factory GlobalSettings.createDefault() { + return GlobalSettings( + skin: DefaultGlobalSettings.defaultSkinValue, + ); + } + + void dump() { + printlog('$GlobalSettings:'); + printlog(' ${DefaultGlobalSettings.parameterCodeSkin}: $skin'); + printlog(''); + } + + @override + String toString() { + return '$GlobalSettings(${toJson()})'; + } + + Map<String, dynamic>? toJson() { + return <String, dynamic>{ + DefaultGlobalSettings.parameterCodeSkin: skin, + }; + } +} diff --git a/lib/ui/helpers/app_titles.dart b/lib/ui/helpers/app_titles.dart new file mode 100644 index 0000000000000000000000000000000000000000..b98107b12fabc3114ebfbec994166b588abcf1ad --- /dev/null +++ b/lib/ui/helpers/app_titles.dart @@ -0,0 +1,32 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; + +class AppHeader extends StatelessWidget { + const AppHeader({super.key, required this.text}); + + final String text; + + @override + Widget build(BuildContext context) { + return Text( + tr(text), + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2), + ); + } +} + +class AppTitle extends StatelessWidget { + const AppTitle({super.key, required this.text}); + + final String text; + + @override + Widget build(BuildContext context) { + return Text( + tr(text), + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.titleLarge!.apply(fontWeightDelta: 2), + ); + } +} diff --git a/lib/ui/nav/bottom_nav_bar.dart b/lib/ui/nav/bottom_nav_bar.dart new file mode 100644 index 0000000000000000000000000000000000000000..f89af4babd5860c8277de07877450f1ab4bbb1a5 --- /dev/null +++ b/lib/ui/nav/bottom_nav_bar.dart @@ -0,0 +1,49 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/activity_page.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_pages.dart'; + +class BottomNavBar extends StatelessWidget { + const BottomNavBar({super.key}); + + @override + Widget build(BuildContext context) { + return Card( + margin: const EdgeInsets.only(top: 1, right: 4, left: 4), + elevation: 4, + shadowColor: Theme.of(context).colorScheme.shadow, + color: Theme.of(context).colorScheme.surfaceContainerHighest, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), + ), + child: BlocBuilder<NavCubitPage, int>(builder: (BuildContext context, int state) { + final List<ActivityPageItem> pageItems = [ + ActivityPage.pageHome, + ActivityPage.pagePlaylist, + ]; + final List<BottomNavigationBarItem> items = pageItems.map((ActivityPageItem item) { + return BottomNavigationBarItem( + icon: item.icon, + label: tr(item.code), + ); + }).toList(); + + return BottomNavigationBar( + currentIndex: state, + onTap: (int index) => context.read<NavCubitPage>().updateIndex(index), + type: BottomNavigationBarType.fixed, + elevation: 0, + backgroundColor: Colors.transparent, + selectedItemColor: Theme.of(context).colorScheme.primary, + unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color, + items: items, + ); + }), + ); + } +} diff --git a/lib/ui/nav/global_app_bar.dart b/lib/ui/nav/global_app_bar.dart new file mode 100644 index 0000000000000000000000000000000000000000..4c8c23356f7a5ea603cf9a57526c1a3d034141a5 --- /dev/null +++ b/lib/ui/nav/global_app_bar.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/screen.dart'; +import 'package:spotifyplaylistgenerator/cubit/activity_cubit.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_screens.dart'; +import 'package:spotifyplaylistgenerator/ui/helpers/app_titles.dart'; + +class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget { + const GlobalAppBar({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<ActivityCubit, ActivityState>( + builder: (BuildContext context, ActivityState activityState) { + return BlocBuilder<NavCubitScreen, int>( + builder: (BuildContext context, int screenIndex) { + final List<Widget> menuActions = []; + + if (screenIndex == Screen.indexActivity) { + // go to Settings page + menuActions.add(ElevatedButton( + onPressed: () { + context.read<NavCubitScreen>().goToSettingsPage(); + }, + style: ElevatedButton.styleFrom( + shape: const CircleBorder(), + ), + child: Screen.screenSettings.icon, + )); + + // go to About page + menuActions.add(ElevatedButton( + onPressed: () { + context.read<NavCubitScreen>().goToAboutPage(); + }, + style: ElevatedButton.styleFrom( + shape: const CircleBorder(), + ), + child: Screen.screenAbout.icon, + )); + } else { + // back to Home page + menuActions.add(ElevatedButton( + onPressed: () { + context.read<NavCubitScreen>().goToActivityPage(); + }, + style: ElevatedButton.styleFrom( + shape: const CircleBorder(), + ), + child: Screen.screenActivity.icon, + )); + } + + return AppBar( + title: const AppHeader(text: 'app_name'), + actions: menuActions, + ); + }, + ); + }, + ); + } + + @override + Size get preferredSize => const Size.fromHeight(50); +} diff --git a/lib/ui/pages/home.dart b/lib/ui/pages/home.dart new file mode 100644 index 0000000000000000000000000000000000000000..9d1283d7563b986f500cc0ce28ff7f61908d7b00 --- /dev/null +++ b/lib/ui/pages/home.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/cubit/activity_cubit.dart'; +import 'package:spotifyplaylistgenerator/models/activity/activity.dart'; + +class PageHome extends StatelessWidget { + const PageHome({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<ActivityCubit, ActivityState>( + builder: (BuildContext context, ActivityState activityState) { + final Activity currentActivity = activityState.currentActivity; + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + const SizedBox(height: 8), + const Text('[home]'), + Text(currentActivity.toString()), + ], + ); + }, + ); + } +} diff --git a/lib/ui/pages/playlist.dart b/lib/ui/pages/playlist.dart new file mode 100644 index 0000000000000000000000000000000000000000..2ccb0ae304d5c5da4f6ef5c0781728ad5674b069 --- /dev/null +++ b/lib/ui/pages/playlist.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/cubit/activity_cubit.dart'; +import 'package:spotifyplaylistgenerator/models/activity/activity.dart'; + +class PagePlaylist extends StatelessWidget { + const PagePlaylist({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<ActivityCubit, ActivityState>( + builder: (BuildContext context, ActivityState activityState) { + final Activity currentActivity = activityState.currentActivity; + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + const SizedBox(height: 8), + const Text('[playlist]'), + Text(currentActivity.toString()), + ], + ); + }, + ); + } +} diff --git a/lib/ui/screens/about.dart b/lib/ui/screens/about.dart new file mode 100644 index 0000000000000000000000000000000000000000..40b71d6234a06137ec50afd960aee17023240b1e --- /dev/null +++ b/lib/ui/screens/about.dart @@ -0,0 +1,41 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:package_info_plus/package_info_plus.dart'; + +import 'package:spotifyplaylistgenerator/ui/helpers/app_titles.dart'; + +class ScreenAbout extends StatelessWidget { + const ScreenAbout({super.key}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: <Widget>[ + const SizedBox(height: 8), + const AppTitle(text: 'about_title'), + const Text('about_content').tr(), + FutureBuilder<PackageInfo>( + future: PackageInfo.fromPlatform(), + builder: (context, snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.done: + return const Text('about_version').tr( + namedArgs: { + 'version': snapshot.data!.version, + }, + ); + default: + return const SizedBox(); + } + }, + ), + ], + ), + ); + } +} diff --git a/lib/ui/screens/activity.dart b/lib/ui/screens/activity.dart new file mode 100644 index 0000000000000000000000000000000000000000..fc76f32afc7c4ef1056bd9a71f33afcb7bdecea7 --- /dev/null +++ b/lib/ui/screens/activity.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/activity_page.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_pages.dart'; + +class ScreenActivity extends StatelessWidget { + const ScreenActivity({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<NavCubitPage, int>( + builder: (BuildContext context, int pageIndex) { + return ActivityPage.getPageWidget(pageIndex); + }, + ); + } +} diff --git a/lib/ui/screens/main_screen.dart b/lib/ui/screens/main_screen.dart deleted file mode 100644 index bffc513336621bbf18f921a295bb623b81452be4..0000000000000000000000000000000000000000 --- a/lib/ui/screens/main_screen.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:spotifyplaylistgenerator/ui/widgets/main_screen/user_card.dart'; - -class MainScreen extends StatelessWidget { - const MainScreen({super.key}); - - @override - Widget build(BuildContext context) { - return Material( - color: Theme.of(context).colorScheme.background, - child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 16), - physics: const BouncingScrollPhysics(), - children: const <Widget>[ - SizedBox(height: 90), - StatisticsCard(), - SizedBox(height: 8), - SizedBox(height: 36), - ], - ), - ); - } -} diff --git a/lib/ui/screens/settings.dart b/lib/ui/screens/settings.dart new file mode 100644 index 0000000000000000000000000000000000000000..ee9bc4899cf23b9b883b7ed9824474cef36d9059 --- /dev/null +++ b/lib/ui/screens/settings.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +import 'package:spotifyplaylistgenerator/ui/helpers/app_titles.dart'; +import 'package:spotifyplaylistgenerator/ui/settings/settings_form.dart'; + +class ScreenSettings extends StatelessWidget { + const ScreenSettings({super.key}); + + @override + Widget build(BuildContext context) { + return const Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: <Widget>[ + SizedBox(height: 8), + AppTitle(text: 'settings_title'), + SizedBox(height: 8), + SettingsForm(), + ], + ), + ); + } +} diff --git a/lib/ui/screens/skeleton_screen.dart b/lib/ui/screens/skeleton_screen.dart deleted file mode 100644 index ec7765d2168f6ffb1bdce03f13f70dbf3ab4c043..0000000000000000000000000000000000000000 --- a/lib/ui/screens/skeleton_screen.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:spotifyplaylistgenerator/ui/screens/main_screen.dart'; -import 'package:spotifyplaylistgenerator/ui/widgets/app_bar.dart'; - -class SkeletonScreen extends StatefulWidget { - const SkeletonScreen({super.key}); - - @override - State<SkeletonScreen> createState() => _SkeletonScreenState(); -} - -class _SkeletonScreenState extends State<SkeletonScreen> { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: const StandardAppBar(), - extendBodyBehindAppBar: true, - body: const MainScreen(), - backgroundColor: Theme.of(context).colorScheme.background, - ); - } -} diff --git a/lib/ui/settings/settings_form.dart b/lib/ui/settings/settings_form.dart new file mode 100644 index 0000000000000000000000000000000000000000..efcb37ce6f61458d4eb3d5fbb8fe97a6dac8b27e --- /dev/null +++ b/lib/ui/settings/settings_form.dart @@ -0,0 +1,63 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:unicons/unicons.dart'; + +import 'package:spotifyplaylistgenerator/ui/settings/theme_card.dart'; + +class SettingsForm extends StatefulWidget { + const SettingsForm({super.key}); + + @override + State<SettingsForm> createState() => _SettingsFormState(); +} + +class _SettingsFormState extends State<SettingsForm> { + @override + void dispose() { + super.dispose(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + } + + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: <Widget>[ + // Light/dark theme + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + const Text('settings_label_theme').tr(), + const Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ThemeCard( + mode: ThemeMode.system, + icon: UniconsLine.cog, + ), + ThemeCard( + mode: ThemeMode.light, + icon: UniconsLine.sun, + ), + ThemeCard( + mode: ThemeMode.dark, + icon: UniconsLine.moon, + ) + ], + ), + ], + ), + + const SizedBox(height: 16), + ], + ); + } +} diff --git a/lib/ui/settings/theme_card.dart b/lib/ui/settings/theme_card.dart new file mode 100644 index 0000000000000000000000000000000000000000..37e2a15558bd122bfb875f3bf46eb8f5c2d9aed0 --- /dev/null +++ b/lib/ui/settings/theme_card.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/cubit/theme_cubit.dart'; + +class ThemeCard extends StatelessWidget { + const ThemeCard({ + super.key, + required this.mode, + required this.icon, + }); + + final IconData icon; + final ThemeMode mode; + + @override + Widget build(BuildContext context) { + return BlocBuilder<ThemeCubit, ThemeModeState>( + builder: (BuildContext context, ThemeModeState state) { + return Card( + elevation: 2, + shadowColor: Theme.of(context).colorScheme.shadow, + color: state.themeMode == mode + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.surface, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + margin: const EdgeInsets.all(5), + child: InkWell( + onTap: () => BlocProvider.of<ThemeCubit>(context).getTheme( + ThemeModeState(themeMode: mode), + ), + borderRadius: const BorderRadius.all(Radius.circular(12)), + child: Icon( + icon, + size: 32, + color: state.themeMode != mode + ? Theme.of(context).colorScheme.primary + : Colors.white, + ), + ), + ); + }, + ); + } +} diff --git a/lib/ui/skeleton.dart b/lib/ui/skeleton.dart new file mode 100644 index 0000000000000000000000000000000000000000..0ad936cad14cbeb514056339d6772acc767f89c4 --- /dev/null +++ b/lib/ui/skeleton.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:spotifyplaylistgenerator/config/screen.dart'; +import 'package:spotifyplaylistgenerator/cubit/nav_cubit_screens.dart'; +import 'package:spotifyplaylistgenerator/ui/nav/bottom_nav_bar.dart'; +import 'package:spotifyplaylistgenerator/ui/nav/global_app_bar.dart'; + +class SkeletonScreen extends StatelessWidget { + const SkeletonScreen({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<NavCubitScreen, int>( + builder: (BuildContext context, int screenIndex) { + return Scaffold( + appBar: const GlobalAppBar(), + extendBodyBehindAppBar: false, + body: Material( + color: Theme.of(context).colorScheme.surface, + child: Padding( + padding: const EdgeInsets.only( + top: 8, + left: 2, + right: 2, + ), + child: Screen.getWidget(screenIndex), + ), + ), + backgroundColor: Theme.of(context).colorScheme.surface, + bottomNavigationBar: + Screen.displayBottomNavBar(screenIndex) ? const BottomNavBar() : null, + ); + }, + ); + } +} diff --git a/lib/ui/widgets/app_bar.dart b/lib/ui/widgets/app_bar.dart deleted file mode 100644 index f33196b08db3c4aab4290d6cc41aa2739ab48ffe..0000000000000000000000000000000000000000 --- a/lib/ui/widgets/app_bar.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:spotifyplaylistgenerator/ui/widgets/header.dart'; - -class StandardAppBar extends StatefulWidget implements PreferredSizeWidget { - const StandardAppBar({super.key}); - - @override - State<StandardAppBar> createState() => _StandardAppBarState(); - - @override - Size get preferredSize => const Size.fromHeight(50); -} - -class _StandardAppBarState extends State<StandardAppBar> { - @override - Widget build(BuildContext context) { - return AppBar( - title: const Header(text: 'app_name'), - actions: const [], - ); - } -} diff --git a/lib/ui/widgets/error.dart b/lib/ui/widgets/error.dart deleted file mode 100644 index 9aacdcb7d4796e332b8a3160284aa8ced0e4f1c3..0000000000000000000000000000000000000000 --- a/lib/ui/widgets/error.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; - -class ShowErrorWidget extends StatelessWidget { - const ShowErrorWidget({super.key, required this.message}); - - final String message; - - @override - Widget build(BuildContext context) { - return Text( - '⚠️ ${tr(message)}', - textAlign: TextAlign.start, - style: const TextStyle(color: Colors.red), - ); - } -} diff --git a/lib/ui/widgets/header.dart b/lib/ui/widgets/header.dart deleted file mode 100644 index 2187ef84a2dbad4dd0cfa7986bdb4473b0af0462..0000000000000000000000000000000000000000 --- a/lib/ui/widgets/header.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; - -class Header extends StatelessWidget { - const Header({super.key, required this.text}); - - final String text; - - @override - Widget build(BuildContext context) { - return Text( - tr(text), - textAlign: TextAlign.start, - style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2), - ); - } -} diff --git a/lib/ui/widgets/main_screen/user_card.dart b/lib/ui/widgets/main_screen/user_card.dart deleted file mode 100644 index 45e9a4c2359004dbeabbb956c67014ec37cc46d5..0000000000000000000000000000000000000000 --- a/lib/ui/widgets/main_screen/user_card.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/material.dart'; - -class StatisticsCard extends StatelessWidget { - const StatisticsCard({super.key}); - - @override - Widget build(BuildContext context) { - return const Text('👤'); - } -} diff --git a/pubspec.lock b/pubspec.lock index ee13cb691faf6b16f1448973e2073074161f4c76..c1e8da24d00536dce1d9409b0ef6d537b7ff69db 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + bloc: + dependency: transitive + description: + name: bloc + sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" + url: "https://pub.dev" + source: hosted + version: "8.1.4" characters: dependency: transitive description: @@ -41,14 +49,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" easy_localization: dependency: "direct main" description: name: easy_localization - sha256: c145aeb6584aedc7c862ab8c737c3277788f47488bfdf9bae0fe112bd0a4789c + sha256: fa59bcdbbb911a764aa6acf96bbb6fa7a5cf8234354fc45ec1a43a0349ef0201 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.7" easy_logger: dependency: transitive description: @@ -57,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.2" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" ffi: dependency: transitive description: @@ -78,14 +102,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a + url: "https://pub.dev" + source: hosted + version: "8.1.6" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "4.0.0" flutter_localizations: dependency: transitive description: flutter @@ -96,6 +128,14 @@ packages: description: flutter source: sdk version: "0.0.0" + hive: + dependency: "direct main" + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" http: dependency: "direct main" description: @@ -112,22 +152,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + hydrated_bloc: + dependency: "direct main" + description: + name: hydrated_bloc + sha256: af35b357739fe41728df10bec03aad422cdc725a1e702e03af9d2a41ea05160c + url: "https://pub.dev" + source: hosted + version: "9.1.5" intl: dependency: transitive description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" lints: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" material_color_utilities: dependency: transitive description: @@ -140,10 +188,34 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 + url: "https://pub.dev" + source: hosted + version: "8.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "3.0.0" path: dependency: transitive description: @@ -152,6 +224,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a + url: "https://pub.dev" + source: hosted + version: "2.2.6" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + url: "https://pub.dev" + source: hosted + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -180,10 +276,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -192,30 +288,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + provider: + dependency: transitive + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" shared_preferences: dependency: transitive description: name: shared_preferences - sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180 url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.3" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.3" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.4.0" shared_preferences_linux: dependency: transitive description: @@ -269,6 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" term_glyph: dependency: transitive description: @@ -289,10 +401,10 @@ packages: dependency: "direct main" description: name: unicons - sha256: dbfcf93ff4d4ea19b324113857e358e4882115ab85db04417a4ba1c72b17a670 + sha256: "1cca7462df18ff191b7e41b52f747d08854916531d1d7ab7cec0552095995206" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" vector_math: dependency: transitive description: @@ -305,18 +417,18 @@ packages: dependency: transitive description: name: web - sha256: "1d9158c616048c38f712a6646e317a3426da10e884447626167240d45209cbad" + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.5.1" win32: dependency: transitive description: name: win32 - sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.5.1" xdg_directories: dependency: transitive description: @@ -326,5 +438,5 @@ packages: source: hosted version: "1.0.4" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.19.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 549503d8a91c82695e446b258733de89fc8d9259..cf04d2f3a09d95ac80a225ebc4c7bede7884694c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,23 +1,35 @@ name: spotifyplaylistgenerator description: Create and manage Spotify playlists -publish_to: 'none' +publish_to: "none" -version: 0.0.5+5 +version: 0.0.6+6 environment: - sdk: '^3.0.0' + sdk: "^3.0.0" dependencies: flutter: sdk: flutter + # base easy_localization: ^3.0.1 - http: ^1.1.0 + equatable: ^2.0.5 + flutter_bloc: ^8.1.1 + hive: ^2.2.3 + hydrated_bloc: ^9.0.0 + package_info_plus: ^8.0.0 + path_provider: ^2.0.11 unicons: ^2.1.1 + # specific + http: ^1.1.0 + +dev_dependencies: + flutter_lints: ^4.0.0 + flutter: - uses-material-design: false + uses-material-design: true assets: - assets/translations/ @@ -32,5 +44,4 @@ flutter: weight: 400 - asset: assets/fonts/Nunito-Light.ttf weight: 300 -dev_dependencies: - flutter_lints: ^3.0.1 + diff --git a/icons/build_repository_icons.sh b/resources/app/build_application_resources.sh similarity index 98% rename from icons/build_repository_icons.sh rename to resources/app/build_application_resources.sh index 27dbe2647fe4e6d562fbd99451716d1b7d448570..6d67b8f4f9eca701d1aed7331ef41dfb0bd44f20 100755 --- a/icons/build_repository_icons.sh +++ b/resources/app/build_application_resources.sh @@ -6,7 +6,7 @@ command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not ins command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -BASE_DIR="$(dirname "${CURRENT_DIR}")" +BASE_DIR="$(dirname "$(dirname "${CURRENT_DIR}")")" SOURCE_ICON="${CURRENT_DIR}/icon.svg" SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg" diff --git a/icons/featureGraphic.svg b/resources/app/featureGraphic.svg similarity index 100% rename from icons/featureGraphic.svg rename to resources/app/featureGraphic.svg diff --git a/icons/icon.svg b/resources/app/icon.svg similarity index 100% rename from icons/icon.svg rename to resources/app/icon.svg diff --git a/resources/build_resources.sh b/resources/build_resources.sh new file mode 100755 index 0000000000000000000000000000000000000000..8d5848a985ed1068f6e6226379a9cedb69c3fa15 --- /dev/null +++ b/resources/build_resources.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" + +${CURRENT_DIR}/app/build_application_resources.sh +