51 lines
1.0 KiB
Dart
Raw Normal View History

2022-03-01 10:25:21 +08:00
import 'package:app_flowy/plugin/plugin.dart';
2022-02-28 22:38:53 +08:00
import 'package:flowy_infra/image.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
2022-02-28 22:38:53 +08:00
import 'package:flutter/material.dart';
2021-10-12 16:58:05 +08:00
2022-02-28 22:38:53 +08:00
enum FlowyPlugin {
editor,
kanban,
2021-10-12 16:58:05 +08:00
}
2022-02-28 22:38:53 +08:00
extension FlowyPluginExtension on FlowyPlugin {
2022-02-26 18:35:42 +08:00
String displayName() {
switch (this) {
2022-02-28 22:38:53 +08:00
case FlowyPlugin.editor:
2022-02-26 18:35:42 +08:00
return "Doc";
2022-02-28 22:38:53 +08:00
case FlowyPlugin.kanban:
2022-02-26 18:35:42 +08:00
return "Kanban";
default:
return "";
}
}
bool enable() {
switch (this) {
2022-02-28 22:38:53 +08:00
case FlowyPlugin.editor:
2022-02-26 18:35:42 +08:00
return true;
2022-02-28 22:38:53 +08:00
case FlowyPlugin.kanban:
2022-02-26 18:35:42 +08:00
return false;
default:
return false;
}
}
}
2022-02-28 22:38:53 +08:00
extension ViewExtension on View {
Widget renderThumbnail({Color? iconColor}) {
String thumbnail = this.thumbnail;
if (thumbnail.isEmpty) {
thumbnail = "file_icon";
}
final Widget widget = svg(thumbnail, color: iconColor);
return widget;
}
2022-03-01 10:25:21 +08:00
Plugin plugin() {
final plugin = makePlugin(pluginType: pluginType, data: this);
return plugin;
}
2022-02-28 22:38:53 +08:00
}