diff --git a/app_flowy/assets/images/file_icon.svg b/app_flowy/assets/images/file_icon.svg new file mode 100644 index 0000000000..f0fb8ce9ce --- /dev/null +++ b/app_flowy/assets/images/file_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/app_flowy/lib/workspace/domain/image.dart b/app_flowy/lib/workspace/domain/image.dart index 0ee8ad46a6..257a95a13c 100644 --- a/app_flowy/lib/workspace/domain/image.dart +++ b/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"; } } diff --git a/app_flowy/lib/workspace/presentation/view/view_page.dart b/app_flowy/lib/workspace/presentation/view/view_page.dart index 1b787ce49d..47c821b1ed 100644 --- a/app_flowy/lib/workspace/presentation/view/view_page.dart +++ b/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 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, diff --git a/app_flowy/packages/flowy_editor/lib/src/service/controller.dart b/app_flowy/packages/flowy_editor/lib/src/service/controller.dart index 1275740594..e9f9339fa6 100644 --- a/app_flowy/packages/flowy_editor/lib/src/service/controller.dart +++ b/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 && diff --git a/app_flowy/pubspec.lock b/app_flowy/pubspec.lock index 74c8ac4df5..587b29a171 100644 --- a/app_flowy/pubspec.lock +++ b/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: diff --git a/app_flowy/pubspec.yaml b/app_flowy/pubspec.yaml index 9a3afb20c1..2bf4fe6b86 100644 --- a/app_flowy/pubspec.yaml +++ b/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.