This commit is contained in:
2026-04-04 19:25:55 +02:00
parent c91415b8b3
commit 0347a354ef
13 changed files with 377 additions and 113 deletions

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flux/theme.dart';
import 'package:flux/theme/theme.dart';
class AnagraficheMainView extends StatelessWidget {
const AnagraficheMainView({super.key});

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flux/theme.dart';
import 'package:flux/theme/theme.dart';
class DashboardView extends StatelessWidget {
const DashboardView({super.key});

View File

@@ -1,5 +1,7 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter/material.dart';
import 'package:flux/theme.dart';
import 'package:flux/theme/theme.dart';
import 'package:flux/theme/theme_bloc.dart';
import 'package:flux/ui/anagrafiche/anagrafiche_main_view.dart';
import 'package:flux/ui/dashboard/dashboard_view.dart';
import 'package:flux/ui/settings/settings_view.dart';
@@ -29,38 +31,46 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.dashboard_outlined),
activeIcon: Icon(Icons.dashboard),
label: 'Dashboard',
return BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return Scaffold(
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.dashboard_outlined),
activeIcon: Icon(Icons.dashboard),
label: 'Dashboard',
),
BottomNavigationBarItem(
icon: Icon(Icons.history_edu_outlined),
activeIcon: Icon(Icons.history_edu),
label: 'Operazioni',
),
BottomNavigationBarItem(
icon: Icon(Icons.people_alt_outlined),
activeIcon: Icon(Icons.people_alt),
label: 'Anagrafiche',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings_outlined),
activeIcon: Icon(Icons.settings),
label: 'Impostazioni',
),
],
currentIndex: _selectedIndex,
selectedItemColor: FluxColors.accentTurquoise,
unselectedItemColor: state.themeMode == ThemeMode.dark
? FluxColors.darkTextSecondary
: FluxColors.lightTextSecondary,
backgroundColor: state.themeMode == ThemeMode.dark
? FluxColors.darkSurface
: FluxColors.lightSurface,
type: BottomNavigationBarType.fixed,
onTap: _onItemTapped,
),
BottomNavigationBarItem(
icon: Icon(Icons.history_edu_outlined),
activeIcon: Icon(Icons.history_edu),
label: 'Operazioni',
),
BottomNavigationBarItem(
icon: Icon(Icons.people_alt_outlined),
activeIcon: Icon(Icons.people_alt),
label: 'Anagrafiche',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings_outlined),
activeIcon: Icon(Icons.settings),
label: 'Impostazioni',
),
],
currentIndex: _selectedIndex,
selectedItemColor: FluxColors.accentTurquoise,
unselectedItemColor: FluxColors.textSecondary,
backgroundColor: FluxColors.surface,
type: BottomNavigationBarType.fixed,
onTap: _onItemTapped,
),
);
},
);
}
}

View File

@@ -0,0 +1,39 @@
import 'package:flux/theme/theme_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AppSettings {
late AppTheme _appTheme;
late SharedPreferences _prefs;
// Singleton
static final AppSettings _instance = AppSettings._internal();
factory AppSettings() {
return _instance;
}
AppSettings._internal() {
_prefs = GetIt.I.get<SharedPreferences>();
String theme = _prefs.getString('theme') ?? 'light';
switch (theme) {
case 'dark':
_appTheme = AppTheme.dark;
break;
case 'light':
_appTheme = AppTheme.light;
break;
default:
_appTheme = AppTheme.system;
break;
}
}
AppTheme get appTheme => _appTheme;
void setAppTheme(AppTheme theme) {
_appTheme = theme;
_prefs.setString('theme', theme.name);
}
}

View File

@@ -1,6 +1,6 @@
// lib/ui/impostazioni/impostazioni_view.dart
import 'package:flutter/material.dart';
import 'package:flux/theme.dart';
import 'package:flux/theme/theme.dart';
class SettingsView extends StatelessWidget {
const SettingsView({super.key});