26 lines
681 B
Dart
Raw Normal View History

2021-12-19 21:29:33 +08:00
import 'package:flowy_sdk/protobuf/flowy-core-data-model/view_create.pb.dart';
2021-07-26 16:35:51 +08:00
import 'package:flutter/material.dart';
import 'package:flowy_infra/image.dart';
2021-08-14 15:45:00 +08:00
2021-07-26 16:35:51 +08:00
AssetImage assetImageForViewType(ViewType type) {
final imageName = _imageNameForViewType(type);
2021-07-26 16:35:51 +08:00
return AssetImage('assets/images/$imageName');
}
extension SvgViewType on View {
2022-01-09 13:22:17 +02:00
Widget thumbnail(Color iconColor) {
final imageName = _imageNameForViewType(viewType);
2022-01-09 13:22:17 +02:00
final Widget widget = svg(imageName, color: iconColor);
return widget;
}
2021-08-14 15:45:00 +08:00
}
String _imageNameForViewType(ViewType type) {
2021-07-26 16:35:51 +08:00
switch (type) {
case ViewType.Doc:
2021-10-09 16:43:56 +08:00
return "file_icon";
2021-07-26 16:35:51 +08:00
default:
2021-10-09 16:43:56 +08:00
return "file_icon";
2021-07-26 16:35:51 +08:00
}
}