feat(home): 重构首页为底部导航栏布局,支持首页与个人页面切换

This commit is contained in:
qzl
2026-04-07 18:43:58 +08:00
parent c121c1092f
commit 6e82053ea7
3 changed files with 314 additions and 216 deletions
+18 -1
View File
@@ -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,