AppFlowy/app_flowy/lib/workspace/domain/image.dart

26 lines
648 B
Dart
Raw Normal View History

import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart';
2021-07-26 08:35:51 +00:00
import 'package:flutter/material.dart';
import 'package:flowy_infra/image.dart';
2021-08-14 07:45:00 +00:00
2021-07-26 08:35:51 +00:00
AssetImage assetImageForViewType(ViewType type) {
final imageName = _imageNameForViewType(type);
2021-07-26 08:35:51 +00:00
return AssetImage('assets/images/$imageName');
}
extension SvgViewType on View {
Widget thumbnail() {
final imageName = _imageNameForViewType(viewType);
final Widget widget = svg(imageName);
return widget;
}
2021-08-14 07:45:00 +00:00
}
String _imageNameForViewType(ViewType type) {
2021-07-26 08:35:51 +00:00
switch (type) {
case ViewType.Doc:
2021-10-09 08:43:56 +00:00
return "file_icon";
2021-07-26 08:35:51 +00:00
default:
2021-10-09 08:43:56 +00:00
return "file_icon";
2021-07-26 08:35:51 +00:00
}
}