From d7783a6440d56496573b07c7d68b3ecbcbf61799 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Wed, 30 Nov 2022 13:22:16 +0800 Subject: [PATCH 1/2] chore: remove duplicated svg function --- .../home/menu/app/create_button.dart | 2 +- .../workspace/presentation/home/menu/menu.dart | 4 ++-- .../settings/widgets/settings_user_view.dart | 2 +- .../packages/flowy_infra/lib/image.dart | 17 ++--------------- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/create_button.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/create_button.dart index c067361c9c..4903c79543 100644 --- a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/create_button.dart +++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/create_button.dart @@ -20,7 +20,7 @@ class NewAppButton extends StatelessWidget { hoverColor: Colors.transparent, fontColor: Theme.of(context).colorScheme.onSurfaceVariant, onPressed: () async => await _showCreateAppDialog(context), - heading: svgWithSize("home/new_app", const Size(16, 16)), + heading: svgWidget("home/new_app", size: const Size(16, 16)), padding: EdgeInsets.symmetric(horizontal: Insets.l, vertical: 20), ); diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart index 72ffba956f..c17fc228c1 100644 --- a/frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart +++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart @@ -207,8 +207,8 @@ class MenuTopBar extends StatelessWidget { return Container(); } return (Theme.of(context).brightness == Brightness.dark - ? svgWithSize("flowy_logo_dark_mode", const Size(92, 17)) - : svgWithSize("flowy_logo_with_text", const Size(92, 17))); + ? svgWidget("flowy_logo_dark_mode", size: const Size(92, 17)) + : svgWidget("flowy_logo_with_text", size: const Size(92, 17))); } @override diff --git a/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart b/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart index 70b5fc4eef..abd42586ef 100644 --- a/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart +++ b/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart @@ -118,7 +118,7 @@ class _CurrentIcon extends StatelessWidget { margin: const EdgeInsets.all(5.0), decoration: BoxDecoration(border: Border.all(color: Colors.grey)), - child: svgWithSize('emoji/$iconUrl', const Size(60, 60)), + child: svgWidget('emoji/$iconUrl', size: const Size(60, 60)), )), ])), ); diff --git a/frontend/app_flowy/packages/flowy_infra/lib/image.dart b/frontend/app_flowy/packages/flowy_infra/lib/image.dart index 21ef1a2970..4ed4da10bf 100644 --- a/frontend/app_flowy/packages/flowy_infra/lib/image.dart +++ b/frontend/app_flowy/packages/flowy_infra/lib/image.dart @@ -1,26 +1,13 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_svg/flutter_svg.dart'; -Widget svgWithSize(String name, Size size) { - return SizedBox.fromSize( - size: size, - child: svgWidget(name), - ); -} - Widget svgWidget(String name, {Size? size, Color? color}) { if (size != null) { return SizedBox.fromSize( size: size, - child: _svgWidget(name, color: color), + child: SvgPicture.asset('assets/images/$name.svg', color: color), ); } else { - return _svgWidget(name, color: color); + return SvgPicture.asset('assets/images/$name.svg', color: color); } } - -Widget _svgWidget(String name, {Color? color}) { - final Widget svg = SvgPicture.asset('assets/images/$name.svg', color: color); - - return svg; -} From c127fd28b8aa81a2aa73fc73c39ebf8c799c7c97 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Wed, 30 Nov 2022 13:23:03 +0800 Subject: [PATCH 2/2] chore: fix flutter analyze --- .../appflowy_editor/lib/src/render/rich_text/checkbox_text.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart index 90c2eb3fb4..461fef0f30 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart @@ -83,7 +83,6 @@ class _CheckboxNodeWidgetState extends State children: [ GestureDetector( key: iconKey, - child: icon, behavior: HitTestBehavior.opaque, onTap: () async { await widget.editorState.formatTextToCheckbox( @@ -92,6 +91,7 @@ class _CheckboxNodeWidgetState extends State textNode: widget.textNode, ); }, + child: icon, ), Flexible( child: FlowyRichText(