feat: Add welcome wizard for new users

- Implemented a multi-page welcome wizard to introduce new users to the app's features.
- Added localization support for the wizard in English, Spanish, French, Croatian, Italian, and Slovenian.
- Integrated wizard completion state management using SharedPreferences.
- Updated main app flow to show the wizard if it hasn't been completed.
- Added a settings option to view the welcome tutorial again.
This commit is contained in:
Janez T
2025-10-28 11:20:30 +01:00
parent 1249f39ac2
commit 5d943ff1a4
20 changed files with 1856 additions and 19 deletions

View File

@@ -15,8 +15,10 @@ import 'services/tile_cache_service.dart';
import 'services/notification_service.dart';
import 'services/locale_preferences.dart';
import 'services/update_checker_service.dart';
import 'services/wizard_preferences.dart';
import 'widgets/update_dialog.dart';
import 'screens/home_screen.dart';
import 'screens/welcome_wizard_screen.dart';
import 'theme/app_theme.dart';
import 'l10n/app_localizations.dart';
@@ -36,6 +38,7 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
Locale? _locale;
bool _isInitialized = false;
bool _shouldShowPermissionDialog = false;
bool _wizardCompleted = true; // Will be updated in _initializeApp()
@override
void initState() {
@@ -46,6 +49,10 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
Future<void> _initializeApp() async {
await _loadThemePreference();
await _loadLocalePreference();
// Check if welcome wizard has been completed
final wizardCompleted = await WizardPreferences.isWizardCompleted();
// Initialize notification service
await NotificationService().initialize();
@@ -57,6 +64,7 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
_checkForUpdates();
setState(() {
_wizardCompleted = wizardCompleted;
_isInitialized = true;
});
}
@@ -102,6 +110,12 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
});
}
void _handleWizardCompleted() {
setState(() {
_wizardCompleted = true;
});
}
/// Check for app updates on Android only
/// Shows dialog if update is available
Future<void> _checkForUpdates() async {
@@ -224,13 +238,17 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: LocalePreferences.supportedLocales,
home: HomeScreen(
onThemeChanged: _handleThemeChanged,
onLocaleChanged: _handleLocaleChanged,
currentTheme: _themeMode,
currentLocale: _locale,
shouldShowPermissionDialog: _shouldShowPermissionDialog,
),
home: _wizardCompleted
? HomeScreen(
onThemeChanged: _handleThemeChanged,
onLocaleChanged: _handleLocaleChanged,
currentTheme: _themeMode,
currentLocale: _locale,
shouldShowPermissionDialog: _shouldShowPermissionDialog,
)
: WelcomeWizardScreen(
onCompleted: _handleWizardCompleted,
),
);
},
);