refactor: 重构 main 函数,将初始化逻辑提取到 AppInitializer
This commit is contained in:
@@ -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('清空失败');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user