Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

load svg asset

appflowyb03dcde824f1
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 @@
+<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>
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<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,
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.