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

View File

@ -220,10 +220,10 @@ class _Title extends StatelessWidget {
child: FlowyIconButton( child: FlowyIconButton(
onPressed: onPressedAddButton, onPressed: onPressedAddButton,
width: 18, width: 18,
icon: FlowySvg( icon: const FlowySvg(
FlowySvgs.add_s, 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: [ children: [
if (widget.isSelected) if (widget.isSelected)
const Padding( Padding(
padding: EdgeInsets.only(left: 6), padding: const EdgeInsets.only(left: 6),
child: FlowySvg(FlowySvgs.check_s), child: FlowySvg(
FlowySvgs.check_s,
color: Theme.of(context).iconTheme.color,
),
), ),
FlowyIconButton( FlowyIconButton(
onPressed: () => _popoverController.show(), onPressed: () => _popoverController.show(),
hoverColor: Colors.transparent,
iconPadding: const EdgeInsets.symmetric(horizontal: 6.0), 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( icon: FlowySvg(
FlowySvgs.details_s, FlowySvgs.details_s,
color: Theme.of(context).iconTheme.color, color: Theme.of(context).iconTheme.color,

View File

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

View File

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

View File

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