feat(home): 重构首页为底部导航栏布局,支持首页与个人页面切换
This commit is contained in:
+18
-1
@@ -242,15 +242,31 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
return updated;
|
||||
}
|
||||
|
||||
Future<ProfileSettingsV1> _saveProfile(ProfileSettingsV1 updated) async {
|
||||
final saved = await _profileApi.updateProfile(updated);
|
||||
if (!mounted) {
|
||||
return saved;
|
||||
}
|
||||
setState(() {
|
||||
_profileSettings = saved;
|
||||
});
|
||||
return saved;
|
||||
}
|
||||
|
||||
Future<void> _saveProfileSettings(ProfileSettingsV1 next) async {
|
||||
try {
|
||||
final saved = await _profileApi.updateProfile(next);
|
||||
final oldLanguage = _profileSettings.preferences.interfaceLanguage;
|
||||
final newLanguage = next.preferences.interfaceLanguage;
|
||||
final saved = await _profileApi.updateSettings(next);
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_profileSettings = saved;
|
||||
});
|
||||
if (oldLanguage != newLanguage) {
|
||||
await _handleInterfaceLanguageChanged(newLanguage);
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Failed to save profile settings via API',
|
||||
@@ -341,6 +357,7 @@ class _EryaoAppState extends State<EryaoApp> {
|
||||
coinBalance: _creditsBalance,
|
||||
onLocaleChanged: _handleInterfaceLanguageChanged,
|
||||
onProfileSettingsChanged: _saveProfileSettings,
|
||||
onSaveProfile: _saveProfile,
|
||||
onUploadAvatar: _uploadAvatar,
|
||||
onDivinationCompleted: _handleDivinationCompleted,
|
||||
onLogout: _authBloc.logout,
|
||||
|
||||
Reference in New Issue
Block a user