mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: svg sizes (#3238)
* refactor: svg impl * fix: icon sizes in appearance settings * chore: change button icon * fix: size of restore button * chore: fix iconbutton api * fix: analyzer issues
This commit is contained in:
parent
de01bf70cd
commit
c5719be7ae
@ -31,7 +31,6 @@ class ColorSchemeSetting extends StatelessWidget {
|
|||||||
onResetRequested: context.read<AppearanceSettingsCubit>().resetTheme,
|
onResetRequested: context.read<AppearanceSettingsCubit>().resetTheme,
|
||||||
trailing: [
|
trailing: [
|
||||||
ColorSchemeUploadOverlayButton(bloc: bloc),
|
ColorSchemeUploadOverlayButton(bloc: bloc),
|
||||||
const SizedBox(width: 4),
|
|
||||||
ColorSchemeUploadPopover(currentTheme: currentTheme, bloc: bloc),
|
ColorSchemeUploadPopover(currentTheme: currentTheme, bloc: bloc),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -49,6 +48,7 @@ class ColorSchemeUploadOverlayButton extends StatelessWidget {
|
|||||||
width: 24,
|
width: 24,
|
||||||
icon: const FlowySvg(
|
icon: const FlowySvg(
|
||||||
FlowySvgs.folder_m,
|
FlowySvgs.folder_m,
|
||||||
|
size: Size.square(16),
|
||||||
),
|
),
|
||||||
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
|
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
|
||||||
onPressed: () => Dialogs.show(
|
onPressed: () => Dialogs.show(
|
||||||
|
@ -36,7 +36,7 @@ class ThemeSettingEntryTemplateWidget extends StatelessWidget {
|
|||||||
key: resetButtonKey,
|
key: resetButtonKey,
|
||||||
width: 24,
|
width: 24,
|
||||||
icon: FlowySvg(
|
icon: FlowySvg(
|
||||||
FlowySvgs.reload_s,
|
FlowySvgs.restore_s,
|
||||||
color: Theme.of(context).iconTheme.color,
|
color: Theme.of(context).iconTheme.color,
|
||||||
),
|
),
|
||||||
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
|
iconColorOnHover: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
@ -236,9 +236,9 @@ class _RecoverDefaultStorageButtonState
|
|||||||
return FlowyIconButton(
|
return FlowyIconButton(
|
||||||
hoverColor: Theme.of(context).colorScheme.secondaryContainer,
|
hoverColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
tooltipText: LocaleKeys.settings_files_recoverLocationTooltips.tr(),
|
tooltipText: LocaleKeys.settings_files_recoverLocationTooltips.tr(),
|
||||||
icon: FlowySvg(
|
icon: const FlowySvg(
|
||||||
FlowySvgs.restore_s,
|
FlowySvgs.restore_s,
|
||||||
color: Theme.of(context).iconTheme.color,
|
size: Size.square(24),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// reset to the default directory and reload app
|
// reset to the default directory and reload app
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
import 'package:flowy_infra/size.dart';
|
import 'package:flowy_infra/size.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||||
import 'package:flowy_svg/flowy_svg.dart';
|
import 'package:flowy_svg/flowy_svg.dart';
|
||||||
@ -48,10 +47,6 @@ class FlowyIconButton extends StatelessWidget {
|
|||||||
assert(size.width > iconPadding.horizontal);
|
assert(size.width > iconPadding.horizontal);
|
||||||
assert(size.height > iconPadding.vertical);
|
assert(size.height > iconPadding.vertical);
|
||||||
|
|
||||||
final childWidth = min(size.width - iconPadding.horizontal,
|
|
||||||
size.height - iconPadding.vertical);
|
|
||||||
final childSize = Size(childWidth, childWidth);
|
|
||||||
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: BoxConstraints.tightFor(
|
||||||
width: size.width,
|
width: size.width,
|
||||||
@ -85,7 +80,9 @@ class FlowyIconButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: iconPadding,
|
padding: iconPadding,
|
||||||
child: SizedBox.fromSize(size: childSize, child: child),
|
child: Center(
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -50,25 +50,17 @@ class FlowySvg extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final iconColor = color ?? Theme.of(context).iconTheme.color;
|
final iconColor = color ?? Theme.of(context).iconTheme.color;
|
||||||
|
|
||||||
final child = SvgPicture.asset(
|
return SvgPicture.asset(
|
||||||
_normalized(),
|
_normalized(),
|
||||||
colorFilter:
|
width: size?.width,
|
||||||
iconColor != null && blendMode != null
|
height: size?.height,
|
||||||
|
colorFilter: iconColor != null && blendMode != null
|
||||||
? ColorFilter.mode(
|
? ColorFilter.mode(
|
||||||
iconColor,
|
iconColor,
|
||||||
blendMode!,
|
blendMode!,
|
||||||
)
|
)
|
||||||
: null,
|
: 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
|
/// If the SVG's path does not start with `assets/`, it is
|
||||||
|
Loading…
Reference in New Issue
Block a user