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';
|
2021-09-05 18:02:49 +08:00
|
|
|
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) {
|
2021-10-12 13:07:41 +08:00
|
|
|
final imageName = _imageNameForViewType(type);
|
2021-07-26 16:35:51 +08:00
|
|
|
return AssetImage('assets/images/$imageName');
|
|
|
|
}
|
|
|
|
|
2021-10-12 13:07:41 +08:00
|
|
|
extension SvgViewType on View {
|
2022-01-10 17:26:12 +02:00
|
|
|
Widget thumbnail({Color? iconColor}) {
|
2021-10-12 13:07:41 +08:00
|
|
|
final imageName = _imageNameForViewType(viewType);
|
2022-01-09 13:22:17 +02:00
|
|
|
final Widget widget = svg(imageName, color: iconColor);
|
2021-10-12 13:07:41 +08:00
|
|
|
return widget;
|
|
|
|
}
|
2021-08-14 15:45:00 +08:00
|
|
|
}
|
|
|
|
|
2021-10-12 13:07:41 +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
|
|
|
}
|
|
|
|
}
|