mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: reset first page when switching space (#6097)
* fix: reset first page when switching space * fix: primary field icon align issue in grid page
This commit is contained in:
parent
9ee8cc6a7b
commit
9209562648
@ -1,5 +1,5 @@
|
|||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart';
|
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:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
||||||
import 'package:flowy_infra/uuid.dart';
|
import 'package:flowy_infra/uuid.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@ -92,7 +92,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(finder, findsOneWidget);
|
expect(finder, findsOneWidget);
|
||||||
await tester.tapButton(finder);
|
await tester.tapButton(finder);
|
||||||
expect(find.byType(SyncErrorPage), findsOneWidget);
|
expect(find.byType(AppFlowyErrorPage), findsOneWidget);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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/board.dart';
|
||||||
import 'package:appflowy/mobile/presentation/database/board/widgets/group_card_header.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/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/application/database_controller.dart';
|
||||||
import 'package:appflowy/plugins/database/board/application/board_bloc.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/grid/presentation/widgets/header/field_type_extension.dart';
|
||||||
import 'package:appflowy/plugins/database/widgets/card/card.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_builder.dart';
|
||||||
import 'package:appflowy/plugins/database/widgets/cell/card_cell_style_maps/mobile_board_card_cell_style.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/workspace/application/settings/appearance/appearance_cubit.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
||||||
@ -69,10 +69,8 @@ class _MobileBoardPageState extends State<MobileBoardPage> {
|
|||||||
loading: (_) => const Center(
|
loading: (_) => const Center(
|
||||||
child: CircularProgressIndicator.adaptive(),
|
child: CircularProgressIndicator.adaptive(),
|
||||||
),
|
),
|
||||||
error: (err) => FlowyMobileStateContainer.error(
|
error: (err) => AppFlowyErrorPage(
|
||||||
emoji: '🛸',
|
error: err.error,
|
||||||
title: LocaleKeys.board_mobile_failedToLoad.tr(),
|
|
||||||
errorMsg: err.toString(),
|
|
||||||
),
|
),
|
||||||
ready: (data) => const _BoardContent(),
|
ready: (data) => const _BoardContent(),
|
||||||
orElse: () => const SizedBox.shrink(),
|
orElse: () => const SizedBox.shrink(),
|
||||||
|
@ -45,6 +45,7 @@ class MobileFolders extends StatelessWidget {
|
|||||||
SpaceEvent.reset(
|
SpaceEvent.reset(
|
||||||
user,
|
user,
|
||||||
state.currentWorkspace?.workspaceId ?? workspaceId,
|
state.currentWorkspace?.workspaceId ?? workspaceId,
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -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_header.dart';
|
||||||
import 'package:appflowy/mobile/presentation/home/space/mobile_space_menu.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/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/folder/folder_bloc.dart';
|
||||||
import 'package:appflowy/workspace/application/sidebar/space/space_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_bloc.dart';
|
||||||
import 'package:appflowy/workspace/application/view/view_ext.dart';
|
import 'package:appflowy/workspace/application/view/view_ext.dart';
|
||||||
import 'package:appflowy/workspace/presentation/home/home_sizes.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:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -124,8 +126,15 @@ class _Pages extends StatelessWidget {
|
|||||||
final spaceType = space.spacePermission == SpacePermission.publicToAll
|
final spaceType = space.spacePermission == SpacePermission.publicToAll
|
||||||
? FolderSpaceType.public
|
? FolderSpaceType.public
|
||||||
: FolderSpaceType.private;
|
: 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(
|
return Column(
|
||||||
children: state.view.childViews
|
children: childViews
|
||||||
.map(
|
.map(
|
||||||
(view) => MobileViewItem(
|
(view) => MobileViewItem(
|
||||||
key: ValueKey(
|
key: ValueKey(
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.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/application/grid_bloc.dart';
|
||||||
import 'package:appflowy/plugins/database/grid/presentation/widgets/shortcuts.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/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/startup/startup.dart';
|
||||||
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
|
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
|
||||||
import 'package:appflowy_backend/log.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:easy_localization/easy_localization.dart';
|
||||||
import 'package:flowy_infra/theme_extension.dart';
|
import 'package:flowy_infra/theme_extension.dart';
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.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:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:linked_scroll_controller/linked_scroll_controller.dart';
|
import 'package:linked_scroll_controller/linked_scroll_controller.dart';
|
||||||
@ -106,9 +105,8 @@ class _MobileGridPageState extends State<MobileGridPage> {
|
|||||||
_openRow(context, widget.initialRowId, true);
|
_openRow(context, widget.initialRowId, true);
|
||||||
return result.successOrFail.fold(
|
return result.successOrFail.fold(
|
||||||
(_) => GridShortcuts(child: GridPageContent(view: widget.view)),
|
(_) => GridShortcuts(child: GridPageContent(view: widget.view)),
|
||||||
(err) => FlowyErrorPage.message(
|
(err) => AppFlowyErrorPage(
|
||||||
err.toString(),
|
error: err,
|
||||||
howToFix: LocaleKeys.errorDialog_howToFixFallback.tr(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -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/cell/cell_controller.dart';
|
||||||
import 'package:appflowy/plugins/database/application/database_controller.dart';
|
import 'package:appflowy/plugins/database/application/database_controller.dart';
|
||||||
import 'package:appflowy/plugins/database/application/field/field_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/grid/application/row/row_bloc.dart';
|
||||||
import 'package:appflowy/plugins/database/widgets/cell/editable_cell_builder.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:appflowy/plugins/database/widgets/row/cells/mobile_cell_container.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import '../../layout/sizes.dart';
|
import '../../layout/sizes.dart';
|
||||||
@ -81,8 +80,8 @@ class _MobileGridRowState extends State<MobileGridRow> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
await _rowController.dispose();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
await _rowController.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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/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:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@ -17,27 +17,28 @@ class MobileGridTextCellSkin extends IEditableTextCellSkin {
|
|||||||
) {
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
|
const HSpace(10),
|
||||||
BlocBuilder<TextCellBloc, TextCellState>(
|
BlocBuilder<TextCellBloc, TextCellState>(
|
||||||
buildWhen: (p, c) => p.emoji != c.emoji,
|
buildWhen: (p, c) => p.emoji != c.emoji,
|
||||||
builder: (context, state) => Center(
|
builder: (context, state) => Center(
|
||||||
child: FlowyText(
|
child: FlowyText.emoji(
|
||||||
state.emoji,
|
state.emoji,
|
||||||
fontSize: 16,
|
fontSize: 15,
|
||||||
|
optimizeEmojiAlign: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const HSpace(6),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
style:
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15),
|
fontSize: 15,
|
||||||
|
),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
enabledBorder: InputBorder.none,
|
enabledBorder: InputBorder.none,
|
||||||
focusedBorder: InputBorder.none,
|
focusedBorder: InputBorder.none,
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
||||||
EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
||||||
isCollapsed: true,
|
isCollapsed: true,
|
||||||
),
|
),
|
||||||
onTapOutside: (event) => focusNode.unfocus(),
|
onTapOutside: (event) => focusNode.unfocus(),
|
||||||
|
@ -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/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_plugins/plugins.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_style.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/shared/patterns/common_patterns.dart';
|
||||||
import 'package:appflowy/startup/startup.dart';
|
import 'package:appflowy/startup/startup.dart';
|
||||||
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
|
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
|
||||||
@ -114,7 +114,7 @@ class _DocumentPageState extends State<DocumentPage>
|
|||||||
if (error != null || editorState == null) {
|
if (error != null || editorState == null) {
|
||||||
Log.error(error);
|
Log.error(error);
|
||||||
return Center(
|
return Center(
|
||||||
child: SyncErrorPage(
|
child: AppFlowyErrorPage(
|
||||||
error: error,
|
error: error,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -13,8 +13,8 @@ import 'package:flowy_infra_ui/widget/spacing.dart';
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class SyncErrorPage extends StatelessWidget {
|
class AppFlowyErrorPage extends StatelessWidget {
|
||||||
const SyncErrorPage({
|
const AppFlowyErrorPage({
|
||||||
super.key,
|
super.key,
|
||||||
this.error,
|
this.error,
|
||||||
});
|
});
|
@ -296,7 +296,7 @@ class SpaceBloc extends Bloc<SpaceEvent, SpaceState> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
reset: (userProfile, workspaceId) async {
|
reset: (userProfile, workspaceId, openFirstPage) async {
|
||||||
if (workspaceId == _workspaceId) {
|
if (workspaceId == _workspaceId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -738,6 +738,7 @@ class SpaceEvent with _$SpaceEvent {
|
|||||||
const factory SpaceEvent.reset(
|
const factory SpaceEvent.reset(
|
||||||
UserProfilePB userProfile,
|
UserProfilePB userProfile,
|
||||||
String workspaceId,
|
String workspaceId,
|
||||||
|
bool openFirstPage,
|
||||||
) = _Reset;
|
) = _Reset;
|
||||||
const factory SpaceEvent.migrate() = _Migrate;
|
const factory SpaceEvent.migrate() = _Migrate;
|
||||||
const factory SpaceEvent.switchToNextSpace() = _SwitchToNextSpace;
|
const factory SpaceEvent.switchToNextSpace() = _SwitchToNextSpace;
|
||||||
|
@ -196,6 +196,7 @@ class HomeSideBar extends StatelessWidget {
|
|||||||
userProfile,
|
userProfile,
|
||||||
state.currentWorkspace?.workspaceId ??
|
state.currentWorkspace?.workspaceId ??
|
||||||
workspaceSetting.workspaceId,
|
workspaceSetting.workspaceId,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user