mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-01 10:33:29 +00:00
fix: flowy hover isselected check (#6223)
This commit is contained in:
parent
91173f707e
commit
2b9b8c19a9
@ -1,4 +1,3 @@
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
@ -17,6 +16,7 @@ import 'package:appflowy/plugins/database/widgets/row/row_action.dart';
|
||||
import 'package:appflowy/workspace/presentation/settings/widgets/emoji_picker/emoji_picker.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
const _kBannerActionHeight = 40.0;
|
||||
@ -273,7 +273,7 @@ class RowActionButton extends StatelessWidget {
|
||||
width: 20,
|
||||
height: 20,
|
||||
icon: const FlowySvg(FlowySvgs.details_horizontal_s),
|
||||
iconColorOnHover: Theme.of(context).colorScheme.onSecondary,
|
||||
iconColorOnHover: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart' hide Icon;
|
||||
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/shared/icon_emoji_picker/icon.dart';
|
||||
import 'package:appflowy/workspace/application/sidebar/space/space_bloc.dart';
|
||||
@ -14,7 +16,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flutter/material.dart' hide Icon;
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class SidebarSpaceHeader extends StatefulWidget {
|
||||
@ -63,6 +64,7 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
|
||||
.read<SpaceBloc>()
|
||||
.add(SpaceEvent.expand(widget.space, !widget.isExpanded)),
|
||||
child: FlowyHoverContainer(
|
||||
isHovering: isHovered,
|
||||
style: style,
|
||||
child: _buildSpaceName(),
|
||||
),
|
||||
|
||||
@ -61,9 +61,9 @@ class _FlowyHoverState extends State<FlowyHover> {
|
||||
onEnter: (_) => _setOnHover(true),
|
||||
onExit: (_) => _setOnHover(false),
|
||||
child: FlowyHoverContainer(
|
||||
isHovering: _onHover || (widget.isSelected?.call() ?? false),
|
||||
style: widget.style ??
|
||||
HoverStyle(hoverColor: Theme.of(context).colorScheme.secondary),
|
||||
applyStyle: _onHover,
|
||||
child: widget.child ?? widget.builder!(context, _onHover),
|
||||
),
|
||||
);
|
||||
@ -113,17 +113,27 @@ class HoverStyle {
|
||||
class FlowyHoverContainer extends StatelessWidget {
|
||||
final HoverStyle style;
|
||||
final Widget child;
|
||||
final bool applyStyle;
|
||||
final bool isHovering;
|
||||
|
||||
const FlowyHoverContainer({
|
||||
super.key,
|
||||
required this.child,
|
||||
required this.style,
|
||||
this.applyStyle = false,
|
||||
required this.isHovering,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!isHovering) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: style.backgroundColor,
|
||||
borderRadius: style.borderRadius,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
final hoverBorder = Border.all(
|
||||
color: style.borderColor,
|
||||
width: style.borderWidth,
|
||||
@ -148,9 +158,7 @@ class FlowyHoverContainer extends StatelessWidget {
|
||||
margin: style.contentMargin,
|
||||
decoration: BoxDecoration(
|
||||
border: hoverBorder,
|
||||
color: applyStyle
|
||||
? style.hoverColor ?? Theme.of(context).colorScheme.secondary
|
||||
: style.backgroundColor,
|
||||
color: style.hoverColor ?? Theme.of(context).colorScheme.secondary,
|
||||
borderRadius: style.borderRadius,
|
||||
),
|
||||
child: Theme(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user