mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: config new ViewType
This commit is contained in:
parent
d18e06a9ef
commit
23ccfa54b5
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user