refactor: 重构 main 函数,将初始化逻辑提取到 AppInitializer

This commit is contained in:
Developer
2026-03-30 02:56:54 +08:00
parent e89889d933
commit 99464d8fe6
3 changed files with 121 additions and 72 deletions

View File

@@ -102,9 +102,7 @@ class _ProfilePageState extends State<ProfilePage>
setState(() {
_poetryHistory = history;
});
} catch (e) {
print('加载历史记录失败: $e');
}
} catch (e) {}
}
Future<void> _savePoetryToHistory(Map<String, dynamic> poetryData) async {
@@ -117,7 +115,6 @@ class _ProfilePageState extends State<ProfilePage>
_showSnackBar('该诗词已在历史记录中');
}
} catch (e) {
print('保存历史记录失败: $e');
_showSnackBar('保存失败');
}
}
@@ -135,7 +132,6 @@ class _ProfilePageState extends State<ProfilePage>
_showSnackBar('清空失败');
}
} catch (e) {
print('清空历史记录失败: $e');
_showSnackBar('清空失败');
}
}