Skip to content

Commit

Permalink
fix: some list icons don't align with the paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed May 30, 2024
1 parent e40e1e9 commit 3dc0a01
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion frontend/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ Map<String, BlockComponentBuilder> 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,
Expand All @@ -68,18 +67,14 @@ Map<String, BlockComponentBuilder> 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(
Expand Down Expand Up @@ -169,7 +164,10 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
),
),
CalloutBlockKeys.type: CalloutBlockComponentBuilder(
configuration: configuration,
configuration: configuration.copyWith(
textStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(),
placeholderTextStyle: (_) => styleCustomizer.calloutBlockStyleBuilder(),
),
defaultColor: calloutBGColor,
),
DividerBlockKeys.type: DividerBlockComponentBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class BulletedListIcon extends StatelessWidget {

@override
Widget build(BuildContext context) {
final iconPadding = context.read<DocumentPageStyleBloc>().state.iconPadding;
final iconPadding = PlatformExtension.isMobile
? context.read<DocumentPageStyleBloc>().state.iconPadding
: 0.0;
return Container(
constraints: const BoxConstraints(
minWidth: 22,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class TodoListIcon extends StatelessWidget {

@override
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;
return GestureDetector(
behavior: HitTestBehavior.opaque,
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand All @@ -105,7 +106,6 @@ class EditorStyleCustomizer {
final textScaleFactor =
context.read<AppearanceSettingsCubit>().state.textScaleFactor;
final baseTextStyle = this.baseTextStyle(fontFamily);
final codeFontSize = max(0.0, fontSize - 2);
return EditorStyle.mobile(
padding: padding,
defaultTextDirection: defaultTextDirection,
Expand All @@ -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,
Expand Down Expand Up @@ -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() {
final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize;
return TextStyle(
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/appflowy_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3dc0a01

Please sign in to comment.