Enhance theme management and UI settings

- Updated AppThemeMode enum to include icons and added fromValue method for easier theme retrieval.
- Modified ThemeBloc to manage currentTheme instead of themeMode.
- Enhanced ThemeState to reflect currentTheme and updated copyWith method.
- Added ThemeSettingsView for user-friendly theme selection in settings.
- Improved fluxLightTheme and fluxDarkTheme with new listTileTheme and color settings.
- Updated settings view to navigate to ThemeSettingsView.
- Added entitlements for network client permissions in Debug and Release profiles.
- Introduced Podfile.lock for dependency management.
- Added devtools_options.yaml for Dart & Flutter DevTools configuration.
This commit is contained in:
2026-04-06 08:48:10 +02:00
parent 28b2abdff3
commit c6c61f1a31
13 changed files with 281 additions and 19 deletions

View File

@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:flux/data/enums.dart';
@@ -11,20 +10,19 @@ part 'theme_state.dart';
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
static const String _savedThemeKey = "themeModeSetting";
final SharedPreferences _prefs = GetIt.I.get<SharedPreferences>();
ThemeBloc() : super(ThemeState(themeMode: ThemeMode.system)) {
ThemeBloc() : super(ThemeState(currentTheme: AppThemeMode.system)) {
on<LoadThemeEvent>((event, emit) {
String savedTheme = _prefs.getString(_savedThemeKey) ?? 'system';
emit(
state.copyWith(
themeMode: AppThemeMode.values
.firstWhere((test) => test.value == savedTheme)
.themeMode,
currentTheme: AppThemeMode.fromValue(
_prefs.getString(_savedThemeKey),
),
),
);
});
on<ChangeThemeEvent>((event, emit) async {
await _prefs.setString(_savedThemeKey, event.appThemeMode.value);
emit(state.copyWith(themeMode: event.appThemeMode.themeMode));
emit(state.copyWith(currentTheme: event.appThemeMode));
});
}
}