mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-04 20:13:59 +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/material.dart';
|
||||||
import 'package:flutter/services.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/workspace/presentation/settings/widgets/emoji_picker/emoji_picker.dart';
|
||||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
const _kBannerActionHeight = 40.0;
|
const _kBannerActionHeight = 40.0;
|
||||||
@ -273,7 +273,7 @@ class RowActionButton extends StatelessWidget {
|
|||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
icon: const FlowySvg(FlowySvgs.details_horizontal_s),
|
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 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart' hide Icon;
|
||||||
|
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/shared/icon_emoji_picker/icon.dart';
|
import 'package:appflowy/shared/icon_emoji_picker/icon.dart';
|
||||||
import 'package:appflowy/workspace/application/sidebar/space/space_bloc.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:easy_localization/easy_localization.dart';
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||||
import 'package:flutter/material.dart' hide Icon;
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
class SidebarSpaceHeader extends StatefulWidget {
|
class SidebarSpaceHeader extends StatefulWidget {
|
||||||
@ -63,6 +64,7 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
|
|||||||
.read<SpaceBloc>()
|
.read<SpaceBloc>()
|
||||||
.add(SpaceEvent.expand(widget.space, !widget.isExpanded)),
|
.add(SpaceEvent.expand(widget.space, !widget.isExpanded)),
|
||||||
child: FlowyHoverContainer(
|
child: FlowyHoverContainer(
|
||||||
|
isHovering: isHovered,
|
||||||
style: style,
|
style: style,
|
||||||
child: _buildSpaceName(),
|
child: _buildSpaceName(),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -61,9 +61,9 @@ class _FlowyHoverState extends State<FlowyHover> {
|
|||||||
onEnter: (_) => _setOnHover(true),
|
onEnter: (_) => _setOnHover(true),
|
||||||
onExit: (_) => _setOnHover(false),
|
onExit: (_) => _setOnHover(false),
|
||||||
child: FlowyHoverContainer(
|
child: FlowyHoverContainer(
|
||||||
|
isHovering: _onHover || (widget.isSelected?.call() ?? false),
|
||||||
style: widget.style ??
|
style: widget.style ??
|
||||||
HoverStyle(hoverColor: Theme.of(context).colorScheme.secondary),
|
HoverStyle(hoverColor: Theme.of(context).colorScheme.secondary),
|
||||||
applyStyle: _onHover,
|
|
||||||
child: widget.child ?? widget.builder!(context, _onHover),
|
child: widget.child ?? widget.builder!(context, _onHover),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -113,17 +113,27 @@ class HoverStyle {
|
|||||||
class FlowyHoverContainer extends StatelessWidget {
|
class FlowyHoverContainer extends StatelessWidget {
|
||||||
final HoverStyle style;
|
final HoverStyle style;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final bool applyStyle;
|
final bool isHovering;
|
||||||
|
|
||||||
const FlowyHoverContainer({
|
const FlowyHoverContainer({
|
||||||
super.key,
|
super.key,
|
||||||
required this.child,
|
required this.child,
|
||||||
required this.style,
|
required this.style,
|
||||||
this.applyStyle = false,
|
required this.isHovering,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
if (!isHovering) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: style.backgroundColor,
|
||||||
|
borderRadius: style.borderRadius,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
final hoverBorder = Border.all(
|
final hoverBorder = Border.all(
|
||||||
color: style.borderColor,
|
color: style.borderColor,
|
||||||
width: style.borderWidth,
|
width: style.borderWidth,
|
||||||
@ -148,9 +158,7 @@ class FlowyHoverContainer extends StatelessWidget {
|
|||||||
margin: style.contentMargin,
|
margin: style.contentMargin,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: hoverBorder,
|
border: hoverBorder,
|
||||||
color: applyStyle
|
color: style.hoverColor ?? Theme.of(context).colorScheme.secondary,
|
||||||
? style.hoverColor ?? Theme.of(context).colorScheme.secondary
|
|
||||||
: style.backgroundColor,
|
|
||||||
borderRadius: style.borderRadius,
|
borderRadius: style.borderRadius,
|
||||||
),
|
),
|
||||||
child: Theme(
|
child: Theme(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user