Skip to content

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.

fix: svg sizes (#3238)

Alex Wallenc5719be7ae32
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/color_scheme.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/color_scheme.dart
index 6b8db66cb4..71a825c40f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/color_scheme.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/color_scheme.dart
@@ -31,7 +31,6 @@ class ColorSchemeSetting extends StatelessWidget {
onResetRequested: context.read<AppearanceSettingsCubit>().resetTheme,
trailing: [
ColorSchemeUploadOverlayButton(bloc: bloc),
- const SizedBox(width: 4),
ColorSchemeUploadPopover(currentTheme: currentTheme, bloc: bloc),
],
);
@@ -49,6 +48,7 @@ class ColorSchemeUploadOverlayButton extends StatelessWidget {
width: 24,
icon: const FlowySvg(
FlowySvgs.folder_m,
+ size: Size.square(16),
),
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
onPressed: () => Dialogs.show(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/theme_setting_entry_template.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/theme_setting_entry_template.dart
index 1ce6bb8b3e..4f532c2cd3 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/theme_setting_entry_template.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/theme_setting_entry_template.dart
@@ -36,7 +36,7 @@ class ThemeSettingEntryTemplateWidget extends StatelessWidget {
key: resetButtonKey,
width: 24,
icon: FlowySvg(
- FlowySvgs.reload_s,
+ FlowySvgs.restore_s,
color: Theme.of(context).iconTheme.color,
),
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart
index 585daa01ac..2892a6eaea 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart
@@ -236,9 +236,9 @@ class _RecoverDefaultStorageButtonState
return FlowyIconButton(
hoverColor: Theme.of(context).colorScheme.secondaryContainer,
tooltipText: LocaleKeys.settings_files_recoverLocationTooltips.tr(),
- icon: FlowySvg(
+ icon: const FlowySvg(
FlowySvgs.restore_s,
- color: Theme.of(context).iconTheme.color,
+ size: Size.square(24),
),
onPressed: () async {
// reset to the default directory and reload app
diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/icon_button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/icon_button.dart
index 46d4ac9c53..f2af716d43 100644
--- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/icon_button.dart
+++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/icon_button.dart
@@ -1,4 +1,3 @@
-import 'dart:math';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_svg/flowy_svg.dart';
@@ -48,10 +47,6 @@ class FlowyIconButton extends StatelessWidget {
assert(size.width > iconPadding.horizontal);
assert(size.height > iconPadding.vertical);
- final childWidth = min(size.width - iconPadding.horizontal,
- size.height - iconPadding.vertical);
- final childSize = Size(childWidth, childWidth);
-
return ConstrainedBox(
constraints: BoxConstraints.tightFor(
width: size.width,
@@ -85,7 +80,9 @@ class FlowyIconButton extends StatelessWidget {
),
child: Padding(
padding: iconPadding,
- child: SizedBox.fromSize(size: childSize, child: child),
+ child: Center(
+ child: child,
+ ),
),
),
),
diff --git a/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart b/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart
index 630ce77e8f..03e016e31f 100644
--- a/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart
+++ b/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart
@@ -50,25 +50,17 @@ class FlowySvg extends StatelessWidget {
Widget build(BuildContext context) {
final iconColor = color ?? Theme.of(context).iconTheme.color;
- final child = SvgPicture.asset(
+ return SvgPicture.asset(
_normalized(),
- colorFilter:
- iconColor != null && blendMode != null
+ width: size?.width,
+ height: size?.height,
+ colorFilter: iconColor != null && blendMode != null
? ColorFilter.mode(
iconColor,
blendMode!,
)
: null,
);
-
- if (size != null) {
- return SizedBox.fromSize(
- size: size,
- child: child,
- );
- }
-
- return child;
}
/// If the SVG's path does not start with `assets/`, it is