代码优化2

This commit is contained in:
DelLevin-Home
2026-06-27 19:20:03 +08:00
parent bcff4f6c01
commit a1fe0a23ef
31 changed files with 285 additions and 162 deletions

View File

@@ -24,8 +24,10 @@ class NotePlusDetailPage extends StatelessWidget {
builder: (context, provider, _) {
final doc = provider.currentDocument;
if (doc == null || doc.id != documentId) {
// 加载文档
provider.loadDocumentById(documentId);
// 加载文档(延迟到 build 完成后执行,避免副作用)
WidgetsBinding.instance.addPostFrameCallback((_) {
provider.loadDocumentById(documentId);
});
return Scaffold(
backgroundColor: colors.surface,
body: const Center(child: CircularProgressIndicator()),