diff --git a/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_page_test.dart b/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_page_test.dart index ed30529149..45613fe97f 100644 --- a/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_page_test.dart +++ b/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_page_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart'; -import 'package:appflowy/plugins/document/presentation/sync_error_page.dart'; +import 'package:appflowy/shared/flowy_error_page.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -92,7 +92,7 @@ void main() { ); expect(finder, findsOneWidget); await tester.tapButton(finder); - expect(find.byType(SyncErrorPage), findsOneWidget); + expect(find.byType(AppFlowyErrorPage), findsOneWidget); }); }); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart index a1fc2a70a3..a80a28c124 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart @@ -3,13 +3,13 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/database/board/board.dart'; import 'package:appflowy/mobile/presentation/database/board/widgets/group_card_header.dart'; import 'package:appflowy/mobile/presentation/database/card/card.dart'; -import 'package:appflowy/mobile/presentation/widgets/widgets.dart'; import 'package:appflowy/plugins/database/application/database_controller.dart'; import 'package:appflowy/plugins/database/board/application/board_bloc.dart'; import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_type_extension.dart'; import 'package:appflowy/plugins/database/widgets/card/card.dart'; import 'package:appflowy/plugins/database/widgets/cell/card_cell_builder.dart'; import 'package:appflowy/plugins/database/widgets/cell/card_cell_style_maps/mobile_board_card_cell_style.dart'; +import 'package:appflowy/shared/flowy_error_page.dart'; import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; @@ -69,10 +69,8 @@ class _MobileBoardPageState extends State { loading: (_) => const Center( child: CircularProgressIndicator.adaptive(), ), - error: (err) => FlowyMobileStateContainer.error( - emoji: '🛸', - title: LocaleKeys.board_mobile_failedToLoad.tr(), - errorMsg: err.toString(), + error: (err) => AppFlowyErrorPage( + error: err.error, ), ready: (data) => const _BoardContent(), orElse: () => const SizedBox.shrink(), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart index c7a4acd07f..0013650df9 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart @@ -45,6 +45,7 @@ class MobileFolders extends StatelessWidget { SpaceEvent.reset( user, state.currentWorkspace?.workspaceId ?? workspaceId, + false, ), ); }, diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/space/mobile_space.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/space/mobile_space.dart index ec2636eb0d..41f36f7b70 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/space/mobile_space.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/space/mobile_space.dart @@ -4,11 +4,13 @@ import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart'; import 'package:appflowy/mobile/presentation/home/space/mobile_space_header.dart'; import 'package:appflowy/mobile/presentation/home/space/mobile_space_menu.dart'; import 'package:appflowy/mobile/presentation/page_item/mobile_view_item.dart'; +import 'package:appflowy/shared/list_extension.dart'; import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/application/sidebar/space/space_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/presentation/home/home_sizes.dart'; +import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -124,8 +126,15 @@ class _Pages extends StatelessWidget { final spaceType = space.spacePermission == SpacePermission.publicToAll ? FolderSpaceType.public : FolderSpaceType.private; + final childViews = state.view.childViews.unique((view) => view.id); + if (childViews.length != state.view.childViews.length) { + final duplicatedViews = state.view.childViews + .where((view) => childViews.contains(view)) + .toList(); + Log.error('some view id are duplicated: $duplicatedViews'); + } return Column( - children: state.view.childViews + children: childViews .map( (view) => MobileViewItem( key: ValueKey( diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart index 80952f30f2..210bd8b2a7 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart'; @@ -9,6 +7,7 @@ import 'package:appflowy/plugins/database/application/row/row_service.dart'; import 'package:appflowy/plugins/database/grid/application/grid_bloc.dart'; import 'package:appflowy/plugins/database/grid/presentation/widgets/shortcuts.dart'; import 'package:appflowy/plugins/database/tab_bar/tab_bar_view.dart'; +import 'package:appflowy/shared/flowy_error_page.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart'; import 'package:appflowy_backend/log.dart'; @@ -18,7 +17,7 @@ import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; -import 'package:flowy_infra_ui/widget/error_page.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:linked_scroll_controller/linked_scroll_controller.dart'; @@ -106,9 +105,8 @@ class _MobileGridPageState extends State { _openRow(context, widget.initialRowId, true); return result.successOrFail.fold( (_) => GridShortcuts(child: GridPageContent(view: widget.view)), - (err) => FlowyErrorPage.message( - err.toString(), - howToFix: LocaleKeys.errorDialog_howToFixFallback.tr(), + (err) => AppFlowyErrorPage( + error: err, ), ); }, diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart index f4e9d0c751..cca01bc036 100755 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/plugins/database/application/cell/cell_controller.dart'; import 'package:appflowy/plugins/database/application/database_controller.dart'; import 'package:appflowy/plugins/database/application/field/field_controller.dart'; @@ -9,6 +7,7 @@ import 'package:appflowy/plugins/database/application/row/row_service.dart'; import 'package:appflowy/plugins/database/grid/application/row/row_bloc.dart'; import 'package:appflowy/plugins/database/widgets/cell/editable_cell_builder.dart'; import 'package:appflowy/plugins/database/widgets/row/cells/mobile_cell_container.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../layout/sizes.dart'; @@ -81,8 +80,8 @@ class _MobileGridRowState extends State { @override Future dispose() async { - await _rowController.dispose(); super.dispose(); + await _rowController.dispose(); } } diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart index bef6202934..c91ec05f79 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart @@ -1,5 +1,5 @@ -import 'package:appflowy/plugins/database/widgets/row/cells/cell_container.dart'; import 'package:appflowy/plugins/database/application/cell/bloc/text_cell_bloc.dart'; +import 'package:appflowy/plugins/database/widgets/row/cells/cell_container.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -17,27 +17,28 @@ class MobileGridTextCellSkin extends IEditableTextCellSkin { ) { return Row( children: [ + const HSpace(10), BlocBuilder( buildWhen: (p, c) => p.emoji != c.emoji, builder: (context, state) => Center( - child: FlowyText( + child: FlowyText.emoji( state.emoji, - fontSize: 16, + fontSize: 15, + optimizeEmojiAlign: true, ), ), ), - const HSpace(6), Expanded( child: TextField( controller: textEditingController, focusNode: focusNode, - style: - Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15), + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontSize: 15, + ), decoration: const InputDecoration( enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, - contentPadding: - EdgeInsets.symmetric(horizontal: 14, vertical: 12), + contentPadding: EdgeInsets.symmetric(horizontal: 4), isCollapsed: true, ), onTapOutside: (event) => focusNode.unfocus(), diff --git a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart index ed4ed73dff..1827a42bf6 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart @@ -11,7 +11,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/image/cust import 'package:appflowy/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart'; import 'package:appflowy/plugins/document/presentation/editor_style.dart'; -import 'package:appflowy/plugins/document/presentation/sync_error_page.dart'; +import 'package:appflowy/shared/flowy_error_page.dart'; import 'package:appflowy/shared/patterns/common_patterns.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart'; @@ -114,7 +114,7 @@ class _DocumentPageState extends State if (error != null || editorState == null) { Log.error(error); return Center( - child: SyncErrorPage( + child: AppFlowyErrorPage( error: error, ), ); diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/sync_error_page.dart b/frontend/appflowy_flutter/lib/shared/flowy_error_page.dart similarity index 98% rename from frontend/appflowy_flutter/lib/plugins/document/presentation/sync_error_page.dart rename to frontend/appflowy_flutter/lib/shared/flowy_error_page.dart index 6318254284..30e5bf9c3c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/sync_error_page.dart +++ b/frontend/appflowy_flutter/lib/shared/flowy_error_page.dart @@ -13,8 +13,8 @@ import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -class SyncErrorPage extends StatelessWidget { - const SyncErrorPage({ +class AppFlowyErrorPage extends StatelessWidget { + const AppFlowyErrorPage({ super.key, this.error, }); diff --git a/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart index 03a8f48be2..3d493f536c 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/sidebar/space/space_bloc.dart @@ -296,7 +296,7 @@ class SpaceBloc extends Bloc { ), ); }, - reset: (userProfile, workspaceId) async { + reset: (userProfile, workspaceId, openFirstPage) async { if (workspaceId == _workspaceId) { return; } @@ -738,6 +738,7 @@ class SpaceEvent with _$SpaceEvent { const factory SpaceEvent.reset( UserProfilePB userProfile, String workspaceId, + bool openFirstPage, ) = _Reset; const factory SpaceEvent.migrate() = _Migrate; const factory SpaceEvent.switchToNextSpace() = _SwitchToNextSpace; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart index da49268c53..4ff8649767 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart @@ -196,6 +196,7 @@ class HomeSideBar extends StatelessWidget { userProfile, state.currentWorkspace?.workspaceId ?? workspaceSetting.workspaceId, + true, ), ); }