feat: config new ViewType

This commit is contained in:
appflowy 2022-02-26 18:35:42 +08:00
parent d18e06a9ef
commit 23ccfa54b5
2 changed files with 27 additions and 2 deletions

View File

@ -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;
}
}
}

View File

@ -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),