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.

feat: config new ViewType

appflowy23ccfa54b5b0
diff --git a/frontend/app_flowy/lib/workspace/domain/view_ext.dart b/frontend/app_flowy/lib/workspace/domain/view_ext.dart
index fedbb55342..a15fcec351 100644
--- a/frontend/app_flowy/lib/workspace/domain/view_ext.dart
+++ b/frontend/app_flowy/lib/workspace/domain/view_ext.dart
@@ -28,3 +28,27 @@ extension ToHomeStackType on View {
}
}
}
+
+extension ViewTypeExtension on ViewType {
+ String displayName() {
+ switch (this) {
+ case ViewType.QuillDocument:
+ return "Doc";
+ case ViewType.Kanban:
+ return "Kanban";
+ default:
+ return "";
+ }
+ }
+
+ bool enable() {
+ switch (this) {
+ case ViewType.QuillDocument:
+ return true;
+ case ViewType.Kanban:
+ return false;
+ default:
+ return false;
+ }
+ }
+}
diff --git a/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/add_button.dart b/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/add_button.dart
index 106638e2c2..dbb0c6c24f 100644
--- a/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/add_button.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/add_button.dart
@@ -1,3 +1,4 @@
+import 'package:app_flowy/workspace/domain/view_ext.dart';
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
@@ -41,7 +42,7 @@ class ActionList {
const ActionList({required this.anchorContext, required this.onSelected});
void show(BuildContext buildContext) {
- final items = ViewType.values.where((element) => element != ViewType.Blank).map((ty) {
+ final items = ViewType.values.where((element) => element.enable()).map((ty) {
return CreateItem(
viewType: ty,
onSelected: (viewType) {
@@ -83,7 +84,7 @@ class CreateItem extends StatelessWidget {
return GestureDetector(
onTap: () => onSelected(viewType),
child: FlowyText.medium(
- viewType.name,
+ viewType.displayName(),
color: theme.textColor,
fontSize: 12,
).padding(horizontal: 10, vertical: 6),