fix: continue writing edge case (#7535)

This commit is contained in:
Richard Shiue 2025-03-14 11:10:40 +08:00 committed by GitHub
parent 36bf90e81b
commit 6ac9ad1cac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,6 +55,8 @@ class _DocumentPageState extends State<DocumentPage>
Selection? initialSelection;
late final documentBloc = DocumentBloc(documentId: widget.view.id)
..add(const DocumentEvent.initial());
late final viewBloc = ViewBloc(view: widget.view)
..add(const ViewEvent.initial());
@override
void initState() {
@ -66,6 +68,7 @@ class _DocumentPageState extends State<DocumentPage>
void dispose() {
WidgetsBinding.instance.removeObserver(this);
documentBloc.close();
viewBloc.close();
super.dispose();
}
@ -88,14 +91,9 @@ class _DocumentPageState extends State<DocumentPage>
BlocProvider.value(value: documentBloc),
BlocProvider.value(
value: ViewLockStatusBloc(view: widget.view)
..add(
ViewLockStatusEvent.initial(),
),
),
BlocProvider(
create: (_) =>
ViewBloc(view: widget.view)..add(const ViewEvent.initial()),
..add(ViewLockStatusEvent.initial()),
),
BlocProvider.value(value: viewBloc),
],
child: BlocConsumer<ViewLockStatusBloc, ViewLockStatusState>(
listenWhen: (prev, curr) => curr.isLocked != prev.isLocked,