appflowy 3 лет назад
Родитель
Сommit
b03dcde824

+ 4 - 0
app_flowy/assets/images/file_icon.svg

@@ -0,0 +1,4 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M9 2.5V6C9 6.55228 9.44772 7 10 7H12" stroke="#333333"/>
+<path d="M3.5 3.5C3.5 2.94771 3.94772 2.5 4.5 2.5H8H8.5C9.12951 2.5 9.72229 2.79639 10.1 3.3L12.1 5.96667C12.3596 6.31286 12.5 6.73393 12.5 7.16667V8V12.5C12.5 13.0523 12.0523 13.5 11.5 13.5H4.5C3.94772 13.5 3.5 13.0523 3.5 12.5V3.5Z" stroke="#333333"/>
+</svg>

+ 13 - 2
app_flowy/lib/workspace/domain/image.dart

@@ -1,16 +1,27 @@
 import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
 import 'package:flutter/material.dart';
 
+import 'package:flutter_svg/flutter_svg.dart';
+
 AssetImage assetImageForViewType(ViewType type) {
   final imageName = imageNameForViewType(type);
   return AssetImage('assets/images/$imageName');
 }
 
+Widget svgImageForViewType(ViewType type) {
+  final imageName = imageNameForViewType(type);
+  final Widget svg = SvgPicture.asset(
+    'assets/images/$imageName',
+  );
+
+  return svg;
+}
+
 String imageNameForViewType(ViewType type) {
   switch (type) {
     case ViewType.Doc:
-      return "file_icon.jpg";
+      return "file_icon.svg";
     default:
-      return "file_icon.jpg";
+      return "file_icon.svg";
   }
 }

+ 2 - 3
app_flowy/lib/workspace/presentation/view/view_page.dart

@@ -44,11 +44,10 @@ class ViewPage extends StatelessWidget {
       BuildContext context, bool onHover, HoverDisplayConfig config) {
     const double width = 22;
     List<Widget> children = [
-      Image(
-          fit: BoxFit.cover,
+      SizedBox(
           width: width,
           height: width,
-          image: assetImageForViewType(viewCtx.view.viewType)),
+          child: svgImageForViewType(viewCtx.view.viewType)),
       const HSpace(6),
       Text(
         viewCtx.view.name,

+ 0 - 1
app_flowy/packages/flowy_editor/lib/src/service/controller.dart

@@ -111,7 +111,6 @@ class EditorController extends ChangeNotifier {
     Delta? delta;
     if (length > 0 || data is! String || data.isNotEmpty) {
       delta = document.replace(index, length, data);
-      print(delta);
       var shouldRetainDelta = toggledStyle.isNotEmpty &&
           delta.isNotEmpty &&
           delta.length <= 2 &&

+ 35 - 0
app_flowy/pubspec.lock

@@ -321,6 +321,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.0.4"
+  flutter_svg:
+    dependency: "direct main"
+    description:
+      name: flutter_svg
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.22.0"
   flutter_test:
     dependency: "direct dev"
     description: flutter
@@ -492,6 +499,20 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.8.0"
+  path_drawing:
+    dependency: transitive
+    description:
+      name: path_drawing
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.5.1"
+  path_parsing:
+    dependency: transitive
+    description:
+      name: path_parsing
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.2.1"
   path_provider:
     dependency: "direct main"
     description:
@@ -534,6 +555,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.11.1"
+  petitparser:
+    dependency: transitive
+    description:
+      name: petitparser
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "4.2.0"
   photo_view:
     dependency: transitive
     description:
@@ -844,6 +872,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.2.0"
+  xml:
+    dependency: transitive
+    description:
+      name: xml
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "5.1.2"
   yaml:
     dependency: transitive
     description:

+ 1 - 0
app_flowy/pubspec.yaml

@@ -53,6 +53,7 @@ dependencies:
   sized_context: ^1.0.0+1
   styled_widget: '>=0.3.1'
   expandable: ^5.0.1
+  flutter_svg: ^0.22.0
 
 
   # The following adds the Cupertino Icons font to your application.