From 8c5547da6484d7fcc0ffdaf6edbadf5631391bb0 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 22 Apr 2025 12:05:53 +0800 Subject: [PATCH] fix: custom font doesn't apply to settings page (#7801) * fix: custom font doesn't apply to settings page * chore: update settings page icons * fix: add try catch in http services --- .../document/presentation/editor_style.dart | 5 +- .../lib/startup/tasks/app_widget.dart | 8 +- .../password/password_http_service.dart | 14 +- .../inivitation/member_http_service.dart | 14 +- .../members/workspace_member_bloc.dart | 2 +- .../settings/widgets/settings_menu.dart | 23 +-- .../theme/data/appflowy_default/semantic.dart | 12 +- .../src/theme/data/custom/custom_theme.dart | 10 +- .../text_style/base/default_text_style.dart | 174 ++++++++++-------- .../definition/text_style/text_style.dart | 28 ++- .../lib/src/theme/definition/theme_data.dart | 9 +- .../flowy_icons/20x/settings_page_ai.svg | 4 + .../flowy_icons/20x/settings_page_bell.svg | 4 + .../flowy_icons/20x/settings_page_cloud.svg | 3 + .../20x/settings_page_credit_card.svg | 3 + .../20x/settings_page_database.svg | 3 + .../flowy_icons/20x/settings_page_earth.svg | 3 + .../20x/settings_page_keyboard.svg | 11 ++ .../flowy_icons/20x/settings_page_plan.svg | 3 + .../flowy_icons/20x/settings_page_user.svg | 4 + .../flowy_icons/20x/settings_page_users.svg | 3 + .../20x/settings_page_workspace.svg | 3 + 22 files changed, 225 insertions(+), 118 deletions(-) create mode 100644 frontend/resources/flowy_icons/20x/settings_page_ai.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_bell.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_cloud.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_credit_card.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_database.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_earth.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_keyboard.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_plan.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_user.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_users.svg create mode 100644 frontend/resources/flowy_icons/20x/settings_page_workspace.svg 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 3664c9aee7..cd9d7bb5e8 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart @@ -316,9 +316,12 @@ class EditorStyleCustomizer { } TextStyle baseTextStyle(String? fontFamily, {FontWeight? fontWeight}) { - if (fontFamily == null || fontFamily == defaultFontFamily) { + if (fontFamily == null) { return TextStyle(fontWeight: fontWeight); + } else if (fontFamily == defaultFontFamily) { + return TextStyle(fontFamily: fontFamily, fontWeight: fontWeight); } + try { return getGoogleFontSafely(fontFamily, fontWeight: fontWeight); } on Exception { diff --git a/frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart b/frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart index 0ed66389d9..48e76cecbc 100644 --- a/frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart +++ b/frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart @@ -7,11 +7,13 @@ import 'package:appflowy/shared/feature_flags.dart'; import 'package:appflowy/shared/icon_emoji_picker/icon_picker.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/user_settings_service.dart'; +import 'package:appflowy/util/string_extension.dart'; import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart'; import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart'; import 'package:appflowy/workspace/application/command_palette/command_palette_bloc.dart'; import 'package:appflowy/workspace/application/notification/notification_service.dart'; import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart'; +import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart'; import 'package:appflowy/workspace/application/settings/notifications/notification_settings_cubit.dart'; import 'package:appflowy/workspace/application/sidebar/rename_view/rename_view_bloc.dart'; import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; @@ -238,11 +240,13 @@ class _ApplicationWidgetState extends State { routerConfig: routerConfig, builder: (context, child) { final brightness = Theme.of(context).brightness; + final fontFamily = + state.font.orDefault(defaultFontFamily); return AppFlowyTheme( data: brightness == Brightness.light - ? themeBuilder.light() - : themeBuilder.dark(), + ? themeBuilder.light(fontFamily: fontFamily) + : themeBuilder.dark(fontFamily: fontFamily), child: MediaQuery( // use the 1.0 as the textScaleFactor to avoid the text size // affected by the system setting. diff --git a/frontend/appflowy_flutter/lib/user/application/password/password_http_service.dart b/frontend/appflowy_flutter/lib/user/application/password/password_http_service.dart index 723ded57e2..c56c4f595d 100644 --- a/frontend/appflowy_flutter/lib/user/application/password/password_http_service.dart +++ b/frontend/appflowy_flutter/lib/user/application/password/password_http_service.dart @@ -120,10 +120,16 @@ class PasswordHttpService { errorMessage: 'Failed to check password status', ); - return result.fold( - (data) => FlowyResult.success(data['has_password'] ?? false), - (error) => FlowyResult.failure(error), - ); + try { + return result.fold( + (data) => FlowyResult.success(data['has_password'] ?? false), + (error) => FlowyResult.failure(error), + ); + } catch (e) { + return FlowyResult.failure( + FlowyError(msg: 'Failed to check password status: $e'), + ); + } } /// Makes a request to the specified endpoint with the given body diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart index c8c7e47706..01d507ea24 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart @@ -64,10 +64,16 @@ class MemberHttpService { errorMessage: 'Failed to get invite code', ); - return result.fold( - (data) => FlowyResult.success(data['code'] as String), - (error) => FlowyResult.failure(error), - ); + try { + return result.fold( + (data) => FlowyResult.success(data['code'] as String), + (error) => FlowyResult.failure(error), + ); + } catch (e) { + return FlowyResult.failure( + FlowyError(msg: 'Failed to get invite code: $e'), + ); + } } /// Deletes the invite code for a workspace diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart index 5f98146118..3fc13c7b18 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart @@ -92,7 +92,7 @@ class WorkspaceMemberBloc final inviteLink = await _buildInviteLink(inviteCode: s); emit(state.copyWith(inviteLink: inviteLink)); }, - (e) => Log.error('Failed to get invite code: ${e.msg}', e), + (e) => Log.info('Failed to get invite code: ${e.msg}', e), ), ); } else { diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_menu.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_menu.dart index 979f19fbde..f628aadc6b 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_menu.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_menu.dart @@ -52,14 +52,14 @@ class SettingsMenu extends StatelessWidget { page: SettingsPage.account, selectedPage: currentPage, label: LocaleKeys.settings_accountPage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_account_m), + icon: const FlowySvg(FlowySvgs.settings_page_user_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.workspace, selectedPage: currentPage, label: LocaleKeys.settings_workspacePage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_workplace_m), + icon: const FlowySvg(FlowySvgs.settings_page_workspace_m), changeSelectedPage: changeSelectedPage, ), if (FeatureFlag.membersSettings.isOn && @@ -68,35 +68,35 @@ class SettingsMenu extends StatelessWidget { page: SettingsPage.member, selectedPage: currentPage, label: LocaleKeys.settings_appearance_members_label.tr(), - icon: const Icon(Icons.people), + icon: const FlowySvg(FlowySvgs.settings_page_users_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.manageData, selectedPage: currentPage, label: LocaleKeys.settings_manageDataPage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_data_m), + icon: const FlowySvg(FlowySvgs.settings_page_database_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.notifications, selectedPage: currentPage, label: LocaleKeys.settings_menu_notifications.tr(), - icon: const Icon(Icons.notifications_outlined), + icon: const FlowySvg(FlowySvgs.settings_page_bell_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.cloud, selectedPage: currentPage, label: LocaleKeys.settings_menu_cloudSettings.tr(), - icon: const Icon(Icons.sync), + icon: const FlowySvg(FlowySvgs.settings_page_cloud_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.shortcuts, selectedPage: currentPage, label: LocaleKeys.settings_shortcutsPage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_shortcuts_m), + icon: const FlowySvg(FlowySvgs.settings_page_keyboard_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( @@ -104,7 +104,7 @@ class SettingsMenu extends StatelessWidget { selectedPage: currentPage, label: LocaleKeys.settings_aiPage_menuLabel.tr(), icon: const FlowySvg( - FlowySvgs.ai_summary_generate_s, + FlowySvgs.settings_page_ai_m, size: Size.square(24), ), changeSelectedPage: changeSelectedPage, @@ -114,7 +114,7 @@ class SettingsMenu extends StatelessWidget { page: SettingsPage.sites, selectedPage: currentPage, label: LocaleKeys.settings_sites_title.tr(), - icon: const Icon(Icons.web), + icon: const FlowySvg(FlowySvgs.settings_page_earth_m), changeSelectedPage: changeSelectedPage, ), if (FeatureFlag.planBilling.isOn && isBillingEnabled) ...[ @@ -122,14 +122,15 @@ class SettingsMenu extends StatelessWidget { page: SettingsPage.plan, selectedPage: currentPage, label: LocaleKeys.settings_planPage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_plan_m), + icon: const FlowySvg(FlowySvgs.settings_page_plan_m), changeSelectedPage: changeSelectedPage, ), SettingsMenuElement( page: SettingsPage.billing, selectedPage: currentPage, label: LocaleKeys.settings_billingPage_menuLabel.tr(), - icon: const FlowySvg(FlowySvgs.settings_billing_m), + icon: + const FlowySvg(FlowySvgs.settings_page_credit_card_m), changeSelectedPage: changeSelectedPage, ), ], diff --git a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/appflowy_default/semantic.dart b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/appflowy_default/semantic.dart index 8de842e4b7..3c97c06df3 100644 --- a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/appflowy_default/semantic.dart +++ b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/appflowy_default/semantic.dart @@ -17,8 +17,10 @@ import 'primitive.dart'; class AppFlowyDefaultTheme implements AppFlowyThemeBuilder { @override - AppFlowyThemeData light() { - final textStyle = AppFlowyBaseTextStyle(); + AppFlowyThemeData light({ + String? fontFamily, + }) { + final textStyle = AppFlowyBaseTextStyle.customFontFamily(fontFamily ?? ''); final borderRadius = AppFlowySharedTokens.buildBorderRadius(); final spacing = AppFlowySharedTokens.buildSpacing(); final shadow = AppFlowySharedTokens.buildShadow(Brightness.light); @@ -172,8 +174,10 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder { } @override - AppFlowyThemeData dark() { - final textStyle = AppFlowyBaseTextStyle(); + AppFlowyThemeData dark({ + String? fontFamily, + }) { + final textStyle = AppFlowyBaseTextStyle.customFontFamily(fontFamily ?? ''); final borderRadius = AppFlowySharedTokens.buildBorderRadius(); final spacing = AppFlowySharedTokens.buildSpacing(); final shadow = AppFlowySharedTokens.buildShadow(Brightness.dark); diff --git a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/custom/custom_theme.dart b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/custom/custom_theme.dart index 6ef43076c5..ca058310b9 100644 --- a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/custom/custom_theme.dart +++ b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/data/custom/custom_theme.dart @@ -10,14 +10,16 @@ class CustomTheme implements AppFlowyThemeBuilder { final Map darkThemeJson; @override - AppFlowyThemeData light() { - // TODO: implement light + AppFlowyThemeData light({ + String? fontFamily, + }) { throw UnimplementedError(); } @override - AppFlowyThemeData dark() { - // TODO: implement dark + AppFlowyThemeData dark({ + String? fontFamily, + }) { throw UnimplementedError(); } } diff --git a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/base/default_text_style.dart b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/base/default_text_style.dart index 3cdf267fe0..006f364f96 100644 --- a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/base/default_text_style.dart +++ b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/base/default_text_style.dart @@ -1,44 +1,50 @@ import 'package:flutter/widgets.dart'; abstract class TextThemeType { - const TextThemeType(); + const TextThemeType({ + required this.fontFamily, + }); + + final String fontFamily; TextStyle standard({ - String family = '', + String? family, Color? color, FontWeight? weight, }); TextStyle enhanced({ - String family = '', + String? family, Color? color, FontWeight? weight, }); TextStyle prominent({ - String family = '', + String? family, Color? color, FontWeight? weight, }); TextStyle underline({ - String family = '', + String? family, Color? color, FontWeight? weight, }); } class TextThemeHeading1 extends TextThemeType { - const TextThemeHeading1(); + const TextThemeHeading1({ + required super.fontFamily, + }); @override TextStyle standard({ - String family = '', + String? family, Color? color, FontWeight? weight, }) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, fontSize: 36, height: 40 / 36, color: color, @@ -47,12 +53,12 @@ class TextThemeHeading1 extends TextThemeType { @override TextStyle enhanced({ - String family = '', + String? family, Color? color, FontWeight? weight, }) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, fontSize: 36, height: 40 / 36, color: color, @@ -61,12 +67,12 @@ class TextThemeHeading1 extends TextThemeType { @override TextStyle prominent({ - String family = '', + String? family, Color? color, FontWeight? weight, }) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, fontSize: 36, height: 40 / 36, color: color, @@ -75,12 +81,12 @@ class TextThemeHeading1 extends TextThemeType { @override TextStyle underline({ - String family = '', + String? family, Color? color, FontWeight? weight, }) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, fontSize: 36, height: 40 / 36, color: color, @@ -111,36 +117,38 @@ class TextThemeHeading1 extends TextThemeType { } class TextThemeHeading2 extends TextThemeType { - const TextThemeHeading2(); + const TextThemeHeading2({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w700, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, decoration: TextDecoration.underline, @@ -169,36 +177,38 @@ class TextThemeHeading2 extends TextThemeType { } class TextThemeHeading3 extends TextThemeType { - const TextThemeHeading3(); + const TextThemeHeading3({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w700, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, decoration: TextDecoration.underline, @@ -227,36 +237,38 @@ class TextThemeHeading3 extends TextThemeType { } class TextThemeHeading4 extends TextThemeType { - const TextThemeHeading4(); + const TextThemeHeading4({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w700, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w400, decoration: TextDecoration.underline, @@ -285,36 +297,38 @@ class TextThemeHeading4 extends TextThemeType { } class TextThemeHeadline extends TextThemeType { - const TextThemeHeadline(); + const TextThemeHeadline({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.bold, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, decoration: TextDecoration.underline, @@ -343,36 +357,38 @@ class TextThemeHeadline extends TextThemeType { } class TextThemeTitle extends TextThemeType { - const TextThemeTitle(); + const TextThemeTitle({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.bold, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, decoration: TextDecoration.underline, @@ -401,36 +417,38 @@ class TextThemeTitle extends TextThemeType { } class TextThemeBody extends TextThemeType { - const TextThemeBody(); + const TextThemeBody({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.bold, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, decoration: TextDecoration.underline, @@ -459,36 +477,38 @@ class TextThemeBody extends TextThemeType { } class TextThemeCaption extends TextThemeType { - const TextThemeCaption(); + const TextThemeCaption({ + required super.fontFamily, + }); @override - TextStyle standard({String family = '', Color? color, FontWeight? weight}) => + TextStyle standard({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, ); @override - TextStyle enhanced({String family = '', Color? color, FontWeight? weight}) => + TextStyle enhanced({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.w600, ); @override - TextStyle prominent({String family = '', Color? color, FontWeight? weight}) => + TextStyle prominent({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.bold, ); @override - TextStyle underline({String family = '', Color? color, FontWeight? weight}) => + TextStyle underline({String? family, Color? color, FontWeight? weight}) => _defaultTextStyle( - family: family, + family: family ?? super.fontFamily, color: color, weight: weight ?? FontWeight.normal, decoration: TextDecoration.underline, diff --git a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/text_style.dart b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/text_style.dart index d96ca0f557..89c1278d93 100644 --- a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/text_style.dart +++ b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/text_style/text_style.dart @@ -1,15 +1,27 @@ import 'package:appflowy_ui/src/theme/definition/text_style/base/default_text_style.dart'; class AppFlowyBaseTextStyle { + factory AppFlowyBaseTextStyle.customFontFamily(String fontFamily) => + AppFlowyBaseTextStyle( + heading1: TextThemeHeading1(fontFamily: fontFamily), + heading2: TextThemeHeading2(fontFamily: fontFamily), + heading3: TextThemeHeading3(fontFamily: fontFamily), + heading4: TextThemeHeading4(fontFamily: fontFamily), + headline: TextThemeHeadline(fontFamily: fontFamily), + title: TextThemeTitle(fontFamily: fontFamily), + body: TextThemeBody(fontFamily: fontFamily), + caption: TextThemeCaption(fontFamily: fontFamily), + ); + const AppFlowyBaseTextStyle({ - this.heading1 = const TextThemeHeading1(), - this.heading2 = const TextThemeHeading2(), - this.heading3 = const TextThemeHeading3(), - this.heading4 = const TextThemeHeading4(), - this.headline = const TextThemeHeadline(), - this.title = const TextThemeTitle(), - this.body = const TextThemeBody(), - this.caption = const TextThemeCaption(), + this.heading1 = const TextThemeHeading1(fontFamily: ''), + this.heading2 = const TextThemeHeading2(fontFamily: ''), + this.heading3 = const TextThemeHeading3(fontFamily: ''), + this.heading4 = const TextThemeHeading4(fontFamily: ''), + this.headline = const TextThemeHeadline(fontFamily: ''), + this.title = const TextThemeTitle(fontFamily: ''), + this.body = const TextThemeBody(fontFamily: ''), + this.caption = const TextThemeCaption(fontFamily: ''), }); final TextThemeType heading1; diff --git a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/theme_data.dart b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/theme_data.dart index 515e6b2ecf..1da45cfd2a 100644 --- a/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/theme_data.dart +++ b/frontend/appflowy_flutter/packages/appflowy_ui/lib/src/theme/definition/theme_data.dart @@ -81,6 +81,11 @@ class AppFlowyThemeData { abstract class AppFlowyThemeBuilder { const AppFlowyThemeBuilder(); - AppFlowyThemeData light(); - AppFlowyThemeData dark(); + AppFlowyThemeData light({ + String? fontFamily, + }); + + AppFlowyThemeData dark({ + String? fontFamily, + }); } diff --git a/frontend/resources/flowy_icons/20x/settings_page_ai.svg b/frontend/resources/flowy_icons/20x/settings_page_ai.svg new file mode 100644 index 0000000000..d98a0c90fd --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_ai.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_bell.svg b/frontend/resources/flowy_icons/20x/settings_page_bell.svg new file mode 100644 index 0000000000..57031d1f90 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_bell.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_cloud.svg b/frontend/resources/flowy_icons/20x/settings_page_cloud.svg new file mode 100644 index 0000000000..44c20bb51b --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_cloud.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_credit_card.svg b/frontend/resources/flowy_icons/20x/settings_page_credit_card.svg new file mode 100644 index 0000000000..e1c64ee509 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_credit_card.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_database.svg b/frontend/resources/flowy_icons/20x/settings_page_database.svg new file mode 100644 index 0000000000..bfbae5f8fe --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_database.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_earth.svg b/frontend/resources/flowy_icons/20x/settings_page_earth.svg new file mode 100644 index 0000000000..0a205592b4 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_earth.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_keyboard.svg b/frontend/resources/flowy_icons/20x/settings_page_keyboard.svg new file mode 100644 index 0000000000..92efc30142 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_keyboard.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_plan.svg b/frontend/resources/flowy_icons/20x/settings_page_plan.svg new file mode 100644 index 0000000000..9792bd41c4 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_plan.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_user.svg b/frontend/resources/flowy_icons/20x/settings_page_user.svg new file mode 100644 index 0000000000..94968ff06b --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_user.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_users.svg b/frontend/resources/flowy_icons/20x/settings_page_users.svg new file mode 100644 index 0000000000..eb65bf7192 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_users.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/resources/flowy_icons/20x/settings_page_workspace.svg b/frontend/resources/flowy_icons/20x/settings_page_workspace.svg new file mode 100644 index 0000000000..e9a6eb9a10 --- /dev/null +++ b/frontend/resources/flowy_icons/20x/settings_page_workspace.svg @@ -0,0 +1,3 @@ + + +