diff --git a/lib/appflowy_editor.dart b/lib/appflowy_editor.dart index 470f8b226..12afc8f80 100644 --- a/lib/appflowy_editor.dart +++ b/lib/appflowy_editor.dart @@ -10,6 +10,7 @@ export 'src/editor/block_component/rich_text/default_selectable_mixin.dart'; // editor part, including editor component, block component, etc. export 'src/editor/editor.dart'; export 'src/editor/find_replace_menu/find_and_replace.dart'; +export 'src/editor/l10n/appflowy_editor_l10n.dart'; export 'src/editor/selection_menu/selection_menu.dart'; // editor state export 'src/editor_state.dart'; diff --git a/lib/src/editor/block_component/divider_block_component/divider_menu_item.dart b/lib/src/editor/block_component/divider_block_component/divider_menu_item.dart index 420e9deea..dc66ceb9a 100644 --- a/lib/src/editor/block_component/divider_block_component/divider_menu_item.dart +++ b/lib/src/editor/block_component/divider_block_component/divider_menu_item.dart @@ -2,7 +2,7 @@ import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; SelectionMenuItem dividerMenuItem = SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.divider, + name: AppFlowyEditorL10n.current.divider, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( icon: Icons.horizontal_rule, isSelected: isSelected, diff --git a/lib/src/editor/block_component/image_block_component/image_upload_widget.dart b/lib/src/editor/block_component/image_block_component/image_upload_widget.dart index e5aa36ae6..fc35e3756 100644 --- a/lib/src/editor/block_component/image_block_component/image_upload_widget.dart +++ b/lib/src/editor/block_component/image_block_component/image_upload_widget.dart @@ -133,8 +133,8 @@ class _UploadImageMenuState extends State { height: 36, child: TabBar( tabs: [ - Tab(text: AppFlowyEditorLocalizations.current.uploadImage), - Tab(text: AppFlowyEditorLocalizations.current.urlImage), + Tab(text: AppFlowyEditorL10n.current.uploadImage), + Tab(text: AppFlowyEditorL10n.current.urlImage), ], labelColor: widget.headerColor, unselectedLabelColor: Colors.grey, @@ -204,7 +204,7 @@ class _UploadImageMenuState extends State { Widget _buildInvalidLinkText() { return Text( - AppFlowyEditorLocalizations.current.incorrectLink, + AppFlowyEditorL10n.current.incorrectLink, style: const TextStyle(color: Colors.red, fontSize: 12), ); } @@ -240,7 +240,7 @@ class _UploadImageMenuState extends State { } }, child: Text( - AppFlowyEditorLocalizations.current.upload, + AppFlowyEditorL10n.current.upload, style: TextStyle( color: Theme.of(context).colorScheme.onPrimary, fontSize: 14.0, @@ -339,7 +339,7 @@ class _UploadImageMenuState extends State { ), const SizedBox(height: 8.0), Text( - AppFlowyEditorLocalizations.current.chooseImage, + AppFlowyEditorL10n.current.chooseImage, style: const TextStyle( fontSize: 14.0, color: Color(0xff00BCF0), diff --git a/lib/src/editor/block_component/image_block_component/resizable_image.dart b/lib/src/editor/block_component/image_block_component/resizable_image.dart index ad2191c88..db6989cb8 100644 --- a/lib/src/editor/block_component/image_block_component/resizable_image.dart +++ b/lib/src/editor/block_component/image_block_component/resizable_image.dart @@ -147,7 +147,7 @@ class _ResizableImageState extends State { SizedBox.fromSize( size: const Size(10, 10), ), - Text(AppFlowyEditorLocalizations.current.loading), + Text(AppFlowyEditorL10n.current.loading), ], ), ); @@ -163,7 +163,7 @@ class _ResizableImageState extends State { borderRadius: const BorderRadius.all(Radius.circular(4.0)), border: Border.all(width: 1, color: Colors.black), ), - child: Text(AppFlowyEditorLocalizations.current.imageLoadFailed), + child: Text(AppFlowyEditorL10n.current.imageLoadFailed), ); } diff --git a/lib/src/editor/block_component/standard_block_components.dart b/lib/src/editor/block_component/standard_block_components.dart index e2a5529bb..9b988fc62 100644 --- a/lib/src/editor/block_component/standard_block_components.dart +++ b/lib/src/editor/block_component/standard_block_components.dart @@ -8,7 +8,7 @@ final Map standardBlockComponentBuilderMap = { ParagraphBlockKeys.type: ParagraphBlockComponentBuilder( configuration: standardBlockComponentConfiguration.copyWith( placeholderText: (_) => PlatformExtension.isDesktopOrWeb - ? AppFlowyEditorLocalizations.current.slashPlaceHolder + ? AppFlowyEditorL10n.current.slashPlaceHolder : ' ', ), ), diff --git a/lib/src/editor/block_component/table_block_component/table_action_menu.dart b/lib/src/editor/block_component/table_block_component/table_action_menu.dart index 80275b291..0fd4eb1a0 100644 --- a/lib/src/editor/block_component/table_block_component/table_action_menu.dart +++ b/lib/src/editor/block_component/table_block_component/table_action_menu.dart @@ -1,7 +1,7 @@ -import 'package:flutter/material.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; -import 'package:appflowy_editor/src/editor/toolbar/desktop/items/utils/overlay_util.dart'; import 'package:appflowy_editor/src/editor/block_component/table_block_component/util.dart'; +import 'package:appflowy_editor/src/editor/toolbar/desktop/items/utils/overlay_util.dart'; +import 'package:flutter/material.dart'; void showActionMenu( BuildContext context, @@ -41,8 +41,8 @@ void showActionMenu( _menuItem( context, dir == TableDirection.col - ? AppFlowyEditorLocalizations.current.colAddAfter - : AppFlowyEditorLocalizations.current.rowAddAfter, + ? AppFlowyEditorL10n.current.colAddAfter + : AppFlowyEditorL10n.current.rowAddAfter, dir == TableDirection.col ? Icons.last_page : Icons.vertical_align_bottom, () { @@ -52,8 +52,8 @@ void showActionMenu( _menuItem( context, dir == TableDirection.col - ? AppFlowyEditorLocalizations.current.colAddBefore - : AppFlowyEditorLocalizations.current.rowAddBefore, + ? AppFlowyEditorL10n.current.colAddBefore + : AppFlowyEditorL10n.current.rowAddBefore, dir == TableDirection.col ? Icons.first_page : Icons.vertical_align_top, () { @@ -63,8 +63,8 @@ void showActionMenu( _menuItem( context, dir == TableDirection.col - ? AppFlowyEditorLocalizations.current.colRemove - : AppFlowyEditorLocalizations.current.rowRemove, + ? AppFlowyEditorL10n.current.colRemove + : AppFlowyEditorL10n.current.rowRemove, Icons.delete, () { TableActions.delete(node, position, editorState, dir); dismissOverlay(); @@ -72,15 +72,15 @@ void showActionMenu( _menuItem( context, dir == TableDirection.col - ? AppFlowyEditorLocalizations.current.colDuplicate - : AppFlowyEditorLocalizations.current.rowDuplicate, + ? AppFlowyEditorL10n.current.colDuplicate + : AppFlowyEditorL10n.current.rowDuplicate, Icons.content_copy, () { TableActions.duplicate(node, position, editorState, dir); dismissOverlay(); }), _menuItem( context, - AppFlowyEditorLocalizations.current.backgroundColor, + AppFlowyEditorL10n.current.backgroundColor, Icons.format_color_fill, () { final cell = dir == TableDirection.col @@ -112,8 +112,8 @@ void showActionMenu( _menuItem( context, dir == TableDirection.col - ? AppFlowyEditorLocalizations.current.colClear - : AppFlowyEditorLocalizations.current.rowClear, + ? AppFlowyEditorL10n.current.colClear + : AppFlowyEditorL10n.current.rowClear, Icons.clear, () { TableActions.clear(node, position, editorState, dir); dismissOverlay(); @@ -180,14 +180,14 @@ void _showColorMenu( left: left, builder: (context) { return ColorPicker( - title: AppFlowyEditorLocalizations.current.highlightColor, + title: AppFlowyEditorL10n.current.highlightColor, selectedColorHex: selectedColorHex, colorOptions: generateHighlightColorOptions(), onSubmittedColorHex: (color) { action(color); dismissOverlay(); }, - resetText: AppFlowyEditorLocalizations.current.clearHighlightColor, + resetText: AppFlowyEditorL10n.current.clearHighlightColor, resetIconName: 'clear_highlight_color', ); }, diff --git a/lib/src/editor/block_component/table_block_component/table_block_component.dart b/lib/src/editor/block_component/table_block_component/table_block_component.dart index 89e345d5b..a703252e5 100644 --- a/lib/src/editor/block_component/table_block_component/table_block_component.dart +++ b/lib/src/editor/block_component/table_block_component/table_block_component.dart @@ -251,7 +251,7 @@ class _TableBlockComponentWidgetState extends State } SelectionMenuItem tableMenuItem = SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.table, + name: AppFlowyEditorL10n.current.table, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( icon: Icons.table_view, isSelected: isSelected, diff --git a/lib/src/editor/editor_component/style/mobile_text_span_decorator_for_attribute.dart b/lib/src/editor/editor_component/style/mobile_text_span_decorator_for_attribute.dart index db9346c0c..43188d331 100644 --- a/lib/src/editor/editor_component/style/mobile_text_span_decorator_for_attribute.dart +++ b/lib/src/editor/editor_component/style/mobile_text_span_decorator_for_attribute.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/gestures.dart'; - import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -52,7 +51,7 @@ TextSpan mobileTextSpanDecoratorForAttribute( context: context, builder: (BuildContext context) { return AlertDialog( - title: Text(AppFlowyEditorLocalizations.current.editLink), + title: Text(AppFlowyEditorL10n.current.editLink), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4), ), @@ -122,12 +121,12 @@ class _LinkEditFormState extends State { keyboardType: TextInputType.text, validator: (value) { if (value == null || value.isEmpty) { - return AppFlowyEditorLocalizations.current.linkTextHint; + return AppFlowyEditorL10n.current.linkTextHint; } return null; }, decoration: InputDecoration( - hintText: AppFlowyEditorLocalizations.current.linkText, + hintText: AppFlowyEditorL10n.current.linkText, suffixIcon: IconButton( icon: const Icon( Icons.clear_rounded, @@ -143,12 +142,12 @@ class _LinkEditFormState extends State { keyboardType: TextInputType.url, validator: (value) { if (value == null || value.isEmpty) { - return AppFlowyEditorLocalizations.current.linkAddressHint; + return AppFlowyEditorL10n.current.linkAddressHint; } return null; }, decoration: InputDecoration( - hintText: AppFlowyEditorLocalizations.current.urlHint, + hintText: AppFlowyEditorL10n.current.urlHint, suffixIcon: IconButton( icon: const Icon( Icons.clear_rounded, @@ -164,7 +163,7 @@ class _LinkEditFormState extends State { children: [ TextButton( child: Text( - AppFlowyEditorLocalizations.current.removeLink, + AppFlowyEditorL10n.current.removeLink, style: TextStyle(color: Theme.of(context).colorScheme.error), ), onPressed: () async { @@ -184,7 +183,7 @@ class _LinkEditFormState extends State { style: TextButton.styleFrom( textStyle: Theme.of(context).textTheme.labelLarge, ), - child: Text(AppFlowyEditorLocalizations.current.done), + child: Text(AppFlowyEditorL10n.current.done), onPressed: () async { if (_formKey.currentState!.validate()) { final bool textChanged = diff --git a/lib/src/editor/find_replace_menu/find_replace_widget.dart b/lib/src/editor/find_replace_menu/find_replace_widget.dart index 07b519b07..3a14bd3dd 100644 --- a/lib/src/editor/find_replace_menu/find_replace_widget.dart +++ b/lib/src/editor/find_replace_menu/find_replace_widget.dart @@ -1,7 +1,8 @@ import 'package:appflowy_editor/appflowy_editor.dart'; -import 'find_replace_menu_icon_button.dart'; import 'package:flutter/material.dart'; +import 'find_replace_menu_icon_button.dart'; + const double _iconButtonSize = 30; class FindAndReplaceMenuWidget extends StatefulWidget { @@ -239,8 +240,7 @@ class _FindMenuState extends State { }); }, decoration: _buildInputDecoration( - widget.localizations?.find ?? - AppFlowyEditorLocalizations.current.find, + widget.localizations?.find ?? AppFlowyEditorL10n.current.find, ), ), ), @@ -261,7 +261,7 @@ class _FindMenuState extends State { onPressed: () => widget.searchService.navigateToMatch(moveUp: true), icon: const Icon(Icons.arrow_upward), tooltip: widget.localizations?.previousMatch ?? - AppFlowyEditorLocalizations.current.previousMatch, + AppFlowyEditorL10n.current.previousMatch, ), // next match button FindAndReplaceMenuIconButton( @@ -269,14 +269,14 @@ class _FindMenuState extends State { onPressed: () => widget.searchService.navigateToMatch(), icon: const Icon(Icons.arrow_downward), tooltip: widget.localizations?.nextMatch ?? - AppFlowyEditorLocalizations.current.nextMatch, + AppFlowyEditorL10n.current.nextMatch, ), FindAndReplaceMenuIconButton( iconButtonKey: const Key('closeButton'), onPressed: widget.onDismiss, icon: const Icon(Icons.close), tooltip: widget.localizations?.close ?? - AppFlowyEditorLocalizations.current.closeFind, + AppFlowyEditorL10n.current.closeFind, ), // regex button if (showRegexButton) @@ -294,7 +294,7 @@ class _FindMenuState extends State { height: 20, color: widget.searchService.regex ? Colors.black : Colors.grey, ), - tooltip: AppFlowyEditorLocalizations.current.regex, + tooltip: AppFlowyEditorL10n.current.regex, ), // case sensitive button if (showCaseSensitiveButton) @@ -315,7 +315,7 @@ class _FindMenuState extends State { ? Colors.black : Colors.grey, ), - tooltip: AppFlowyEditorLocalizations.current.caseSensitive, + tooltip: AppFlowyEditorL10n.current.caseSensitive, ), ], ); @@ -384,7 +384,7 @@ class _ReplaceMenuState extends State { }, decoration: _buildInputDecoration( widget.localizations?.replace ?? - AppFlowyEditorLocalizations.current.replace, + AppFlowyEditorL10n.current.replace, ), ), ), @@ -393,7 +393,7 @@ class _ReplaceMenuState extends State { onPressed: _replaceSelectedWord, icon: const Icon(Icons.find_replace), tooltip: widget.localizations?.replace ?? - AppFlowyEditorLocalizations.current.replace, + AppFlowyEditorL10n.current.replace, ), FindAndReplaceMenuIconButton( iconButtonKey: const Key('replaceAllButton'), @@ -402,7 +402,7 @@ class _ReplaceMenuState extends State { ), icon: const Icon(Icons.change_circle_outlined), tooltip: widget.localizations?.replaceAll ?? - AppFlowyEditorLocalizations.current.replaceAll, + AppFlowyEditorL10n.current.replaceAll, ), ], ); diff --git a/lib/src/editor/l10n/appflowy_editor_l10n.dart b/lib/src/editor/l10n/appflowy_editor_l10n.dart new file mode 100644 index 000000000..cba4d73a2 --- /dev/null +++ b/lib/src/editor/l10n/appflowy_editor_l10n.dart @@ -0,0 +1,5 @@ +import 'package:appflowy_editor/appflowy_editor.dart'; + +class AppFlowyEditorL10n extends AppFlowyEditorLocalizations { + static AppFlowyEditorLocalizations current = AppFlowyEditorL10n(); +} diff --git a/lib/src/editor/selection_menu/selection_menu_service.dart b/lib/src/editor/selection_menu/selection_menu_service.dart index 33a186b8f..17afc6868 100644 --- a/lib/src/editor/selection_menu/selection_menu_service.dart +++ b/lib/src/editor/selection_menu/selection_menu_service.dart @@ -238,7 +238,7 @@ class SelectionMenu extends SelectionMenuService { final List standardSelectionMenuItems = [ SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.text, + name: AppFlowyEditorL10n.current.text, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'text', isSelected: isSelected, @@ -250,7 +250,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.heading1, + name: AppFlowyEditorL10n.current.heading1, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'h1', isSelected: isSelected, @@ -262,7 +262,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.heading2, + name: AppFlowyEditorL10n.current.heading2, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'h2', isSelected: isSelected, @@ -274,7 +274,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.heading3, + name: AppFlowyEditorL10n.current.heading3, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'h3', isSelected: isSelected, @@ -286,7 +286,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.image, + name: AppFlowyEditorL10n.current.image, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'image', isSelected: isSelected, @@ -299,7 +299,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.bulletedList, + name: AppFlowyEditorL10n.current.bulletedList, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'bulleted_list', isSelected: isSelected, @@ -311,7 +311,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.numberedList, + name: AppFlowyEditorL10n.current.numberedList, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'number', isSelected: isSelected, @@ -323,7 +323,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.checkbox, + name: AppFlowyEditorL10n.current.checkbox, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'checkbox', isSelected: isSelected, @@ -335,7 +335,7 @@ final List standardSelectionMenuItems = [ }, ), SelectionMenuItem( - name: AppFlowyEditorLocalizations.current.quote, + name: AppFlowyEditorL10n.current.quote, icon: (editorState, isSelected, style) => SelectionMenuIconWidget( name: 'quote', isSelected: isSelected, diff --git a/lib/src/editor/toolbar/desktop/items/bulleted_list_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/bulleted_list_toolbar_item.dart index d07f8ba78..e5f0484b1 100644 --- a/lib/src/editor/toolbar/desktop/items/bulleted_list_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/bulleted_list_toolbar_item.dart @@ -13,7 +13,7 @@ final ToolbarItem bulletedListItem = ToolbarItem( isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.bulletedList, + tooltip: AppFlowyEditorL10n.current.bulletedList, onPressed: () => editorState.formatNode( selection, (node) => node.copyWith( diff --git a/lib/src/editor/toolbar/desktop/items/color/color_menu.dart b/lib/src/editor/toolbar/desktop/items/color/color_menu.dart index 585b0e238..536e0dc91 100644 --- a/lib/src/editor/toolbar/desktop/items/color/color_menu.dart +++ b/lib/src/editor/toolbar/desktop/items/color/color_menu.dart @@ -45,8 +45,8 @@ void showColorMenu( builder: (context) { return ColorPicker( title: isTextColor - ? AppFlowyEditorLocalizations.current.textColor - : AppFlowyEditorLocalizations.current.highlightColor, + ? AppFlowyEditorL10n.current.textColor + : AppFlowyEditorL10n.current.highlightColor, showClearButton: showClearButton, selectedColorHex: currentColorHex, colorOptions: isTextColor @@ -70,8 +70,8 @@ void showColorMenu( keepEditorFocusNotifier.decrease(); }, resetText: isTextColor - ? AppFlowyEditorLocalizations.current.resetToDefaultColor - : AppFlowyEditorLocalizations.current.clearHighlightColor, + ? AppFlowyEditorL10n.current.resetToDefaultColor + : AppFlowyEditorL10n.current.clearHighlightColor, resetIconName: isTextColor ? 'reset_text_color' : 'clear_highlight_color', ); diff --git a/lib/src/editor/toolbar/desktop/items/color/color_picker.dart b/lib/src/editor/toolbar/desktop/items/color/color_picker.dart index 556eb83db..9c2ef4bc3 100644 --- a/lib/src/editor/toolbar/desktop/items/color/color_picker.dart +++ b/lib/src/editor/toolbar/desktop/items/color/color_picker.dart @@ -231,7 +231,7 @@ class _CustomColorItemState extends State { const SizedBox(width: 8), Expanded( child: Text( - AppFlowyEditorLocalizations.current.customColor, + AppFlowyEditorL10n.current.customColor, style: Theme.of(context).textTheme.labelLarge, // same style as TextButton.icon ), @@ -241,7 +241,7 @@ class _CustomColorItemState extends State { children: [ const SizedBox(height: 6), _customColorDetailsTextField( - labelText: AppFlowyEditorLocalizations.current.hexValue, + labelText: AppFlowyEditorL10n.current.hexValue, controller: widget.colorController, // update the color sample box when the text changes onChanged: (_) => setState(() {}), @@ -249,7 +249,7 @@ class _CustomColorItemState extends State { ), const SizedBox(height: 10), _customColorDetailsTextField( - labelText: AppFlowyEditorLocalizations.current.opacity, + labelText: AppFlowyEditorL10n.current.opacity, controller: widget.opacityController, // update the color sample box when the text changes onChanged: (_) => setState(() {}), diff --git a/lib/src/editor/toolbar/desktop/items/color/highlight_color_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/color/highlight_color_toolbar_item.dart index 0fb778976..f9f00253b 100644 --- a/lib/src/editor/toolbar/desktop/items/color/highlight_color_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/color/highlight_color_toolbar_item.dart @@ -21,7 +21,7 @@ ToolbarItem buildHighlightColorItem({List? colorOptions}) { isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.highlightColor, + tooltip: AppFlowyEditorL10n.current.highlightColor, onPressed: () { bool showClearButton = false; nodes.allSatisfyInSelection(selection, (delta) { diff --git a/lib/src/editor/toolbar/desktop/items/color/text_color_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/color/text_color_toolbar_item.dart index 4577281cd..db7387faf 100644 --- a/lib/src/editor/toolbar/desktop/items/color/text_color_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/color/text_color_toolbar_item.dart @@ -22,7 +22,7 @@ ToolbarItem buildTextColorItem({ isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.textColor, + tooltip: AppFlowyEditorL10n.current.textColor, onPressed: () { bool showClearButton = false; nodes.allSatisfyInSelection( diff --git a/lib/src/editor/toolbar/desktop/items/format_toolbar_items.dart b/lib/src/editor/toolbar/desktop/items/format_toolbar_items.dart index 53b59f0ed..6115973dc 100644 --- a/lib/src/editor/toolbar/desktop/items/format_toolbar_items.dart +++ b/lib/src/editor/toolbar/desktop/items/format_toolbar_items.dart @@ -6,31 +6,31 @@ final List markdownFormatItems = [ id: 'underline', name: 'underline', tooltip: - '${AppFlowyEditorLocalizations.current.underline}${shortcutTooltips('⌘ + U', 'CTRL + U', 'CTRL + U')}', + '${AppFlowyEditorL10n.current.underline}${shortcutTooltips('⌘ + U', 'CTRL + U', 'CTRL + U')}', ), _FormatToolbarItem( id: 'bold', name: 'bold', tooltip: - '${AppFlowyEditorLocalizations.current.bold}${shortcutTooltips('⌘ + B', 'CTRL + B', 'CTRL + B')}', + '${AppFlowyEditorL10n.current.bold}${shortcutTooltips('⌘ + B', 'CTRL + B', 'CTRL + B')}', ), _FormatToolbarItem( id: 'italic', name: 'italic', tooltip: - '${AppFlowyEditorLocalizations.current.italic}${shortcutTooltips('⌘ + I', 'CTRL + I', 'CTRL + I')}', + '${AppFlowyEditorL10n.current.italic}${shortcutTooltips('⌘ + I', 'CTRL + I', 'CTRL + I')}', ), _FormatToolbarItem( id: 'strikethrough', name: 'strikethrough', tooltip: - '${AppFlowyEditorLocalizations.current.strikethrough}${shortcutTooltips('⌘ + SHIFT + S', 'CTRL + SHIFT + S', 'CTRL + SHIFT + S')}', + '${AppFlowyEditorL10n.current.strikethrough}${shortcutTooltips('⌘ + SHIFT + S', 'CTRL + SHIFT + S', 'CTRL + SHIFT + S')}', ), _FormatToolbarItem( id: 'code', name: 'code', tooltip: - '${AppFlowyEditorLocalizations.current.embedCode}${shortcutTooltips('⌘ + E', 'CTRL + E', 'CTRL + E')}', + '${AppFlowyEditorL10n.current.embedCode}${shortcutTooltips('⌘ + E', 'CTRL + E', 'CTRL + E')}', ), ]; diff --git a/lib/src/editor/toolbar/desktop/items/heading_toolbar_items.dart b/lib/src/editor/toolbar/desktop/items/heading_toolbar_items.dart index 5c2af5cb7..3e5c823eb 100644 --- a/lib/src/editor/toolbar/desktop/items/heading_toolbar_items.dart +++ b/lib/src/editor/toolbar/desktop/items/heading_toolbar_items.dart @@ -46,11 +46,11 @@ class _HeadingToolbarItem extends ToolbarItem { static String levelToTooltips(int level) { if (level == 1) { - return AppFlowyEditorLocalizations.current.heading1; + return AppFlowyEditorL10n.current.heading1; } else if (level == 2) { - return AppFlowyEditorLocalizations.current.heading2; + return AppFlowyEditorL10n.current.heading2; } else if (level == 3) { - return AppFlowyEditorLocalizations.current.heading3; + return AppFlowyEditorL10n.current.heading3; } return ''; } diff --git a/lib/src/editor/toolbar/desktop/items/link/link_menu.dart b/lib/src/editor/toolbar/desktop/items/link/link_menu.dart index 00d824e88..9f8988f2c 100644 --- a/lib/src/editor/toolbar/desktop/items/link/link_menu.dart +++ b/lib/src/editor/toolbar/desktop/items/link/link_menu.dart @@ -1,9 +1,7 @@ -import 'package:appflowy_editor/src/editor_state.dart'; -import 'package:appflowy_editor/src/infra/flowy_svg.dart'; -import 'package:appflowy_editor/src/l10n/l10n.dart'; +import 'package:appflowy_editor/appflowy_editor.dart'; +import 'package:appflowy_editor/src/editor/toolbar/desktop/items/utils/overlay_util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:appflowy_editor/src/editor/toolbar/desktop/items/utils/overlay_util.dart'; class LinkMenu extends StatefulWidget { const LinkMenu({ @@ -56,7 +54,7 @@ class _LinkMenuState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ EditorOverlayTitle( - text: AppFlowyEditorLocalizations.current.addYourLink, + text: AppFlowyEditorL10n.current.addYourLink, ), const SizedBox(height: 16.0), _buildInput(), @@ -64,17 +62,17 @@ class _LinkMenuState extends State { if (widget.linkText != null) ...[ _buildIconButton( iconName: 'link', - text: AppFlowyEditorLocalizations.current.openLink, + text: AppFlowyEditorL10n.current.openLink, onPressed: widget.onOpenLink, ), _buildIconButton( iconName: 'copy', - text: AppFlowyEditorLocalizations.current.copyLink, + text: AppFlowyEditorL10n.current.copyLink, onPressed: widget.onCopyLink, ), _buildIconButton( iconName: 'delete', - text: AppFlowyEditorLocalizations.current.removeLink, + text: AppFlowyEditorL10n.current.removeLink, onPressed: widget.onRemoveLink, ), ], @@ -98,7 +96,7 @@ class _LinkMenuState extends State { controller: _textEditingController, onSubmitted: widget.onSubmitted, decoration: InputDecoration( - hintText: AppFlowyEditorLocalizations.current.urlHint, + hintText: AppFlowyEditorL10n.current.urlHint, contentPadding: const EdgeInsets.all(16.0), isDense: true, suffixIcon: IconButton( diff --git a/lib/src/editor/toolbar/desktop/items/link/link_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/link/link_toolbar_item.dart index 89edf457f..1cba695ba 100644 --- a/lib/src/editor/toolbar/desktop/items/link/link_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/link/link_toolbar_item.dart @@ -24,7 +24,7 @@ final linkItem = ToolbarItem( isHighlight: isHref, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.link, + tooltip: AppFlowyEditorL10n.current.link, onPressed: () { showLinkMenu(context, editorState, selection, isHref); }, diff --git a/lib/src/editor/toolbar/desktop/items/numbered_list_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/numbered_list_toolbar_item.dart index 53fc29252..895e176db 100644 --- a/lib/src/editor/toolbar/desktop/items/numbered_list_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/numbered_list_toolbar_item.dart @@ -13,7 +13,7 @@ final ToolbarItem numberedListItem = ToolbarItem( isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.numberedList, + tooltip: AppFlowyEditorL10n.current.numberedList, onPressed: () => editorState.formatNode( selection, (node) => node.copyWith( diff --git a/lib/src/editor/toolbar/desktop/items/paragraph_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/paragraph_toolbar_item.dart index 708b6e776..c858dacfc 100644 --- a/lib/src/editor/toolbar/desktop/items/paragraph_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/paragraph_toolbar_item.dart @@ -14,7 +14,7 @@ final ToolbarItem paragraphItem = ToolbarItem( isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.text, + tooltip: AppFlowyEditorL10n.current.text, onPressed: () => editorState.formatNode( selection, (node) => node.copyWith( diff --git a/lib/src/editor/toolbar/desktop/items/quote_toolbar_item.dart b/lib/src/editor/toolbar/desktop/items/quote_toolbar_item.dart index a0ed2394b..6919baafa 100644 --- a/lib/src/editor/toolbar/desktop/items/quote_toolbar_item.dart +++ b/lib/src/editor/toolbar/desktop/items/quote_toolbar_item.dart @@ -13,7 +13,7 @@ final ToolbarItem quoteItem = ToolbarItem( isHighlight: isHighlight, highlightColor: highlightColor, iconColor: iconColor, - tooltip: AppFlowyEditorLocalizations.current.quote, + tooltip: AppFlowyEditorL10n.current.quote, onPressed: () => editorState.formatNode( selection, (node) => node.copyWith( diff --git a/lib/src/editor/toolbar/desktop/items/text_direction_toolbar_items.dart b/lib/src/editor/toolbar/desktop/items/text_direction_toolbar_items.dart index ab7c8bd3f..b3533773d 100644 --- a/lib/src/editor/toolbar/desktop/items/text_direction_toolbar_items.dart +++ b/lib/src/editor/toolbar/desktop/items/text_direction_toolbar_items.dart @@ -4,19 +4,19 @@ final List textDirectionItems = [ _TextDirectionToolbarItem( id: 'text_direction_auto', name: blockComponentTextDirectionAuto, - tooltip: AppFlowyEditorLocalizations.current.auto, + tooltip: AppFlowyEditorL10n.current.auto, iconName: 'text_direction_auto', ), _TextDirectionToolbarItem( id: 'text_direction_ltr', name: blockComponentTextDirectionLTR, - tooltip: AppFlowyEditorLocalizations.current.ltr, + tooltip: AppFlowyEditorL10n.current.ltr, iconName: 'text_direction_left', ), _TextDirectionToolbarItem( id: 'text_direction_rtl', name: blockComponentTextDirectionRTL, - tooltip: AppFlowyEditorLocalizations.current.rtl, + tooltip: AppFlowyEditorL10n.current.rtl, iconName: 'text_direction_right', ), ]; diff --git a/lib/src/editor/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item.dart b/lib/src/editor/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item.dart index 7fb03c52b..c2cee69c3 100644 --- a/lib/src/editor/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item.dart +++ b/lib/src/editor/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item.dart @@ -44,9 +44,9 @@ class _TextAndBackgroundColorMenuState final style = MobileToolbarStyle.of(context); List myTabs = [ Tab( - text: AppFlowyEditorLocalizations.current.textColor, + text: AppFlowyEditorL10n.current.textColor, ), - Tab(text: AppFlowyEditorLocalizations.current.backgroundColor), + Tab(text: AppFlowyEditorL10n.current.backgroundColor), ]; return DefaultTabController( diff --git a/lib/src/editor/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item.dart b/lib/src/editor/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item.dart index 1536cd245..16a06ca71 100644 --- a/lib/src/editor/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item.dart +++ b/lib/src/editor/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item.dart @@ -29,17 +29,17 @@ class _HeadingMenuState extends State<_HeadingMenu> { final headings = [ HeadingUnit( icon: AFMobileIcons.h1, - label: AppFlowyEditorLocalizations.current.mobileHeading1, + label: AppFlowyEditorL10n.current.mobileHeading1, level: 1, ), HeadingUnit( icon: AFMobileIcons.h2, - label: AppFlowyEditorLocalizations.current.mobileHeading2, + label: AppFlowyEditorL10n.current.mobileHeading2, level: 2, ), HeadingUnit( icon: AFMobileIcons.h3, - label: AppFlowyEditorLocalizations.current.mobileHeading3, + label: AppFlowyEditorL10n.current.mobileHeading3, level: 3, ), ]; diff --git a/lib/src/editor/toolbar/mobile/toolbar_items/link_mobile_toolbar_item.dart b/lib/src/editor/toolbar/mobile/toolbar_items/link_mobile_toolbar_item.dart index 30cf8574c..a546b533a 100644 --- a/lib/src/editor/toolbar/mobile/toolbar_items/link_mobile_toolbar_item.dart +++ b/lib/src/editor/toolbar/mobile/toolbar_items/link_mobile_toolbar_item.dart @@ -136,7 +136,7 @@ class _MobileLinkMenuState extends State { ), ), child: Text( - AppFlowyEditorLocalizations.current.cancel, + AppFlowyEditorL10n.current.cancel, ), ), ), @@ -164,7 +164,7 @@ class _MobileLinkMenuState extends State { ), ), child: Text( - AppFlowyEditorLocalizations.current.done, + AppFlowyEditorL10n.current.done, ), ), ), diff --git a/lib/src/editor/toolbar/mobile/toolbar_items/list_mobile_toolbar_item.dart b/lib/src/editor/toolbar/mobile/toolbar_items/list_mobile_toolbar_item.dart index 5997af554..23d051810 100644 --- a/lib/src/editor/toolbar/mobile/toolbar_items/list_mobile_toolbar_item.dart +++ b/lib/src/editor/toolbar/mobile/toolbar_items/list_mobile_toolbar_item.dart @@ -26,12 +26,12 @@ class _ListMenuState extends State<_ListMenu> { final lists = [ ListUnit( icon: AFMobileIcons.bulletedList, - label: AppFlowyEditorLocalizations.current.bulletedList, + label: AppFlowyEditorL10n.current.bulletedList, name: 'bulleted_list', ), ListUnit( icon: AFMobileIcons.numberedList, - label: AppFlowyEditorLocalizations.current.numberedList, + label: AppFlowyEditorL10n.current.numberedList, name: 'numbered_list', ), ]; diff --git a/lib/src/editor/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item.dart b/lib/src/editor/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item.dart index 6c4db49b9..533b2048b 100644 --- a/lib/src/editor/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item.dart +++ b/lib/src/editor/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item.dart @@ -26,22 +26,22 @@ class _TextDecorationMenuState extends State<_TextDecorationMenu> { final textDecorations = [ TextDecorationUnit( icon: AFMobileIcons.bold, - label: AppFlowyEditorLocalizations.current.bold, + label: AppFlowyEditorL10n.current.bold, name: AppFlowyRichTextKeys.bold, ), TextDecorationUnit( icon: AFMobileIcons.italic, - label: AppFlowyEditorLocalizations.current.italic, + label: AppFlowyEditorL10n.current.italic, name: AppFlowyRichTextKeys.italic, ), TextDecorationUnit( icon: AFMobileIcons.underline, - label: AppFlowyEditorLocalizations.current.underline, + label: AppFlowyEditorL10n.current.underline, name: AppFlowyRichTextKeys.underline, ), TextDecorationUnit( icon: AFMobileIcons.strikethrough, - label: AppFlowyEditorLocalizations.current.strikethrough, + label: AppFlowyEditorL10n.current.strikethrough, name: AppFlowyRichTextKeys.strikethrough, ), ]; diff --git a/lib/src/editor/toolbar/utils/color_generators.dart b/lib/src/editor/toolbar/utils/color_generators.dart index 027275dc7..338fbbb97 100644 --- a/lib/src/editor/toolbar/utils/color_generators.dart +++ b/lib/src/editor/toolbar/utils/color_generators.dart @@ -11,35 +11,35 @@ List generateTextColorOptions() { return [ ColorOption( colorHex: Colors.grey.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorGray, + name: AppFlowyEditorL10n.current.fontColorGray, ), ColorOption( colorHex: Colors.brown.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorBrown, + name: AppFlowyEditorL10n.current.fontColorBrown, ), ColorOption( colorHex: Colors.yellow.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorYellow, + name: AppFlowyEditorL10n.current.fontColorYellow, ), ColorOption( colorHex: Colors.green.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorGreen, + name: AppFlowyEditorL10n.current.fontColorGreen, ), ColorOption( colorHex: Colors.blue.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorBlue, + name: AppFlowyEditorL10n.current.fontColorBlue, ), ColorOption( colorHex: Colors.purple.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorPurple, + name: AppFlowyEditorL10n.current.fontColorPurple, ), ColorOption( colorHex: Colors.pink.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorPink, + name: AppFlowyEditorL10n.current.fontColorPink, ), ColorOption( colorHex: Colors.red.toHex(), - name: AppFlowyEditorLocalizations.current.fontColorRed, + name: AppFlowyEditorL10n.current.fontColorRed, ), ]; } @@ -54,35 +54,35 @@ List generateHighlightColorOptions() { return [ ColorOption( colorHex: Colors.grey.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorGray, + name: AppFlowyEditorL10n.current.backgroundColorGray, ), ColorOption( colorHex: Colors.brown.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorBrown, + name: AppFlowyEditorL10n.current.backgroundColorBrown, ), ColorOption( colorHex: Colors.yellow.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorYellow, + name: AppFlowyEditorL10n.current.backgroundColorYellow, ), ColorOption( colorHex: Colors.green.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorGreen, + name: AppFlowyEditorL10n.current.backgroundColorGreen, ), ColorOption( colorHex: Colors.blue.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorBlue, + name: AppFlowyEditorL10n.current.backgroundColorBlue, ), ColorOption( colorHex: Colors.purple.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorPurple, + name: AppFlowyEditorL10n.current.backgroundColorPurple, ), ColorOption( colorHex: Colors.pink.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorPink, + name: AppFlowyEditorL10n.current.backgroundColorPink, ), ColorOption( colorHex: Colors.red.withOpacity(0.3).toHex(), - name: AppFlowyEditorLocalizations.current.backgroundColorRed, + name: AppFlowyEditorL10n.current.backgroundColorRed, ), ]; } diff --git a/lib/src/service/context_menu/built_in_context_menu_item.dart b/lib/src/service/context_menu/built_in_context_menu_item.dart index d4eeb54dc..fc3a6c8c1 100644 --- a/lib/src/service/context_menu/built_in_context_menu_item.dart +++ b/lib/src/service/context_menu/built_in_context_menu_item.dart @@ -1,26 +1,27 @@ -import 'context_menu.dart'; -import '../../l10n/l10n.dart'; +import 'package:appflowy_editor/src/editor/l10n/appflowy_editor_l10n.dart'; + import '../internal_key_event_handlers/copy_paste_handler.dart'; +import 'context_menu.dart'; final standardContextMenuItems = [ [ // cut ContextMenuItem( - name: AppFlowyEditorLocalizations.current.cut, + name: AppFlowyEditorL10n.current.cut, onPressed: (editorState) { handleCut(editorState); }, ), // copy ContextMenuItem( - name: AppFlowyEditorLocalizations.current.copy, + name: AppFlowyEditorL10n.current.copy, onPressed: (editorState) { handleCopy(editorState); }, ), // Paste ContextMenuItem( - name: AppFlowyEditorLocalizations.current.paste, + name: AppFlowyEditorL10n.current.paste, onPressed: (editorState) { handlePaste(editorState); }, diff --git a/test/mobile/editor/editor_component/style/mobile_text_span_decorator_for_attribute_test.dart b/test/mobile/editor/editor_component/style/mobile_text_span_decorator_for_attribute_test.dart index 73ed10da8..923fef65b 100644 --- a/test/mobile/editor/editor_component/style/mobile_text_span_decorator_for_attribute_test.dart +++ b/test/mobile/editor/editor_component/style/mobile_text_span_decorator_for_attribute_test.dart @@ -1,7 +1,8 @@ import 'package:appflowy_editor/appflowy_editor.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; + import '../../../../new/infra/testable_editor.dart'; -import 'package:flutter/material.dart'; void main() { group('mobile_text_span_decorator_for_attribute.dart', () { @@ -84,17 +85,17 @@ void main() { await tester.tap( find.widgetWithText( TextButton, - AppFlowyEditorLocalizations.current.done, + AppFlowyEditorL10n.current.done, ), ); await tester.pumpAndSettle(const Duration(seconds: 1)); // show error prompt expect( - find.text(AppFlowyEditorLocalizations.current.linkTextHint), + find.text(AppFlowyEditorL10n.current.linkTextHint), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.linkAddressHint), + find.text(AppFlowyEditorL10n.current.linkAddressHint), findsOneWidget, ); }, @@ -132,7 +133,7 @@ void main() { await tester.tap( find.widgetWithText( TextButton, - AppFlowyEditorLocalizations.current.done, + AppFlowyEditorL10n.current.done, ), ); await tester.pumpAndSettle(const Duration(seconds: 1)); @@ -180,7 +181,7 @@ void main() { await tester.tap( find.widgetWithText( TextButton, - AppFlowyEditorLocalizations.current.removeLink, + AppFlowyEditorL10n.current.removeLink, ), ); await tester.pumpAndSettle(const Duration(seconds: 1)); diff --git a/test/mobile/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item_test.dart b/test/mobile/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item_test.dart index 8c898f27a..ba70f0885 100644 --- a/test/mobile/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item_test.dart +++ b/test/mobile/toolbar/mobile/toolbar_items/color/text_and_background_color_tool_bar_item_test.dart @@ -1,6 +1,7 @@ +import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:appflowy_editor/appflowy_editor.dart'; + import '../../../../../new/infra/testable_editor.dart'; import '../../test_helpers/mobile_app_with_toolbar_widget.dart'; @@ -36,11 +37,11 @@ void main() { // Show its menu and it has a tabbar to switch between text and background color expect(find.byType(MobileToolbarItemMenu), findsOneWidget); expect( - find.text(AppFlowyEditorLocalizations.current.textColor), + find.text(AppFlowyEditorL10n.current.textColor), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.backgroundColor), + find.text(AppFlowyEditorL10n.current.backgroundColor), findsOneWidget, ); @@ -80,7 +81,7 @@ void main() { await tester.tap( find.widgetWithText( TabBar, - AppFlowyEditorLocalizations.current.backgroundColor, + AppFlowyEditorL10n.current.backgroundColor, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); diff --git a/test/mobile/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item_test.dart b/test/mobile/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item_test.dart index a5c5556ea..1ad247937 100644 --- a/test/mobile/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item_test.dart +++ b/test/mobile/toolbar/mobile/toolbar_items/heading_mobile_toolbar_item_test.dart @@ -1,6 +1,7 @@ +import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:appflowy_editor/appflowy_editor.dart'; + import '../../../../new/infra/testable_editor.dart'; import '../test_helpers/mobile_app_with_toolbar_widget.dart'; @@ -35,15 +36,15 @@ void main() { // Show its menu and it has 3 buttons expect(find.byType(MobileToolbarItemMenu), findsOneWidget); expect( - find.text(AppFlowyEditorLocalizations.current.mobileHeading1), + find.text(AppFlowyEditorL10n.current.mobileHeading1), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.mobileHeading2), + find.text(AppFlowyEditorL10n.current.mobileHeading2), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.mobileHeading3), + find.text(AppFlowyEditorL10n.current.mobileHeading3), findsOneWidget, ); @@ -51,7 +52,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.mobileHeading1, + AppFlowyEditorL10n.current.mobileHeading1, ), ); var node = editor.editorState.getNodeAtPath([1]); @@ -66,7 +67,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.mobileHeading2, + AppFlowyEditorL10n.current.mobileHeading2, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); @@ -82,7 +83,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.mobileHeading3, + AppFlowyEditorL10n.current.mobileHeading3, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); diff --git a/test/mobile/toolbar/mobile/toolbar_items/list_mobile_toobar_item_test.dart b/test/mobile/toolbar/mobile/toolbar_items/list_mobile_toobar_item_test.dart index 6939ec8c4..c0e30ff5b 100644 --- a/test/mobile/toolbar/mobile/toolbar_items/list_mobile_toobar_item_test.dart +++ b/test/mobile/toolbar/mobile/toolbar_items/list_mobile_toobar_item_test.dart @@ -1,6 +1,7 @@ +import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:appflowy_editor/appflowy_editor.dart'; + import '../../../../new/infra/testable_editor.dart'; import '../test_helpers/mobile_app_with_toolbar_widget.dart'; @@ -35,11 +36,11 @@ void main() { // Show its menu and it has 2 buttons expect(find.byType(MobileToolbarItemMenu), findsOneWidget); expect( - find.text(AppFlowyEditorLocalizations.current.bulletedList), + find.text(AppFlowyEditorL10n.current.bulletedList), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.numberedList), + find.text(AppFlowyEditorL10n.current.numberedList), findsOneWidget, ); @@ -47,7 +48,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.bulletedList, + AppFlowyEditorL10n.current.bulletedList, ), ); var node = editor.editorState.getNodeAtPath([1]); @@ -61,7 +62,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.numberedList, + AppFlowyEditorL10n.current.numberedList, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); diff --git a/test/mobile/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item_test.dart b/test/mobile/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item_test.dart index 1f68e5e57..3ca77b886 100644 --- a/test/mobile/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item_test.dart +++ b/test/mobile/toolbar/mobile/toolbar_items/text_decoration_mobile_toolbar_item_test.dart @@ -1,6 +1,7 @@ +import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:appflowy_editor/appflowy_editor.dart'; + import '../../../../new/infra/testable_editor.dart'; void main() { @@ -27,19 +28,19 @@ void main() { // Show its menu and it has 4 buttons expect(find.byType(MobileToolbarItemMenu), findsOneWidget); expect( - find.text(AppFlowyEditorLocalizations.current.bold), + find.text(AppFlowyEditorL10n.current.bold), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.italic), + find.text(AppFlowyEditorL10n.current.italic), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.underline), + find.text(AppFlowyEditorL10n.current.underline), findsOneWidget, ); expect( - find.text(AppFlowyEditorLocalizations.current.strikethrough), + find.text(AppFlowyEditorL10n.current.strikethrough), findsOneWidget, ); @@ -47,7 +48,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.bold, + AppFlowyEditorL10n.current.bold, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); @@ -66,7 +67,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.italic, + AppFlowyEditorL10n.current.italic, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); @@ -84,7 +85,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.underline, + AppFlowyEditorL10n.current.underline, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500)); @@ -102,7 +103,7 @@ void main() { await tester.tap( find.widgetWithText( MobileToolbarItemMenuBtn, - AppFlowyEditorLocalizations.current.strikethrough, + AppFlowyEditorL10n.current.strikethrough, ), ); await tester.pumpAndSettle(const Duration(milliseconds: 500));