fix: color issues related to hover effect (#3206)

* fix: fix hover color on information and setting button

* chore: update the hover color of icon in SelectOptionTag

* chore: change hover color for add icon button

* chore: change the SelectOptionTag text color and _SelectOptionCell icon hover color

* fix: change hover color in tab close button #3172

* chore: add spacing in SelectOptionTag

* chore: remove the hover color on close tag icon

* chore: dart fix
This commit is contained in:
Yijing Huang 2023-08-17 08:02:24 -05:00 committed by GitHub
parent 8a277b7380
commit 07cf7287d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 20 deletions

View File

@ -6,6 +6,7 @@ import 'package:flowy_infra/size.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
@ -110,20 +111,20 @@ class SelectOptionTag extends StatelessWidget {
child: FlowyText.medium(
name,
overflow: TextOverflow.ellipsis,
color: Theme.of(context).colorScheme.onSurface,
color: AFThemeExtension.of(context).textColor,
),
),
if (onRemove != null)
if (onRemove != null) ...[
const HSpace(2),
FlowyIconButton(
width: 18.0,
onPressed: () => onRemove?.call(name),
fillColor: Colors.transparent,
hoverColor: Colors.transparent,
icon: FlowySvg(
icon: const FlowySvg(
FlowySvgs.close_s,
color: Theme.of(context).colorScheme.onSurface,
),
),
]
],
),
);

View File

@ -220,10 +220,10 @@ class _Title extends StatelessWidget {
child: FlowyIconButton(
onPressed: onPressedAddButton,
width: 18,
icon: FlowySvg(
icon: const FlowySvg(
FlowySvgs.add_s,
color: Theme.of(context).iconTheme.color,
),
iconColorOnHover: Theme.of(context).colorScheme.onSecondary,
),
),
],
@ -316,14 +316,18 @@ class _SelectOptionCellState extends State<_SelectOptionCell> {
},
children: [
if (widget.isSelected)
const Padding(
padding: EdgeInsets.only(left: 6),
child: FlowySvg(FlowySvgs.check_s),
Padding(
padding: const EdgeInsets.only(left: 6),
child: FlowySvg(
FlowySvgs.check_s,
color: Theme.of(context).iconTheme.color,
),
),
FlowyIconButton(
onPressed: () => _popoverController.show(),
hoverColor: Colors.transparent,
iconPadding: const EdgeInsets.symmetric(horizontal: 6.0),
// If hover color is none, it will use secondary color from the theme, we use [Colors.transparent] to remove the hover color
hoverColor: Colors.transparent,
icon: FlowySvg(
FlowySvgs.details_s,
color: Theme.of(context).iconTheme.color,

View File

@ -129,10 +129,10 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
width: 24,
height: 24,
iconPadding: const EdgeInsets.all(3),
icon: FlowySvg(
icon: const FlowySvg(
FlowySvgs.information_s,
color: Theme.of(context).iconTheme.color,
),
iconColorOnHover: Theme.of(context).colorScheme.onSecondary,
),
// setting
const Space(7, 0),
@ -146,9 +146,9 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
width: 24,
height: 24,
iconPadding: const EdgeInsets.all(3),
icon: FlowySvg(
iconColorOnHover: Theme.of(context).colorScheme.onSecondary,
icon: const FlowySvg(
FlowySvgs.settings_s,
color: Theme.of(context).iconTheme.color,
),
onPressed: () => controller.show(),
),

View File

@ -52,6 +52,9 @@ class _FlowyTabState extends State<FlowyTab> {
visible: _isHovering,
child: FlowyIconButton(
onPressed: _closeTab,
hoverColor: Theme.of(context).hoverColor,
iconColorOnHover:
Theme.of(context).colorScheme.onSurface,
icon: const FlowySvg(
FlowySvgs.close_s,
size: Size.fromWidth(16),

View File

@ -1,6 +1,4 @@
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';
@ -71,7 +69,7 @@ class FlowyIconButton extends StatelessWidget {
shape:
RoundedRectangleBorder(borderRadius: radius ?? Corners.s6Border),
fillColor: fillColor,
hoverColor: hoverColor ?? Theme.of(context).colorScheme.secondary,
hoverColor: hoverColor,
focusColor: Colors.transparent,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
@ -79,10 +77,11 @@ class FlowyIconButton extends StatelessWidget {
onPressed: onPressed,
child: FlowyHover(
style: HoverStyle(
hoverColor: Colors.transparent,
// hoverColor is set in both [HoverStyle] and [RawMaterialButton] to avoid the conflicts between two layers
hoverColor: hoverColor,
foregroundColorOnHover:
iconColorOnHover ?? Theme.of(context).iconTheme.color,
backgroundColor: Colors.transparent,
//Do not set background here. Use [fillColor] instead.
),
child: Padding(
padding: iconPadding,