2021-11-08 02:25:10 +00:00
|
|
|
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';
|
2021-09-05 10:02:49 +00:00
|
|
|
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) {
|
2021-10-12 05:07:41 +00:00
|
|
|
final imageName = _imageNameForViewType(type);
|
2021-07-26 08:35:51 +00:00
|
|
|
return AssetImage('assets/images/$imageName');
|
|
|
|
}
|
|
|
|
|
2021-10-12 05:07:41 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-10-12 05:07:41 +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
|
|
|
}
|
|
|
|
}
|