26 lines
677 B
Dart
Raw Normal View History

2022-01-13 11:16:26 +08:00
import 'package:flowy_sdk/protobuf/flowy-core-data-model/view.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-10 17:26:12 +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
}
}