From a1395cb54a6a41c976d7722f76a57ad3e685948d Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Thu, 30 May 2024 11:58:36 +0800 Subject: [PATCH] fix: some list icons don't align with the paragraph (#5439) --- frontend/Makefile.toml | 2 +- .../presentation/editor_configuration.dart | 20 +++++++++---------- .../bulleted_list/bulleted_list_icon.dart | 4 +++- .../todo_list/todo_list_icon.dart | 4 +++- .../document/presentation/editor_style.dart | 18 ++++++++++++----- .../workspace/_sidebar_workspace_menu.dart | 4 ++++ .../lib/colorscheme/default_colorscheme.dart | 5 +++-- frontend/appflowy_flutter/pubspec.yaml | 2 +- 8 files changed, 37 insertions(+), 22 deletions(-) diff --git a/frontend/Makefile.toml b/frontend/Makefile.toml index 5a962f3cbf..a71ffec1fc 100644 --- a/frontend/Makefile.toml +++ b/frontend/Makefile.toml @@ -26,7 +26,7 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true CARGO_MAKE_CRATE_FS_NAME = "dart_ffi" CARGO_MAKE_CRATE_NAME = "dart-ffi" LIB_NAME = "dart_ffi" -APPFLOWY_VERSION = "0.5.8" +APPFLOWY_VERSION = "0.5.9" FLUTTER_DESKTOP_FEATURES = "dart" PRODUCT_NAME = "AppFlowy" MACOSX_DEPLOYMENT_TARGET = "11.0" diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart index fbb60ce1de..966a5685f5 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart @@ -55,9 +55,8 @@ Map getEditorBuilderMap({ configuration: configuration.copyWith( placeholderText: (_) => LocaleKeys.blockPlaceholders_todoList.tr(), ), - iconBuilder: PlatformExtension.isMobile - ? (_, node, onCheck) => TodoListIcon(node: node, onCheck: onCheck) - : null, + iconBuilder: (_, node, onCheck) => + TodoListIcon(node: node, onCheck: onCheck), toggleChildrenTriggers: [ LogicalKeyboardKey.shift, LogicalKeyboardKey.shiftLeft, @@ -68,18 +67,14 @@ Map getEditorBuilderMap({ configuration: configuration.copyWith( placeholderText: (_) => LocaleKeys.blockPlaceholders_bulletList.tr(), ), - iconBuilder: PlatformExtension.isMobile - ? (_, node) => BulletedListIcon(node: node) - : null, + iconBuilder: (_, node) => BulletedListIcon(node: node), ), NumberedListBlockKeys.type: NumberedListBlockComponentBuilder( configuration: configuration.copyWith( placeholderText: (_) => LocaleKeys.blockPlaceholders_numberList.tr(), ), - iconBuilder: PlatformExtension.isMobile - ? (_, node, textDirection) => - NumberedListIcon(node: node, textDirection: textDirection) - : null, + iconBuilder: (_, node, textDirection) => + NumberedListIcon(node: node, textDirection: textDirection), ), QuoteBlockKeys.type: QuoteBlockComponentBuilder( configuration: configuration.copyWith( @@ -169,7 +164,10 @@ Map getEditorBuilderMap({ ), ), CalloutBlockKeys.type: CalloutBlockComponentBuilder( - configuration: configuration, + configuration: configuration.copyWith( + textStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(), + placeholderTextStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(), + ), defaultColor: calloutBGColor, ), DividerBlockKeys.type: DividerBlockComponentBuilder( diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/bulleted_list/bulleted_list_icon.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/bulleted_list/bulleted_list_icon.dart index d0551b03af..abb166ec12 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/bulleted_list/bulleted_list_icon.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/bulleted_list/bulleted_list_icon.dart @@ -37,7 +37,9 @@ class BulletedListIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final iconPadding = context.read().state.iconPadding; + final iconPadding = PlatformExtension.isMobile + ? context.read().state.iconPadding + : 0.0; return Container( constraints: const BoxConstraints( minWidth: 22, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/todo_list/todo_list_icon.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/todo_list/todo_list_icon.dart index deb45c2182..85972a3c2c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/todo_list/todo_list_icon.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/todo_list/todo_list_icon.dart @@ -17,7 +17,9 @@ class TodoListIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final iconPadding = context.read().state.iconPadding; + final iconPadding = PlatformExtension.isMobile + ? context.read().state.iconPadding + : 0.0; final checked = node.attributes[TodoListBlockKeys.checked] ?? false; return GestureDetector( behavior: HitTestBehavior.opaque, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart index 271aa0e340..0b3aca1ce7 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:appflowy/core/helpers/url_launcher.dart'; import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart'; import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart'; @@ -60,6 +58,9 @@ class EditorStyleCustomizer { DefaultAppearanceSettings.getDefaultSelectionColor(context), defaultTextDirection: appearance.defaultTextDirection, textStyleConfiguration: TextStyleConfiguration( + lineHeight: 1.2, + applyHeightToFirstAscent: true, + applyHeightToLastDescent: true, text: baseTextStyle(fontFamily).copyWith( fontSize: fontSize, color: afThemeExtension.onBackground, @@ -80,7 +81,7 @@ class EditorStyleCustomizer { ), code: GoogleFonts.robotoMono( textStyle: baseTextStyle(fontFamily).copyWith( - fontSize: fontSize - 2, + fontSize: fontSize, fontWeight: FontWeight.normal, color: Colors.red, backgroundColor: theme.colorScheme.inverseSurface.withOpacity(0.8), @@ -105,7 +106,6 @@ class EditorStyleCustomizer { final textScaleFactor = context.read().state.textScaleFactor; final baseTextStyle = this.baseTextStyle(fontFamily); - final codeFontSize = max(0.0, fontSize - 2); return EditorStyle.mobile( padding: padding, defaultTextDirection: defaultTextDirection, @@ -127,7 +127,7 @@ class EditorStyleCustomizer { ), code: GoogleFonts.robotoMono( textStyle: baseTextStyle.copyWith( - fontSize: codeFontSize, + fontSize: fontSize, fontWeight: FontWeight.normal, fontStyle: FontStyle.italic, color: Colors.red, @@ -183,6 +183,14 @@ class EditorStyleCustomizer { ); } + TextStyle calloutBlockStyleBuilder() { + final fontSize = context.read().state.fontSize; + return baseTextStyle(null).copyWith( + fontSize: fontSize, + height: 1.5, + ); + } + TextStyle outlineBlockPlaceholderStyleBuilder() { final fontSize = context.read().state.fontSize; return TextStyle( diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart index 9764e11cba..8a1b172aff 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; @@ -242,6 +244,7 @@ class _WorkspaceInfo extends StatelessWidget { rightIcon: const HSpace(32.0), text: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ // workspace name FlowyText.medium( @@ -250,6 +253,7 @@ class _WorkspaceInfo extends StatelessWidget { overflow: TextOverflow.ellipsis, withTooltip: true, ), + if (Platform.isMacOS) const VSpace(2.0), // workspace members count FlowyText.regular( state.isLoading diff --git a/frontend/appflowy_flutter/packages/flowy_infra/lib/colorscheme/default_colorscheme.dart b/frontend/appflowy_flutter/packages/flowy_infra/lib/colorscheme/default_colorscheme.dart index b1c80fab64..8f7120fa84 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra/lib/colorscheme/default_colorscheme.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra/lib/colorscheme/default_colorscheme.dart @@ -19,6 +19,7 @@ const _darkShader3 = Color(0xFF363D49); const _darkShader5 = Color(0xFFBBC3CD); const _darkShader6 = Color(0xFFF2F2F2); const _darkMain1 = Color(0x19FFFFFF); +const _darkMain2 = Color(0xFF00BCF0); const _darkInput = Color(0xFF282E3A); class DefaultColorScheme extends FlowyColorScheme { @@ -103,7 +104,7 @@ class DefaultColorScheme extends FlowyColorScheme { tint7: const Color(0x5900BD2A), tint8: const Color(0x80008890), tint9: const Color(0x4d0029FF), - main1: _darkMain1, + main1: _darkMain2, main2: const Color(0xFF00B7EA), shadow: const Color(0xFF0F131C), sidebarBg: const Color(0xFF232B38), @@ -114,7 +115,7 @@ class DefaultColorScheme extends FlowyColorScheme { secondaryText: _darkShader5, input: _darkInput, hint: const Color(0xFF59647a), - primary: _darkMain1, + primary: _darkMain2, onPrimary: _darkShader1, hoverBG1: _darkMain1, hoverBG2: _darkMain1, diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml index 7c687baf54..22382d9e48 100644 --- a/frontend/appflowy_flutter/pubspec.yaml +++ b/frontend/appflowy_flutter/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.5.8 +version: 0.5.9 environment: flutter: ">=3.22.0"