mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[chore] svg improvements (#3145)
* chore: remove use of svgWidget() * refactor: redundant code in svg * feat: add generator to generate flowy_svgs.g.dart * chore: reference new package in pubspec * chore: remove svg widget from flowy_infra * refactor: update usage in flowy_infra_ui * refactor: usage in appflowy_flutter * fix: error with script not running * fix: error with script not running * fix: use unix style file path * feat: use generation script for flowy svgs * feat: add task * fix: add required missing semicolon * fix: rebase errors * feat: update generate build script * fix: solve duplicate entries in the generated file * fix: compilation errors * fix: replace all spaces with an underscore * feat: use FlowySvgs * feat: reduce assets and simplify * refactor: do not return empty svg widget * fix: rebase errors * fix: analyzer warnings * chore: remove flowy_icons from tracking * chore: fix generate flowy icons script linux * chore: macos/linux script * chore: add rsync --------- Co-authored-by: Mathias Mogensen <mathiasrieckm@gmail.com> Co-authored-by: Mathias Mogensen <mathias@appflowy.io>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:appflowy/core/raw_keyboard_extension.dart';
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/block_action_button.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
@ -26,7 +27,7 @@ class BlockAddButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlockActionButton(
|
||||
svgName: 'editor/add',
|
||||
svg: FlowySvgs.add_s,
|
||||
richMessage: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
|
@ -1,18 +1,18 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BlockActionButton extends StatelessWidget {
|
||||
const BlockActionButton({
|
||||
super.key,
|
||||
required this.svgName,
|
||||
required this.svg,
|
||||
required this.richMessage,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String svgName;
|
||||
final FlowySvgData svg;
|
||||
final InlineSpan richMessage;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@ -31,8 +31,8 @@ class BlockActionButton extends StatelessWidget {
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.deferToChild,
|
||||
child: svgWidget(
|
||||
svgName,
|
||||
child: FlowySvg(
|
||||
svg,
|
||||
size: const Size.square(18.0),
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/block_action_button.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/option_action.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart';
|
||||
@ -57,7 +58,7 @@ class BlockOptionButton extends StatelessWidget {
|
||||
|
||||
Widget _buildOptionButton(PopoverController controller) {
|
||||
return BlockActionButton(
|
||||
svgName: 'editor/option',
|
||||
svg: FlowySvgs.drag_element_s,
|
||||
richMessage: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
|
@ -1,10 +1,11 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flowy_infra/theme_extension.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -22,24 +23,24 @@ enum OptionAction {
|
||||
divider,
|
||||
align;
|
||||
|
||||
String get assetName {
|
||||
FlowySvgData get svg {
|
||||
switch (this) {
|
||||
case OptionAction.delete:
|
||||
return 'editor/delete';
|
||||
return FlowySvgs.delete_s;
|
||||
case OptionAction.duplicate:
|
||||
return 'editor/duplicate';
|
||||
return FlowySvgs.copy_s;
|
||||
case OptionAction.turnInto:
|
||||
return 'editor/turn_into';
|
||||
return const FlowySvgData('editor/turn_into');
|
||||
case OptionAction.moveUp:
|
||||
return 'editor/move_up';
|
||||
return const FlowySvgData('editor/move_up');
|
||||
case OptionAction.moveDown:
|
||||
return 'editor/move_down';
|
||||
return const FlowySvgData('editor/move_down');
|
||||
case OptionAction.color:
|
||||
return 'editor/color';
|
||||
return const FlowySvgData('editor/color');
|
||||
case OptionAction.divider:
|
||||
return 'editor/divider';
|
||||
return const FlowySvgData('editor/divider');
|
||||
case OptionAction.align:
|
||||
return 'editor/align/center';
|
||||
return FlowySvgs.align_center_s;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,14 +84,14 @@ enum OptionAlignType {
|
||||
}
|
||||
}
|
||||
|
||||
String get assetName {
|
||||
FlowySvgData get svg {
|
||||
switch (this) {
|
||||
case OptionAlignType.left:
|
||||
return 'editor/align/left';
|
||||
return FlowySvgs.align_left_s;
|
||||
case OptionAlignType.center:
|
||||
return 'editor/align/center';
|
||||
return FlowySvgs.align_center_s;
|
||||
case OptionAlignType.right:
|
||||
return 'editor/align/right';
|
||||
return FlowySvgs.align_right_s;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ class AlignOptionAction extends PopoverActionCell {
|
||||
@override
|
||||
Widget? leftIcon(Color iconColor) {
|
||||
return FlowySvg(
|
||||
name: align.assetName,
|
||||
align.svg,
|
||||
size: const Size.square(12),
|
||||
).padding(all: 2.0);
|
||||
}
|
||||
@ -218,7 +219,7 @@ class ColorOptionAction extends PopoverActionCell {
|
||||
@override
|
||||
Widget? leftIcon(Color iconColor) {
|
||||
return const FlowySvg(
|
||||
name: 'editor/color_formatter',
|
||||
FlowySvgs.color_format_m,
|
||||
size: Size.square(12),
|
||||
).padding(all: 2.0);
|
||||
}
|
||||
@ -287,7 +288,7 @@ class OptionActionWrapper extends ActionCell {
|
||||
final OptionAction inner;
|
||||
|
||||
@override
|
||||
Widget? leftIcon(Color iconColor) => FlowySvg(name: inner.assetName);
|
||||
Widget? leftIcon(Color iconColor) => FlowySvg(inner.svg);
|
||||
|
||||
@override
|
||||
String get name => inner.description;
|
||||
@ -299,7 +300,7 @@ class OptionAlignWrapper extends ActionCell {
|
||||
final OptionAlignType inner;
|
||||
|
||||
@override
|
||||
Widget? leftIcon(Color iconColor) => FlowySvg(name: inner.assetName);
|
||||
Widget? leftIcon(Color iconColor) => FlowySvg(inner.svg);
|
||||
|
||||
@override
|
||||
String get name => inner.description;
|
||||
|
@ -1,8 +1,9 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/option_action.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -155,8 +156,8 @@ class OptionActionButton extends StatelessWidget {
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.deferToChild,
|
||||
child: svgWidget(
|
||||
'editor/option',
|
||||
child: FlowySvg(
|
||||
FlowySvgs.drag_element_s,
|
||||
size: const Size.square(24.0),
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy/startup/plugin/plugin.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
@ -13,7 +14,7 @@ import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:appflowy/workspace/application/view/view_ext.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
||||
@ -128,8 +129,8 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
|
||||
width: 24,
|
||||
height: 24,
|
||||
iconPadding: const EdgeInsets.all(3),
|
||||
icon: svgWidget(
|
||||
'common/information',
|
||||
icon: FlowySvg(
|
||||
FlowySvgs.information_s,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
),
|
||||
@ -145,8 +146,8 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
|
||||
width: 24,
|
||||
height: 24,
|
||||
iconPadding: const EdgeInsets.all(3),
|
||||
icon: svgWidget(
|
||||
'common/settings',
|
||||
icon: FlowySvg(
|
||||
FlowySvgs.settings_s,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
onPressed: () => controller.show(),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/base/insert_page_command.dart';
|
||||
import 'package:appflowy/workspace/application/view/view_ext.dart';
|
||||
import 'package:appflowy/workspace/application/view/view_service.dart';
|
||||
@ -5,7 +6,6 @@ import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra_ui/widget/error_page.dart';
|
||||
@ -208,8 +208,8 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
children.add(
|
||||
FlowyButton(
|
||||
isSelected: index == _selectedIndex,
|
||||
leftIcon: svgWidget(
|
||||
view.iconName,
|
||||
leftIcon: FlowySvg(
|
||||
view.iconData,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
text: FlowyText.regular(view.name),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -48,7 +48,7 @@ class SelectableItem extends StatelessWidget {
|
||||
height: 32,
|
||||
child: FlowyButton(
|
||||
text: FlowyText.medium(item),
|
||||
rightIcon: isSelected ? const FlowySvg(name: 'grid/checkmark') : null,
|
||||
rightIcon: isSelected ? const FlowySvg(FlowySvgs.check_s) : null,
|
||||
onTap: onTap,
|
||||
),
|
||||
);
|
||||
|
@ -1,23 +1,24 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SelectableSvgWidget extends StatelessWidget {
|
||||
const SelectableSvgWidget({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.data,
|
||||
required this.isSelected,
|
||||
required this.style,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final FlowySvgData data;
|
||||
final bool isSelected;
|
||||
final SelectionMenuStyle style;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return svgWidget(
|
||||
name,
|
||||
return FlowySvg(
|
||||
data,
|
||||
size: const Size.square(18.0),
|
||||
color: isSelected
|
||||
? style.selectionMenuItemSelectedIconColor
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/application/doc_bloc.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/base/insert_page_command.dart';
|
||||
@ -11,7 +12,7 @@ SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
|
||||
SelectionMenuItem(
|
||||
name: LocaleKeys.document_slashMenu_grid_createANewGrid.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/grid',
|
||||
data: FlowySvgs.grid_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
@ -36,7 +37,7 @@ SelectionMenuItem inlineBoardMenuItem(DocumentBloc documentBloc) =>
|
||||
SelectionMenuItem(
|
||||
name: LocaleKeys.document_slashMenu_board_createANewBoard.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/board',
|
||||
data: FlowySvgs.board_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
@ -60,7 +61,7 @@ SelectionMenuItem inlineCalendarMenuItem(DocumentBloc documentBloc) =>
|
||||
SelectionMenuItem(
|
||||
name: LocaleKeys.document_slashMenu_calendar_createANewCalendar.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/calendar',
|
||||
data: FlowySvgs.date_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/base/selectable_svg_widget.dart';
|
||||
@ -9,7 +10,7 @@ import 'package:flutter/material.dart';
|
||||
SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
|
||||
name: LocaleKeys.document_plugins_referencedGrid.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/grid',
|
||||
data: FlowySvgs.grid_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
@ -28,7 +29,7 @@ SelectionMenuItem referencedGridMenuItem = SelectionMenuItem(
|
||||
SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
|
||||
name: LocaleKeys.document_plugins_referencedBoard.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/board',
|
||||
data: FlowySvgs.board_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
@ -47,7 +48,7 @@ SelectionMenuItem referencedBoardMenuItem = SelectionMenuItem(
|
||||
SelectionMenuItem referencedCalendarMenuItem = SelectionMenuItem(
|
||||
name: LocaleKeys.document_plugins_referencedCalendar.tr(),
|
||||
icon: (editorState, onSelected, style) => SelectableSvgWidget(
|
||||
name: 'editor/calendar',
|
||||
data: FlowySvgs.date_s,
|
||||
isSelected: onSelected,
|
||||
style: style,
|
||||
),
|
||||
|
@ -1,11 +1,12 @@
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra/theme_extension.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
@ -445,8 +446,8 @@ class _ImageGridItemState extends State<ImageGridItem> {
|
||||
Theme.of(context).colorScheme.surface.withOpacity(0.8),
|
||||
iconPadding: const EdgeInsets.all(5),
|
||||
width: 28,
|
||||
icon: svgWidget(
|
||||
'editor/delete',
|
||||
icon: FlowySvg(
|
||||
FlowySvgs.delete_s,
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
onPressed: widget.onImageDelete,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@ -6,7 +7,6 @@ import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
|
||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
@ -219,7 +219,7 @@ class _CoverImagePreviewWidgetState extends State<CoverImagePreviewWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const FlowySvg(
|
||||
name: 'editor/add',
|
||||
FlowySvgs.add_s,
|
||||
size: Size(20, 20),
|
||||
),
|
||||
const SizedBox(
|
||||
@ -243,7 +243,7 @@ class _CoverImagePreviewWidgetState extends State<CoverImagePreviewWidget> {
|
||||
},
|
||||
useIntrinsicWidth: true,
|
||||
leftIcon: const FlowySvg(
|
||||
name: 'file_icon',
|
||||
FlowySvgs.page_s,
|
||||
size: Size(20, 20),
|
||||
),
|
||||
text: FlowyText(
|
||||
@ -268,9 +268,9 @@ class _CoverImagePreviewWidgetState extends State<CoverImagePreviewWidget> {
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
child: svgWidget(
|
||||
"editor/close",
|
||||
size: const Size(20, 20),
|
||||
child: const FlowySvg(
|
||||
FlowySvgs.close_s,
|
||||
size: Size(20, 20),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -1,11 +1,12 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/emoji_picker/emoji_picker.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/rounded_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -227,7 +228,7 @@ class _DocumentHeaderToolbarState extends State<DocumentHeaderToolbar> {
|
||||
cover: (CoverType.asset, builtInAssetImages.first),
|
||||
),
|
||||
useIntrinsicWidth: true,
|
||||
leftIcon: const FlowySvg(name: 'editor/image'),
|
||||
leftIcon: const FlowySvg(FlowySvgs.image_s),
|
||||
text: FlowyText.regular(
|
||||
LocaleKeys.document_plugins_cover_addCover.tr(),
|
||||
),
|
||||
@ -434,8 +435,8 @@ class DeleteCoverButton extends StatelessWidget {
|
||||
fillColor: Theme.of(context).colorScheme.surface.withOpacity(0.5),
|
||||
iconPadding: const EdgeInsets.all(5),
|
||||
width: 28,
|
||||
icon: svgWidget(
|
||||
'editor/delete',
|
||||
icon: FlowySvg(
|
||||
FlowySvgs.delete_s,
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
onPressed: onTap,
|
||||
|
@ -1,10 +1,11 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/emoji_picker/emoji_picker.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EmojiPopover extends StatefulWidget {
|
||||
@ -77,7 +78,7 @@ class DeleteButton extends StatelessWidget {
|
||||
text: FlowyText(
|
||||
LocaleKeys.document_plugins_cover_removeIcon.tr(),
|
||||
),
|
||||
leftIcon: const FlowySvg(name: 'editor/delete'),
|
||||
leftIcon: const FlowySvg(FlowySvgs.delete_s),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -97,7 +98,7 @@ class _ImageCopyLinkButton extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: const FlowySvg(
|
||||
name: 'editor/copy',
|
||||
FlowySvgs.copy_s,
|
||||
size: Size.square(16),
|
||||
),
|
||||
);
|
||||
@ -190,9 +191,21 @@ class _ImageAlignButtonState extends State<_ImageAlignButton> {
|
||||
);
|
||||
}
|
||||
|
||||
FlowySvgData iconFor(String alignment) {
|
||||
switch (alignment) {
|
||||
case 'right':
|
||||
return FlowySvgs.align_right_s;
|
||||
case 'center':
|
||||
return FlowySvgs.align_center_s;
|
||||
case 'left':
|
||||
default:
|
||||
return FlowySvgs.align_left_s;
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildAlignIcon() {
|
||||
return FlowySvg(
|
||||
name: 'editor/align/$align',
|
||||
iconFor(align),
|
||||
size: const Size.square(16),
|
||||
);
|
||||
}
|
||||
@ -214,17 +227,17 @@ class _AlignButtons extends StatelessWidget {
|
||||
children: [
|
||||
const HSpace(4),
|
||||
_AlignButton(
|
||||
align: 'left',
|
||||
icon: FlowySvgs.align_left_s,
|
||||
onTap: () => onAlignChanged('left'),
|
||||
),
|
||||
const _Divider(),
|
||||
_AlignButton(
|
||||
align: 'left',
|
||||
icon: FlowySvgs.align_center_s,
|
||||
onTap: () => onAlignChanged('center'),
|
||||
),
|
||||
const _Divider(),
|
||||
_AlignButton(
|
||||
align: 'left',
|
||||
icon: FlowySvgs.align_right_s,
|
||||
onTap: () => onAlignChanged('right'),
|
||||
),
|
||||
const HSpace(4),
|
||||
@ -236,11 +249,11 @@ class _AlignButtons extends StatelessWidget {
|
||||
|
||||
class _AlignButton extends StatelessWidget {
|
||||
const _AlignButton({
|
||||
required this.align,
|
||||
required this.icon,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String align;
|
||||
final FlowySvgData icon;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
@ -248,7 +261,7 @@ class _AlignButton extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: FlowySvg(
|
||||
name: 'editor/align/$align',
|
||||
icon,
|
||||
size: const Size.square(16),
|
||||
),
|
||||
);
|
||||
@ -267,7 +280,7 @@ class _ImageDeleteButton extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: const FlowySvg(
|
||||
name: 'editor/delete',
|
||||
FlowySvgs.delete_s,
|
||||
size: Size.square(16),
|
||||
),
|
||||
);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class Svg extends StatelessWidget {
|
||||
const Svg({
|
||||
|
@ -1,8 +1,9 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
final ToolbarItem inlineMathEquationItem = ToolbarItem(
|
||||
@ -18,8 +19,8 @@ final ToolbarItem inlineMathEquationItem = ToolbarItem(
|
||||
);
|
||||
});
|
||||
return SVGIconItemWidget(
|
||||
iconBuilder: (_) => svgWidget(
|
||||
'editor/math',
|
||||
iconBuilder: (_) => FlowySvg(
|
||||
FlowySvgs.math_lg,
|
||||
size: const Size.square(16),
|
||||
color: isHighlight ? highlightColor : Colors.white,
|
||||
),
|
||||
|
@ -107,7 +107,7 @@ class InlinePageReferenceService {
|
||||
for (final view in views) {
|
||||
final SelectionMenuItem pageSelectionMenuItem = SelectionMenuItem(
|
||||
icon: (editorState, isSelected, style) => SelectableSvgWidget(
|
||||
name: view.iconName,
|
||||
data: view.iconData,
|
||||
isSelected: isSelected,
|
||||
style: style,
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/plugins/trash/application/trash_service.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
@ -9,7 +10,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart'
|
||||
show EditorState, SelectionUpdateReason;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -83,7 +83,7 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
|
||||
children: [
|
||||
const HSpace(4),
|
||||
FlowySvg(
|
||||
name: view.layout.iconName,
|
||||
view.layout.icon,
|
||||
size: const Size.square(18.0),
|
||||
),
|
||||
const HSpace(2),
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/font_size_switcher.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -29,8 +29,8 @@ class DocumentMoreButton extends StatelessWidget {
|
||||
),
|
||||
];
|
||||
},
|
||||
child: svgWidget(
|
||||
'editor/details',
|
||||
child: FlowySvg(
|
||||
FlowySvgs.details_s,
|
||||
size: const Size(18, 18),
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
|
Reference in New Issue
Block a user