mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: fix icon hover color in dark mode (#2356)
* fix: File and Trash icons brightness in dark mode. Fixes: #2298 * chore: update hover color in file location * feat: add foregroundColorOnHover in HoverStyle * feat: add iconColorOnHover in FlowyIconButton * chore: update trash page UI --------- Co-authored-by: Akarsh Jain <akarsh.jain.790@gmail.com>
This commit is contained in:
@ -4,10 +4,14 @@ class TrashSizes {
|
|||||||
static double get fileNameWidth => 320 * scale;
|
static double get fileNameWidth => 320 * scale;
|
||||||
static double get lashModifyWidth => 230 * scale;
|
static double get lashModifyWidth => 230 * scale;
|
||||||
static double get createTimeWidth => 230 * scale;
|
static double get createTimeWidth => 230 * scale;
|
||||||
static double get padding => 100 * scale;
|
// padding between createTime and action icon
|
||||||
|
static double get padding => 40 * scale;
|
||||||
|
static double get actionIconWidth => 40 * scale;
|
||||||
static double get totalWidth =>
|
static double get totalWidth =>
|
||||||
TrashSizes.fileNameWidth +
|
TrashSizes.fileNameWidth +
|
||||||
TrashSizes.lashModifyWidth +
|
TrashSizes.lashModifyWidth +
|
||||||
TrashSizes.createTimeWidth +
|
TrashSizes.createTimeWidth +
|
||||||
TrashSizes.padding;
|
TrashSizes.padding +
|
||||||
|
// restore and delete icon
|
||||||
|
2 * TrashSizes.actionIconWidth;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import 'package:flowy_infra/image.dart';
|
import 'package:flowy_infra/image.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
||||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
||||||
import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
|
import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@ -38,23 +36,19 @@ class TrashCell extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
FlowyIconButton(
|
FlowyIconButton(
|
||||||
width: 26,
|
iconColorOnHover: Theme.of(context).colorScheme.onSurface,
|
||||||
|
width: TrashSizes.actionIconWidth,
|
||||||
onPressed: onRestore,
|
onPressed: onRestore,
|
||||||
iconPadding: const EdgeInsets.all(5),
|
iconPadding: const EdgeInsets.all(5),
|
||||||
icon: svgWidget(
|
icon: const FlowySvg(name: 'editor/restore'),
|
||||||
"editor/restore",
|
|
||||||
color: Theme.of(context).iconTheme.color,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const HSpace(20),
|
const HSpace(20),
|
||||||
FlowyIconButton(
|
FlowyIconButton(
|
||||||
width: 26,
|
iconColorOnHover: Theme.of(context).colorScheme.onSurface,
|
||||||
|
width: TrashSizes.actionIconWidth,
|
||||||
onPressed: onDelete,
|
onPressed: onDelete,
|
||||||
iconPadding: const EdgeInsets.all(5),
|
iconPadding: const EdgeInsets.all(5),
|
||||||
icon: svgWidget(
|
icon: const FlowySvg(name: 'editor/delete'),
|
||||||
"editor/delete",
|
|
||||||
color: Theme.of(context).iconTheme.color,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -96,10 +96,7 @@ class _TrashPageState extends State<TrashPage> {
|
|||||||
IntrinsicWidth(
|
IntrinsicWidth(
|
||||||
child: FlowyButton(
|
child: FlowyButton(
|
||||||
text: FlowyText.medium(LocaleKeys.trash_restoreAll.tr()),
|
text: FlowyText.medium(LocaleKeys.trash_restoreAll.tr()),
|
||||||
leftIcon: svgWidget(
|
leftIcon: const FlowySvg(name: 'editor/restore'),
|
||||||
'editor/restore',
|
|
||||||
color: Theme.of(context).iconTheme.color,
|
|
||||||
),
|
|
||||||
onTap: () => context.read<TrashBloc>().add(
|
onTap: () => context.read<TrashBloc>().add(
|
||||||
const TrashEvent.restoreAll(),
|
const TrashEvent.restoreAll(),
|
||||||
),
|
),
|
||||||
@ -109,10 +106,7 @@ class _TrashPageState extends State<TrashPage> {
|
|||||||
IntrinsicWidth(
|
IntrinsicWidth(
|
||||||
child: FlowyButton(
|
child: FlowyButton(
|
||||||
text: FlowyText.medium(LocaleKeys.trash_deleteAll.tr()),
|
text: FlowyText.medium(LocaleKeys.trash_deleteAll.tr()),
|
||||||
leftIcon: svgWidget(
|
leftIcon: const FlowySvg(name: 'editor/delete'),
|
||||||
'editor/delete',
|
|
||||||
color: Theme.of(context).iconTheme.color,
|
|
||||||
),
|
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
context.read<TrashBloc>().add(const TrashEvent.deleteAll()),
|
context.read<TrashBloc>().add(const TrashEvent.deleteAll()),
|
||||||
),
|
),
|
||||||
|
@ -74,7 +74,11 @@ class SettingsFileLocationCustomzierState
|
|||||||
Tooltip(
|
Tooltip(
|
||||||
message: LocaleKeys.settings_files_restoreLocation.tr(),
|
message: LocaleKeys.settings_files_restoreLocation.tr(),
|
||||||
child: FlowyIconButton(
|
child: FlowyIconButton(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
icon: const Icon(Icons.restore_outlined),
|
icon: const Icon(Icons.restore_outlined),
|
||||||
|
hoverColor:
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result = await appFlowyDocumentDirectory();
|
final result = await appFlowyDocumentDirectory();
|
||||||
await _setCustomLocation(result.path);
|
await _setCustomLocation(result.path);
|
||||||
@ -96,7 +100,11 @@ class SettingsFileLocationCustomzierState
|
|||||||
Tooltip(
|
Tooltip(
|
||||||
message: LocaleKeys.settings_files_customizeLocation.tr(),
|
message: LocaleKeys.settings_files_customizeLocation.tr(),
|
||||||
child: FlowyIconButton(
|
child: FlowyIconButton(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
icon: const Icon(Icons.folder_open_outlined),
|
icon: const Icon(Icons.folder_open_outlined),
|
||||||
|
hoverColor:
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result =
|
final result =
|
||||||
await getIt<FilePickerService>().getDirectoryPath();
|
await getIt<FilePickerService>().getDirectoryPath();
|
||||||
|
@ -99,6 +99,7 @@ class HoverStyle {
|
|||||||
final Color borderColor;
|
final Color borderColor;
|
||||||
final double borderWidth;
|
final double borderWidth;
|
||||||
final Color? hoverColor;
|
final Color? hoverColor;
|
||||||
|
final Color? foregroundColorOnHover;
|
||||||
final BorderRadius borderRadius;
|
final BorderRadius borderRadius;
|
||||||
final EdgeInsets contentMargin;
|
final EdgeInsets contentMargin;
|
||||||
final Color backgroundColor;
|
final Color backgroundColor;
|
||||||
@ -110,6 +111,7 @@ class HoverStyle {
|
|||||||
this.contentMargin = EdgeInsets.zero,
|
this.contentMargin = EdgeInsets.zero,
|
||||||
this.backgroundColor = Colors.transparent,
|
this.backgroundColor = Colors.transparent,
|
||||||
this.hoverColor,
|
this.hoverColor,
|
||||||
|
this.foregroundColorOnHover,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,18 +140,17 @@ class FlowyHoverContainer extends StatelessWidget {
|
|||||||
borderRadius: style.borderRadius,
|
borderRadius: style.borderRadius,
|
||||||
),
|
),
|
||||||
child:
|
child:
|
||||||
//override text's theme with new color when it is hovered
|
//override text's theme with foregroundColorOnHover when it is hovered
|
||||||
Theme(
|
Theme(
|
||||||
data: Theme.of(context).copyWith(
|
data: Theme.of(context).copyWith(
|
||||||
textTheme: Theme.of(context).textTheme.copyWith(
|
textTheme: Theme.of(context).textTheme.copyWith(
|
||||||
bodyMedium: Theme.of(context)
|
bodyMedium: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
.textTheme
|
color: style.foregroundColorOnHover ??
|
||||||
.bodyMedium
|
Theme.of(context).colorScheme.onSurface),
|
||||||
?.copyWith(color: Theme.of(context).colorScheme.onSurface),
|
|
||||||
),
|
),
|
||||||
iconTheme: Theme.of(context)
|
iconTheme: Theme.of(context).iconTheme.copyWith(
|
||||||
.iconTheme
|
color: style.foregroundColorOnHover ??
|
||||||
.copyWith(color: Theme.of(context).colorScheme.onSurface),
|
Theme.of(context).colorScheme.onSurface),
|
||||||
),
|
),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:flowy_infra/image.dart';
|
import 'package:flowy_infra/image.dart';
|
||||||
import 'package:flowy_infra/size.dart';
|
import 'package:flowy_infra/size.dart';
|
||||||
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class FlowyIconButton extends StatelessWidget {
|
class FlowyIconButton extends StatelessWidget {
|
||||||
@ -11,6 +12,7 @@ class FlowyIconButton extends StatelessWidget {
|
|||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final Color? fillColor;
|
final Color? fillColor;
|
||||||
final Color? hoverColor;
|
final Color? hoverColor;
|
||||||
|
final Color? iconColorOnHover;
|
||||||
final EdgeInsets iconPadding;
|
final EdgeInsets iconPadding;
|
||||||
final BorderRadius? radius;
|
final BorderRadius? radius;
|
||||||
final String? tooltipText;
|
final String? tooltipText;
|
||||||
@ -23,6 +25,7 @@ class FlowyIconButton extends StatelessWidget {
|
|||||||
this.onPressed,
|
this.onPressed,
|
||||||
this.fillColor = Colors.transparent,
|
this.fillColor = Colors.transparent,
|
||||||
this.hoverColor,
|
this.hoverColor,
|
||||||
|
this.iconColorOnHover,
|
||||||
this.iconPadding = EdgeInsets.zero,
|
this.iconPadding = EdgeInsets.zero,
|
||||||
this.radius,
|
this.radius,
|
||||||
this.tooltipText,
|
this.tooltipText,
|
||||||
@ -62,12 +65,20 @@ class FlowyIconButton extends StatelessWidget {
|
|||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
|
child: FlowyHover(
|
||||||
|
style: HoverStyle(
|
||||||
|
hoverColor: hoverColor,
|
||||||
|
foregroundColorOnHover:
|
||||||
|
iconColorOnHover ?? Theme.of(context).iconTheme.color,
|
||||||
|
backgroundColor: fillColor ?? Colors.transparent,
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: iconPadding,
|
padding: iconPadding,
|
||||||
child: SizedBox.fromSize(size: childSize, child: child),
|
child: SizedBox.fromSize(size: childSize, child: child),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user