Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: support adjusting document width (#6327)
Lucas522143cfd8b8
diff --git a/frontend/appflowy_flutter/ios/Podfile.lock b/frontend/appflowy_flutter/ios/Podfile.lockindex a8d1d344be..3089e3f56e 100644--- a/frontend/appflowy_flutter/ios/Podfile.lock+++ b/frontend/appflowy_flutter/ios/Podfile.lock@@ -170,7 +170,7 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/url_launcher_ios/ios"SPEC CHECKSUMS:- app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875+ app_links: e70ca16b4b0f88253b3b3660200d4a10b4ea9795appflowy_backend: 144c20d8bfb298c4e10fa3fa6701a9f41bf98b88connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1ddevice_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d@@ -180,25 +180,25 @@ SPEC CHECKSUMS:flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebcFlutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c- image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425+ image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9keyboard_height_plugin: 43fa8bba20fd5c4fdeed5076466b8b9d43cc6b86open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c- path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c+ path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825SDWebImage: b9a731e1d6307f44ca703b3976d18c24ca561e84Sentry: 1fe34e9c2cbba1e347623610d26db121dcb569f1sentry_flutter: a39c2a2d67d5e5b9cb0b94a4985c76dd5b3fc737- share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5- shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695+ share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad+ shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eecsuper_native_extensions: 4916b3c627a9c7fffdc48a23a9eca0b1ac228fa7SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780Toast: 91b396c56ee72a5790816f40d3a94dd357abc196- url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812+ url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fePODFILE CHECKSUM: d0d9b4ff572d8695c38eb3f9b490f55cdfc57ecadiff --git a/frontend/appflowy_flutter/lib/core/config/kv_keys.dart b/frontend/appflowy_flutter/lib/core/config/kv_keys.dartindex 91249f769f..d45064b763 100644--- a/frontend/appflowy_flutter/lib/core/config/kv_keys.dart+++ b/frontend/appflowy_flutter/lib/core/config/kv_keys.dart@@ -35,6 +35,7 @@ class KVKeys {'kDocumentAppearanceCursorColor';static const String kDocumentAppearanceSelectionColor ='kDocumentAppearanceSelectionColor';+ static const String kDocumentAppearanceWidth = 'kDocumentAppearanceWidth';/// The key for saving the expanded views///diff --git a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dartindex b32da477bf..72425b91f9 100644--- a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart@@ -1,5 +1,3 @@-import 'package:flutter/material.dart';-import 'package:appflowy/plugins/database/application/row/related_row_detail_bloc.dart';import 'package:appflowy/plugins/database/grid/application/row/row_detail_bloc.dart';import 'package:appflowy/plugins/database/grid/presentation/widgets/common/type_option_separator.dart';@@ -17,6 +15,7 @@ import 'package:appflowy/workspace/application/action_navigation/navigation_actiimport 'package:appflowy_backend/log.dart';import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';// This widget is largely copied from `plugins/document/document_page.dart` intentionally instead of opting for an abstraction. We can make an abstraction after the view refactor is done and there's more clarity in that department.@@ -108,7 +107,6 @@ class _DatabaseDocumentPageState extends State<DatabaseDocumentPage> {editorState: state.editorState!,styleCustomizer: EditorStyleCustomizer(context: context,- // the 44 is the width of the left action listpadding: EditorStyleCustomizer.documentPadding,),header: _buildDatabaseDataContent(context, state.editorState!),@@ -138,6 +136,7 @@ class _DatabaseDocumentPageState extends State<DatabaseDocumentPage> {return state.when(loading: () => const SizedBox.shrink(),ready: (databaseController, rowController) {+ final padding = EditorStyleCustomizer.documentPadding;return BlocProvider(create: (context) => RowDetailBloc(fieldController: databaseController.fieldController,@@ -146,8 +145,8 @@ class _DatabaseDocumentPageState extends State<DatabaseDocumentPage> {child: Padding(padding: EdgeInsets.only(top: 24,- left: EditorStyleCustomizer.documentPadding.left + 16 + 6,- right: EditorStyleCustomizer.documentPadding.right,+ left: padding.left + 22,+ right: padding.right,),child: Column(children: [diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/document_appearance_cubit.dart b/frontend/appflowy_flutter/lib/plugins/document/application/document_appearance_cubit.dartindex 1a39c519a3..c65d818351 100644--- a/frontend/appflowy_flutter/lib/plugins/document/application/document_appearance_cubit.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/application/document_appearance_cubit.dart@@ -1,17 +1,20 @@import 'dart:async';import 'package:appflowy/core/config/kv_keys.dart';+import 'package:appflowy/plugins/document/presentation/editor_style.dart';import 'package:appflowy/util/color_to_hex_string.dart';import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart';-import 'package:bloc/bloc.dart';import 'package:flutter/material.dart';+import 'package:flutter_bloc/flutter_bloc.dart';import 'package:shared_preferences/shared_preferences.dart';+import 'package:universal_platform/universal_platform.dart';class DocumentAppearance {const DocumentAppearance({required this.fontSize,required this.fontFamily,required this.codeFontFamily,+ required this.width,this.cursorColor,this.selectionColor,this.defaultTextDirection,@@ -23,6 +26,7 @@ class DocumentAppearance {final Color? cursorColor;final Color? selectionColor;final String? defaultTextDirection;+ final double width;/// For nullable fields (like `cursorColor`),/// use the corresponding `isNull` flag (like `cursorColorIsNull`) to explicitly set the field to `null`.@@ -39,6 +43,7 @@ class DocumentAppearance {bool cursorColorIsNull = false,bool selectionColorIsNull = false,bool textDirectionIsNull = false,+ double? width,}) {return DocumentAppearance(fontSize: fontSize ?? this.fontSize,@@ -50,6 +55,7 @@ class DocumentAppearance {defaultTextDirection: textDirectionIsNull? null: defaultTextDirection ?? this.defaultTextDirection,+ width: width ?? this.width,);}}@@ -57,10 +63,13 @@ class DocumentAppearance {class DocumentAppearanceCubit extends Cubit<DocumentAppearance> {DocumentAppearanceCubit(): super(- const DocumentAppearance(+ DocumentAppearance(fontSize: 16.0,fontFamily: defaultFontFamily,codeFontFamily: builtInCodeFontFamily,+ width: UniversalPlatform.isMobile+ ? double.infinity+ : EditorStyleCustomizer.maxDocumentWidth,),);@@ -82,6 +91,7 @@ class DocumentAppearanceCubit extends Cubit<DocumentAppearance> {final selectionColor = selectionColorString != null? Color(int.parse(selectionColorString)): null;+ final double? width = prefs.getDouble(KVKeys.kDocumentAppearanceWidth);final textScaleFactor =double.parse(prefs.getString(KVKeys.textScaleFactor) ?? '1.0');@@ -100,6 +110,7 @@ class DocumentAppearanceCubit extends Cubit<DocumentAppearance> {cursorColorIsNull: cursorColor == null,selectionColorIsNull: selectionColor == null,textDirectionIsNull: defaultTextDirection == null,+ width: width,),);}@@ -186,4 +197,21 @@ class DocumentAppearanceCubit extends Cubit<DocumentAppearance> {);}}++ Future<void> syncWidth(double? width) async {+ final prefs = await SharedPreferences.getInstance();++ width ??= UniversalPlatform.isMobile+ ? double.infinity+ : EditorStyleCustomizer.maxDocumentWidth;+ width = width.clamp(+ EditorStyleCustomizer.minDocumentWidth,+ EditorStyleCustomizer.maxDocumentWidth,+ );+ await prefs.setDouble(KVKeys.kDocumentAppearanceWidth, width);++ if (!isClosed) {+ emit(state.copyWith(width: width));+ }+ }}diff --git a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart b/frontend/appflowy_flutter/lib/plugins/document/document_page.dartindex d1bed24a90..92807f715a 100644--- a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart@@ -1,4 +1,5 @@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_bloc.dart';import 'package:appflowy/plugins/document/presentation/banner.dart';import 'package:appflowy/plugins/document/presentation/editor_drop_manager.dart';@@ -145,6 +146,8 @@ class _DocumentPageState extends State<DocumentPage>DocumentState state,EditorDropManagerState dropState,) {+ final width = context.read<DocumentAppearanceCubit>().state.width;+final Widget child;if (UniversalPlatform.isMobile) {child = BlocBuilder<DocumentPageStyleBloc, DocumentPageStyleState>(@@ -153,7 +156,7 @@ class _DocumentPageState extends State<DocumentPage>editorState: state.editorState!,styleCustomizer: EditorStyleCustomizer(context: context,- // the 44 is the width of the left action list+ width: width,padding: EditorStyleCustomizer.documentPadding,),header: _buildCoverAndIcon(context, state),@@ -243,7 +246,7 @@ class _DocumentPageState extends State<DocumentPage>editorState: state.editorState!,styleCustomizer: EditorStyleCustomizer(context: context,- // the 44 is the width of the left action list+ width: width,padding: EditorStyleCustomizer.documentPadding,),header: _buildCoverAndIcon(context, state),diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dartindex 6d31048fff..154a9f5f9c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart@@ -1,12 +1,12 @@import 'dart:io';--import 'package:flutter/material.dart';+import 'dart:math';import 'package:appflowy/generated/flowy_svgs.g.dart';import 'package:appflowy/generated/locale_keys.g.dart';import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart';import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';import 'package:appflowy/plugins/base/emoji/emoji_picker_screen.dart';+import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';import 'package:appflowy/plugins/document/application/document_bloc.dart';import 'package:appflowy/plugins/document/presentation/editor_plugins/header/desktop_cover.dart';import 'package:appflowy/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart';@@ -25,6 +25,7 @@ import 'package:appflowy_popover/appflowy_popover.dart';import 'package:easy_localization/easy_localization.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';import 'package:flowy_infra_ui/widget/rounded_button.dart';+import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:go_router/go_router.dart';import 'package:string_validator/string_validator.dart';@@ -128,46 +129,76 @@ class _DocumentCoverWidgetState extends State<DocumentCoverWidget> {@overrideWidget build(BuildContext context) {- return Stack(- children: [- SizedBox(- height: _calculateOverallHeight(),- child: DocumentHeaderToolbar(- onIconOrCoverChanged: _saveIconOrCover,- node: widget.node,- editorState: widget.editorState,- hasCover: hasCover,- hasIcon: hasIcon,- ),- ),- if (hasCover)- DocumentCover(- view: view,- editorState: widget.editorState,- node: widget.node,- coverType: coverType,- coverDetails: coverDetails,- onChangeCover: (type, details) =>- _saveIconOrCover(cover: (type, details)),- ),- if (hasIcon)- Positioned(- left: UniversalPlatform.isDesktopOrWeb ? 80 : 20,- // if hasCover, there shouldn't be icons present so the icon can- // be closer to the bottom.- bottom:- hasCover ? kToolbarHeight - kIconHeight / 2 : kToolbarHeight,- child: DocumentIcon(- editorState: widget.editorState,- node: widget.node,- icon: viewIcon,- onChangeIcon: (icon) => _saveIconOrCover(icon: icon),+ return LayoutBuilder(+ builder: (context, constraints) {+ final offset = _calculateIconLeft(context, constraints);+ return Stack(+ children: [+ SizedBox(+ height: _calculateOverallHeight(),+ child: DocumentHeaderToolbar(+ onIconOrCoverChanged: _saveIconOrCover,+ node: widget.node,+ editorState: widget.editorState,+ hasCover: hasCover,+ hasIcon: hasIcon,+ offset: offset,+ ),),- ),- ],+ if (hasCover)+ DocumentCover(+ view: view,+ editorState: widget.editorState,+ node: widget.node,+ coverType: coverType,+ coverDetails: coverDetails,+ onChangeCover: (type, details) =>+ _saveIconOrCover(cover: (type, details)),+ ),+ if (hasIcon)+ Positioned(+ left: offset,+ // if hasCover, there shouldn't be icons present so the icon can+ // be closer to the bottom.+ bottom: hasCover+ ? kToolbarHeight - kIconHeight / 2+ : kToolbarHeight,+ child: DocumentIcon(+ editorState: widget.editorState,+ node: widget.node,+ icon: viewIcon,+ onChangeIcon: (icon) => _saveIconOrCover(icon: icon),+ ),+ ),+ ],+ );+ },);}+ double _calculateIconLeft(BuildContext context, BoxConstraints constraints) {+ final editorState = context.read<EditorState>();+ final appearanceCubit = context.read<DocumentAppearanceCubit>();++ final renderBox = editorState.renderBox;+ var renderBoxWidth = 0.0;+ if (renderBox != null && renderBox.hasSize) {+ renderBoxWidth = renderBox.size.width;+ }++ // if the renderBox width equals to 0, it means the editor is not initialized+ final editorWidth = renderBoxWidth != 0+ ? min(renderBoxWidth, appearanceCubit.state.width)+ : appearanceCubit.state.width;++ // left padding + editor width + right padding = the width of the editor+ final leftOffset = (constraints.maxWidth - editorWidth) / 2.0 ++ EditorStyleCustomizer.documentPadding.right;++ // ensure the offset is not negative+ return max(0, leftOffset);+ }+double _calculateOverallHeight() {switch ((hasIcon, hasCover)) {case (true, true):@@ -224,6 +255,7 @@ class DocumentHeaderToolbar extends StatefulWidget {required this.hasCover,required this.hasIcon,required this.onIconOrCoverChanged,+ required this.offset,});final Node node;@@ -232,6 +264,7 @@ class DocumentHeaderToolbar extends StatefulWidget {final bool hasIcon;final void Function({(CoverType, String?)? cover, String? icon})onIconOrCoverChanged;+ final double offset;@overrideState<DocumentHeaderToolbar> createState() => _DocumentHeaderToolbarState();@@ -255,13 +288,7 @@ class _DocumentHeaderToolbarState extends State<DocumentHeaderToolbar> {Widget child = Container(alignment: Alignment.bottomLeft,width: double.infinity,- padding: UniversalPlatform.isDesktopOrWeb- ? EdgeInsets.symmetric(- horizontal: EditorStyleCustomizer.documentPadding.right,- )- : EdgeInsets.symmetric(- horizontal: EditorStyleCustomizer.documentPadding.left,- ),+ padding: EdgeInsets.symmetric(horizontal: widget.offset),child: SizedBox(height: 28,child: Row(diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dartindex cffab906a5..2a6a02bca7 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart@@ -28,10 +28,22 @@ import 'package:google_fonts/google_fonts.dart';import 'package:universal_platform/universal_platform.dart';class EditorStyleCustomizer {- EditorStyleCustomizer({required this.context, required this.padding});+ EditorStyleCustomizer({+ required this.context,+ required this.padding,+ this.width,+ });final BuildContext context;final EdgeInsets padding;+ final double? width;++ static const double maxDocumentWidth = 480 * 4;+ static const double minDocumentWidth = 480;++ static EdgeInsets get documentPadding => UniversalPlatform.isMobile+ ? const EdgeInsets.symmetric(horizontal: 24)+ : const EdgeInsets.only(left: 40, right: 40 + 44);EditorStyle style() {if (UniversalPlatform.isDesktopOrWeb) {@@ -42,10 +54,6 @@ class EditorStyleCustomizer {throw UnimplementedError();}- static EdgeInsets get documentPadding => UniversalPlatform.isMobile- ? const EdgeInsets.only(left: 24, right: 24)- : const EdgeInsets.only(left: 40, right: 40 + 44);-EditorStyle desktop() {final theme = Theme.of(context);final afThemeExtension = AFThemeExtension.of(context);@@ -59,6 +67,7 @@ class EditorStyleCustomizer {return EditorStyle.desktop(padding: padding,+ maxWidth: width,cursorColor: appearance.cursorColor ??DefaultAppearanceSettings.getDefaultCursorColor(context),selectionColor: appearance.selectionColor ??diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dartindex 7758a375b7..52aaf2af8c 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart@@ -1,10 +1,9 @@import 'dart:async';-import 'package:flutter/material.dart';-import 'package:appflowy/generated/flowy_svgs.g.dart';import 'package:appflowy/generated/locale_keys.g.dart';import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';+import 'package:appflowy/plugins/document/presentation/editor_style.dart';import 'package:appflowy/shared/af_role_pb_extension.dart';import 'package:appflowy/shared/google_fonts_extension.dart';import 'package:appflowy/util/font_family_extension.dart';@@ -45,6 +44,7 @@ import 'package:flowy_infra/theme.dart';import 'package:flowy_infra/theme_extension.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';import 'package:flowy_infra_ui/style_widget/hover.dart';+import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:google_fonts/google_fonts.dart';@@ -125,6 +125,7 @@ class SettingsWorkspaceView extends StatelessWidget {_ThemeDropdown(),_DocumentCursorColorSetting(),_DocumentSelectionColorSetting(),+ _DocumentPaddingSetting(),],),const SettingsCategorySpacer(),@@ -1266,3 +1267,90 @@ class _SelectionColorValueWidget extends StatelessWidget {);}}++class _DocumentPaddingSetting extends StatelessWidget {+ const _DocumentPaddingSetting();++ @override+ Widget build(BuildContext context) {+ return BlocBuilder<DocumentAppearanceCubit, DocumentAppearance>(+ builder: (context, state) {+ return Column(+ children: [+ Row(+ children: [+ FlowyText.medium(+ LocaleKeys.settings_appearance_documentSettings_width.tr(),+ ),+ const Spacer(),+ SettingsResetButton(+ onResetRequested: () =>+ context.read<DocumentAppearanceCubit>().syncWidth(null),+ ),+ ],+ ),+ const VSpace(6),+ Container(+ height: 32,+ padding: const EdgeInsets.only(right: 4),+ child: _DocumentPaddingSlider(+ onPaddingChanged: (value) {+ context.read<DocumentAppearanceCubit>().syncWidth(value);+ },+ ),+ ),+ ],+ );+ },+ );+ }+}++class _DocumentPaddingSlider extends StatefulWidget {+ const _DocumentPaddingSlider({+ required this.onPaddingChanged,+ });++ final void Function(double) onPaddingChanged;++ @override+ State<_DocumentPaddingSlider> createState() => _DocumentPaddingSliderState();+}++class _DocumentPaddingSliderState extends State<_DocumentPaddingSlider> {+ late double width;++ @override+ void initState() {+ super.initState();++ width = context.read<DocumentAppearanceCubit>().state.width;+ }++ @override+ Widget build(BuildContext context) {+ return SliderTheme(+ data: Theme.of(context).sliderTheme.copyWith(+ showValueIndicator: ShowValueIndicator.never,+ thumbShape: const RoundSliderThumbShape(+ enabledThumbRadius: 8,+ ),+ overlayShape: SliderComponentShape.noThumb,+ ),+ child: Slider(+ value: width.clamp(+ EditorStyleCustomizer.minDocumentWidth,+ EditorStyleCustomizer.maxDocumentWidth,+ ),+ min: EditorStyleCustomizer.minDocumentWidth,+ max: EditorStyleCustomizer.maxDocumentWidth,+ divisions: 10,+ onChanged: (value) {+ setState(() => width = value);++ widget.onPaddingChanged(value);+ },+ ),+ );+ }+}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/setting_list_tile.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/setting_list_tile.dartindex 78d8d5223a..9c1f0f4fc4 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/setting_list_tile.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/setting_list_tile.dart@@ -1,9 +1,8 @@-import 'package:flutter/material.dart';-import 'package:appflowy/generated/flowy_svgs.g.dart';import 'package:appflowy/generated/locale_keys.g.dart';import 'package:easy_localization/easy_localization.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';+import 'package:flutter/material.dart';class SettingListTile extends StatelessWidget {const SettingListTile({@@ -13,6 +12,7 @@ class SettingListTile extends StatelessWidget {required this.label,this.hint,this.trailing,+ this.subtitle,this.onResetRequested,});@@ -21,7 +21,8 @@ class SettingListTile extends StatelessWidget {final String? resetTooltipText;final Key? resetButtonKey;final List<Widget>? trailing;- final void Function()? onResetRequested;+ final List<Widget>? subtitle;+ final VoidCallback? onResetRequested;@overrideWidget build(BuildContext context) {@@ -45,26 +46,46 @@ class SettingListTile extends StatelessWidget {color: Theme.of(context).hintColor,),),+ if (subtitle != null) ...subtitle!,],),),if (trailing != null) ...trailing!,if (onResetRequested != null)- FlowyIconButton(- hoverColor: Theme.of(context).colorScheme.secondaryContainer,+ SettingsResetButton(key: resetButtonKey,- width: 24,- icon: FlowySvg(- FlowySvgs.restore_s,- color: Theme.of(context).iconTheme.color,- size: const Size.square(20),- ),- iconColorOnHover: Theme.of(context).colorScheme.onPrimary,- tooltipText: resetTooltipText ??- LocaleKeys.settings_appearance_resetSetting.tr(),- onPressed: onResetRequested,+ resetTooltipText: resetTooltipText,+ onResetRequested: onResetRequested,),],);}}++class SettingsResetButton extends StatelessWidget {+ const SettingsResetButton({+ super.key,+ this.resetTooltipText,+ this.onResetRequested,+ });++ final String? resetTooltipText;+ final VoidCallback? onResetRequested;++ @override+ Widget build(BuildContext context) {+ return FlowyIconButton(+ hoverColor: Theme.of(context).colorScheme.secondaryContainer,+ width: 24,+ icon: FlowySvg(+ FlowySvgs.restore_s,+ color: Theme.of(context).iconTheme.color,+ size: const Size.square(20),+ ),+ iconColorOnHover: Theme.of(context).colorScheme.onPrimary,+ tooltipText:+ resetTooltipText ?? LocaleKeys.settings_appearance_resetSetting.tr(),+ onPressed: onResetRequested,+ );+ }+}diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lockindex 46fc6d3c98..af9b5546f3 100644--- a/frontend/appflowy_flutter/pubspec.lock+++ b/frontend/appflowy_flutter/pubspec.lock@@ -53,8 +53,8 @@ packages:dependency: "direct main"description:path: "."- ref: ea494df- resolved-ref: ea494df5564bca1e72b7a6ce2f854fa51543a073+ ref: bb525e4+ resolved-ref: bb525e41dfda40c891c2641d38bce29eb1a21769url: "https://github.com/AppFlowy-IO/appflowy-editor.git"source: gitversion: "3.3.0"diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yamlindex 3532e301f4..980e1bf537 100644--- a/frontend/appflowy_flutter/pubspec.yaml+++ b/frontend/appflowy_flutter/pubspec.yaml@@ -175,7 +175,7 @@ dependency_overrides:appflowy_editor:git:url: https://github.com/AppFlowy-IO/appflowy-editor.git- ref: "ea494df"+ ref: "bb525e4"appflowy_editor_plugins:git:diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.jsonindex a7a107e3ae..3435848f17 100644--- a/frontend/resources/translations/en.json+++ b/frontend/resources/translations/en.json@@ -458,6 +458,9 @@"title": "Reset document selection color","description": "Are you sure you want to reset the selection color?"},+ "resetWidth": {+ "resetSuccess": "Reset document width successfully"+ },"theme": {"title": "Theme","description": "Select a preset theme, or upload your own custom theme.",@@ -1040,6 +1043,8 @@"documentSettings": {"cursorColor": "Document cursor color","selectionColor": "Document selection color",+ "width": "Document width",+ "changeWidth": "Change","pickColor": "Select a color","colorShade": "Color shade","opacity": "Opacity",@@ -2593,4 +2598,4 @@"changeAccount": "Change account"}}-}\ No newline at end of file+}