Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: row document images (#7322)

Richard Shiue6823fe5d240e
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
index b373e33b2f..cefcafa03b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:appflowy/util/field_type_extension.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:flutter/material.dart' hide Card;
import 'package:flutter/services.dart';
@@ -856,10 +857,13 @@ void _openCard({
FlowyOverlay.show(
context: context,
- builder: (_) => RowDetailPage(
- databaseController: databaseController,
- rowController: rowController,
- userProfile: context.read<BoardBloc>().userProfile,
+ builder: (_) => BlocProvider.value(
+ value: context.read<UserWorkspaceBloc>(),
+ child: RowDetailPage(
+ databaseController: databaseController,
+ rowController: rowController,
+ userProfile: context.read<BoardBloc>().userProfile,
+ ),
),
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
index c2a90fb49e..c1c127c522 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
@@ -1,5 +1,6 @@
import 'dart:io';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart';
@@ -426,10 +427,13 @@ class HiddenGroupPopupItemList extends StatelessWidget {
onPressed: () {
FlowyOverlay.show(
context: context,
- builder: (_) => RowDetailPage(
- databaseController: databaseController,
- rowController: rowController,
- userProfile: context.read<BoardBloc>().userProfile,
+ builder: (_) => BlocProvider.value(
+ value: context.read<UserWorkspaceBloc>(),
+ child: RowDetailPage(
+ databaseController: databaseController,
+ rowController: rowController,
+ userProfile: context.read<BoardBloc>().userProfile,
+ ),
),
);
PopoverContainer.of(context).close();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
index d4abb79a32..8df96350f9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
@@ -1,5 +1,6 @@
import 'package:appflowy/plugins/database/application/row/row_controller.dart';
import 'package:appflowy/plugins/database/widgets/row/row_detail.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart';
@@ -178,10 +179,13 @@ class _EventCardState extends State<EventCard> {
FlowyOverlay.show(
context: context,
- builder: (_) => RowDetailPage(
- databaseController: widget.databaseController,
- rowController: rowController,
- userProfile: context.read<CalendarBloc>().userProfile,
+ builder: (_) => BlocProvider.value(
+ value: context.read<UserWorkspaceBloc>(),
+ child: RowDetailPage(
+ databaseController: widget.databaseController,
+ rowController: rowController,
+ userProfile: context.read<CalendarBloc>().userProfile,
+ ),
),
);
},
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
index 231c8830d9..8c46cf75a8 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
@@ -1,5 +1,6 @@
import 'package:appflowy/plugins/database/grid/presentation/grid_page.dart';
import 'package:appflowy/plugins/database/tab_bar/desktop/setting_menu.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:flutter/material.dart';
@@ -13,7 +14,6 @@ import 'package:appflowy/plugins/database/calendar/application/calendar_bloc.dar
import 'package:appflowy/plugins/database/calendar/application/unschedule_event_bloc.dart';
import 'package:appflowy/plugins/database/grid/presentation/layout/sizes.dart';
import 'package:appflowy/plugins/database/tab_bar/tab_bar_view.dart';
-import 'package:appflowy/workspace/application/view/view_bloc.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:calendar_view/calendar_view.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -390,7 +390,7 @@ void showEventDetails({
context: context,
builder: (BuildContext overlayContext) {
return BlocProvider.value(
- value: context.read<ViewBloc>(),
+ value: context.read<UserWorkspaceBloc>(),
child: RowDetailPage(
rowController: rowController,
databaseController: databaseController,
@@ -457,14 +457,18 @@ class _UnscheduledEventsButtonState extends State<UnscheduledEventsButton> {
),
),
),
- popupBuilder: (_) => BlocProvider.value(
- value: context.read<CalendarBloc>(),
- child: BlocProvider.value(
- value: context.read<ViewBloc>(),
- child: UnscheduleEventsList(
- databaseController: widget.databaseController,
- unscheduleEvents: state.unscheduleEvents,
+ popupBuilder: (_) => MultiBlocProvider(
+ providers: [
+ BlocProvider.value(
+ value: context.read<CalendarBloc>(),
),
+ BlocProvider.value(
+ value: context.read<UserWorkspaceBloc>(),
+ ),
+ ],
+ child: UnscheduleEventsList(
+ databaseController: widget.databaseController,
+ unscheduleEvents: state.unscheduleEvents,
),
),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
index 19330221c6..fb32a2868b 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:appflowy/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart';
import 'package:appflowy/plugins/database/tab_bar/desktop/setting_menu.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
@@ -13,7 +14,6 @@ import 'package:appflowy/plugins/database/widgets/cell/editable_cell_builder.dar
import 'package:appflowy/shared/flowy_error_page.dart';
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart';
-import 'package:appflowy/workspace/application/view/view_bloc.dart';
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
@@ -196,7 +196,7 @@ class _GridPageState extends State<GridPage> {
FlowyOverlay.show(
context: context,
builder: (_) => BlocProvider.value(
- value: context.read<ViewBloc>(),
+ value: context.read<UserWorkspaceBloc>(),
child: RowDetailPage(
databaseController: context.read<GridBloc>().databaseController,
rowController: rowController,
@@ -233,7 +233,7 @@ class _GridPageState extends State<GridPage> {
FlowyOverlay.show(
context: context,
builder: (_) => BlocProvider.value(
- value: context.read<ViewBloc>(),
+ value: context.read<UserWorkspaceBloc>(),
child: RowDetailPage(
databaseController:
context.read<GridBloc>().databaseController,
@@ -559,7 +559,7 @@ class _GridRowsState extends State<_GridRows> {
}
return BlocProvider.value(
- value: context.read<ViewBloc>(),
+ value: context.read<UserWorkspaceBloc>(),
child: RowDetailPage(
rowController: RowController(
viewId: viewId,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/relation_row_detail.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/relation_row_detail.dart
index 256de6bc3c..e8d96734dd 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/relation_row_detail.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/relation_row_detail.dart
@@ -1,4 +1,5 @@
import 'package:appflowy/plugins/database/application/row/related_row_detail_bloc.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -26,10 +27,13 @@ class RelatedRowDetailPage extends StatelessWidget {
return state.when(
loading: () => const SizedBox.shrink(),
ready: (databaseController, rowController) {
- return RowDetailPage(
- databaseController: databaseController,
- rowController: rowController,
- allowOpenAsFullPage: false,
+ return BlocProvider.value(
+ value: context.read<UserWorkspaceBloc>(),
+ child: RowDetailPage(
+ databaseController: databaseController,
+ rowController: rowController,
+ allowOpenAsFullPage: false,
+ ),
);
},
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart
index 21caa81297..b07e0b3b08 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart
@@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/plugins/document/application/document_bloc.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/block_menu/block_menu_button.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/clipboard_service.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/common.dart';
@@ -145,7 +146,8 @@ class _ImageMenuState extends State<ImageMenu> {
showDialog(
context: context,
builder: (_) => InteractiveImageViewer(
- userProfile: context.read<UserWorkspaceBloc>().userProfile,
+ userProfile: context.read<UserWorkspaceBloc?>()?.userProfile ??
+ context.read<DocumentBloc>().state.userProfilePB,
imageProvider: AFBlockImageProvider(
images: [
ImageBlockData(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart
index 1105480bf3..4b53bca127 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart
@@ -54,7 +54,8 @@ class _ImageBrowserLayoutState extends State<ImageBrowserLayout> {
@override
void initState() {
super.initState();
- _userProfile = context.read<UserWorkspaceBloc?>()?.userProfile;
+ _userProfile = context.read<UserWorkspaceBloc?>()?.userProfile ??
+ context.read<DocumentBloc>().state.userProfilePB;
}
@override
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
index 99524b0d71..eb8e8a2707 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
@@ -73,7 +73,6 @@ class _ResizableImageState extends State<ResizableImage> {
imageWidth = widget.width;
- // read the user profile from the user workspace bloc or the document bloc
_userProfilePB = context.read<UserWorkspaceBloc?>()?.userProfile ??
context.read<DocumentBloc>().state.userProfilePB;
}