fix: some list icons don't align with the paragraph (#5439)

This commit is contained in:
Lucas.Xu 2024-05-30 11:58:36 +08:00 committed by GitHub
parent 526de2eb5c
commit a1395cb54a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 37 additions and 22 deletions

View File

@ -26,7 +26,7 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi" CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi" CARGO_MAKE_CRATE_NAME = "dart-ffi"
LIB_NAME = "dart_ffi" LIB_NAME = "dart_ffi"
APPFLOWY_VERSION = "0.5.8" APPFLOWY_VERSION = "0.5.9"
FLUTTER_DESKTOP_FEATURES = "dart" FLUTTER_DESKTOP_FEATURES = "dart"
PRODUCT_NAME = "AppFlowy" PRODUCT_NAME = "AppFlowy"
MACOSX_DEPLOYMENT_TARGET = "11.0" MACOSX_DEPLOYMENT_TARGET = "11.0"

View File

@ -55,9 +55,8 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
configuration: configuration.copyWith( configuration: configuration.copyWith(
placeholderText: (_) => LocaleKeys.blockPlaceholders_todoList.tr(), placeholderText: (_) => LocaleKeys.blockPlaceholders_todoList.tr(),
), ),
iconBuilder: PlatformExtension.isMobile iconBuilder: (_, node, onCheck) =>
? (_, node, onCheck) => TodoListIcon(node: node, onCheck: onCheck) TodoListIcon(node: node, onCheck: onCheck),
: null,
toggleChildrenTriggers: [ toggleChildrenTriggers: [
LogicalKeyboardKey.shift, LogicalKeyboardKey.shift,
LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.shiftLeft,
@ -68,18 +67,14 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
configuration: configuration.copyWith( configuration: configuration.copyWith(
placeholderText: (_) => LocaleKeys.blockPlaceholders_bulletList.tr(), placeholderText: (_) => LocaleKeys.blockPlaceholders_bulletList.tr(),
), ),
iconBuilder: PlatformExtension.isMobile iconBuilder: (_, node) => BulletedListIcon(node: node),
? (_, node) => BulletedListIcon(node: node)
: null,
), ),
NumberedListBlockKeys.type: NumberedListBlockComponentBuilder( NumberedListBlockKeys.type: NumberedListBlockComponentBuilder(
configuration: configuration.copyWith( configuration: configuration.copyWith(
placeholderText: (_) => LocaleKeys.blockPlaceholders_numberList.tr(), placeholderText: (_) => LocaleKeys.blockPlaceholders_numberList.tr(),
), ),
iconBuilder: PlatformExtension.isMobile iconBuilder: (_, node, textDirection) =>
? (_, node, textDirection) => NumberedListIcon(node: node, textDirection: textDirection),
NumberedListIcon(node: node, textDirection: textDirection)
: null,
), ),
QuoteBlockKeys.type: QuoteBlockComponentBuilder( QuoteBlockKeys.type: QuoteBlockComponentBuilder(
configuration: configuration.copyWith( configuration: configuration.copyWith(
@ -169,7 +164,10 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
), ),
), ),
CalloutBlockKeys.type: CalloutBlockComponentBuilder( CalloutBlockKeys.type: CalloutBlockComponentBuilder(
configuration: configuration, configuration: configuration.copyWith(
textStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(),
placeholderTextStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(),
),
defaultColor: calloutBGColor, defaultColor: calloutBGColor,
), ),
DividerBlockKeys.type: DividerBlockComponentBuilder( DividerBlockKeys.type: DividerBlockComponentBuilder(

View File

@ -37,7 +37,9 @@ class BulletedListIcon extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final iconPadding = context.read<DocumentPageStyleBloc>().state.iconPadding; final iconPadding = PlatformExtension.isMobile
? context.read<DocumentPageStyleBloc>().state.iconPadding
: 0.0;
return Container( return Container(
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 22, minWidth: 22,

View File

@ -17,7 +17,9 @@ class TodoListIcon extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final iconPadding = context.read<DocumentPageStyleBloc>().state.iconPadding; final iconPadding = PlatformExtension.isMobile
? context.read<DocumentPageStyleBloc>().state.iconPadding
: 0.0;
final checked = node.attributes[TodoListBlockKeys.checked] ?? false; final checked = node.attributes[TodoListBlockKeys.checked] ?? false;
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,

View File

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:appflowy/core/helpers/url_launcher.dart'; import 'package:appflowy/core/helpers/url_launcher.dart';
import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart'; import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart';
import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart'; import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';
@ -60,6 +58,9 @@ class EditorStyleCustomizer {
DefaultAppearanceSettings.getDefaultSelectionColor(context), DefaultAppearanceSettings.getDefaultSelectionColor(context),
defaultTextDirection: appearance.defaultTextDirection, defaultTextDirection: appearance.defaultTextDirection,
textStyleConfiguration: TextStyleConfiguration( textStyleConfiguration: TextStyleConfiguration(
lineHeight: 1.2,
applyHeightToFirstAscent: true,
applyHeightToLastDescent: true,
text: baseTextStyle(fontFamily).copyWith( text: baseTextStyle(fontFamily).copyWith(
fontSize: fontSize, fontSize: fontSize,
color: afThemeExtension.onBackground, color: afThemeExtension.onBackground,
@ -80,7 +81,7 @@ class EditorStyleCustomizer {
), ),
code: GoogleFonts.robotoMono( code: GoogleFonts.robotoMono(
textStyle: baseTextStyle(fontFamily).copyWith( textStyle: baseTextStyle(fontFamily).copyWith(
fontSize: fontSize - 2, fontSize: fontSize,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Colors.red, color: Colors.red,
backgroundColor: theme.colorScheme.inverseSurface.withOpacity(0.8), backgroundColor: theme.colorScheme.inverseSurface.withOpacity(0.8),
@ -105,7 +106,6 @@ class EditorStyleCustomizer {
final textScaleFactor = final textScaleFactor =
context.read<AppearanceSettingsCubit>().state.textScaleFactor; context.read<AppearanceSettingsCubit>().state.textScaleFactor;
final baseTextStyle = this.baseTextStyle(fontFamily); final baseTextStyle = this.baseTextStyle(fontFamily);
final codeFontSize = max(0.0, fontSize - 2);
return EditorStyle.mobile( return EditorStyle.mobile(
padding: padding, padding: padding,
defaultTextDirection: defaultTextDirection, defaultTextDirection: defaultTextDirection,
@ -127,7 +127,7 @@ class EditorStyleCustomizer {
), ),
code: GoogleFonts.robotoMono( code: GoogleFonts.robotoMono(
textStyle: baseTextStyle.copyWith( textStyle: baseTextStyle.copyWith(
fontSize: codeFontSize, fontSize: fontSize,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
color: Colors.red, color: Colors.red,
@ -183,6 +183,14 @@ class EditorStyleCustomizer {
); );
} }
TextStyle calloutBlockStyleBuilder() {
final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize;
return baseTextStyle(null).copyWith(
fontSize: fontSize,
height: 1.5,
);
}
TextStyle outlineBlockPlaceholderStyleBuilder() { TextStyle outlineBlockPlaceholderStyleBuilder() {
final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize; final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize;
return TextStyle( return TextStyle(

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/startup/startup.dart';
@ -242,6 +244,7 @@ class _WorkspaceInfo extends StatelessWidget {
rightIcon: const HSpace(32.0), rightIcon: const HSpace(32.0),
text: Column( text: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// workspace name // workspace name
FlowyText.medium( FlowyText.medium(
@ -250,6 +253,7 @@ class _WorkspaceInfo extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
withTooltip: true, withTooltip: true,
), ),
if (Platform.isMacOS) const VSpace(2.0),
// workspace members count // workspace members count
FlowyText.regular( FlowyText.regular(
state.isLoading state.isLoading

View File

@ -19,6 +19,7 @@ const _darkShader3 = Color(0xFF363D49);
const _darkShader5 = Color(0xFFBBC3CD); const _darkShader5 = Color(0xFFBBC3CD);
const _darkShader6 = Color(0xFFF2F2F2); const _darkShader6 = Color(0xFFF2F2F2);
const _darkMain1 = Color(0x19FFFFFF); const _darkMain1 = Color(0x19FFFFFF);
const _darkMain2 = Color(0xFF00BCF0);
const _darkInput = Color(0xFF282E3A); const _darkInput = Color(0xFF282E3A);
class DefaultColorScheme extends FlowyColorScheme { class DefaultColorScheme extends FlowyColorScheme {
@ -103,7 +104,7 @@ class DefaultColorScheme extends FlowyColorScheme {
tint7: const Color(0x5900BD2A), tint7: const Color(0x5900BD2A),
tint8: const Color(0x80008890), tint8: const Color(0x80008890),
tint9: const Color(0x4d0029FF), tint9: const Color(0x4d0029FF),
main1: _darkMain1, main1: _darkMain2,
main2: const Color(0xFF00B7EA), main2: const Color(0xFF00B7EA),
shadow: const Color(0xFF0F131C), shadow: const Color(0xFF0F131C),
sidebarBg: const Color(0xFF232B38), sidebarBg: const Color(0xFF232B38),
@ -114,7 +115,7 @@ class DefaultColorScheme extends FlowyColorScheme {
secondaryText: _darkShader5, secondaryText: _darkShader5,
input: _darkInput, input: _darkInput,
hint: const Color(0xFF59647a), hint: const Color(0xFF59647a),
primary: _darkMain1, primary: _darkMain2,
onPrimary: _darkShader1, onPrimary: _darkShader1,
hoverBG1: _darkMain1, hoverBG1: _darkMain1,
hoverBG2: _darkMain1, hoverBG2: _darkMain1,

View File

@ -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. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.5.8 version: 0.5.9
environment: environment:
flutter: ">=3.22.0" flutter: ">=3.22.0"