切换语言无需重启
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
import '../main.dart';
|
||||
|
||||
/// Settings Screen - MVP version with duration presets
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
@@ -74,14 +75,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_selectedLocale = localeCode;
|
||||
});
|
||||
|
||||
// Show snackbar to inform user to restart
|
||||
// Update locale immediately without restart
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.onboardingReset),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
MyApp.updateLocale(context, localeCode);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user