fix: prevent overfow of space name and view name (#5619)

* fix: space name overflow

* fix: space name overflow in space menu

* fix: view name overflow in favorite menu
This commit is contained in:
Lucas.Xu 2024-06-25 17:36:00 +08:00 committed by GitHub
parent a8ed93054c
commit bf2a00b133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 27 deletions

View File

@ -317,6 +317,7 @@ class CurrentSpace extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
SpaceIcon( SpaceIcon(
dimension: 20, dimension: 20,

View File

@ -53,30 +53,6 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ValueListenableBuilder( return ValueListenableBuilder(
valueListenable: isHovered, valueListenable: isHovered,
child: SizedBox(
height: HomeSizes.workspaceSectionHeight,
child: MouseRegion(
onEnter: (_) => isHovered.value = true,
onExit: (_) => isHovered.value = false,
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 3,
top: 3,
bottom: 3,
child: SpacePopup(
child: _buildChild(),
),
),
Positioned(
right: 4,
child: _buildRightIcon(),
),
],
),
),
),
builder: (context, isHovered, child) { builder: (context, isHovered, child) {
final style = HoverStyle( final style = HoverStyle(
hoverColor: isHovered hoverColor: isHovered
@ -89,13 +65,44 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
.add(SpaceEvent.expand(widget.space, !widget.isExpanded)), .add(SpaceEvent.expand(widget.space, !widget.isExpanded)),
child: FlowyHoverContainer( child: FlowyHoverContainer(
style: style, style: style,
child: child!, child: _buildSpaceName(),
), ),
); );
}, },
); );
} }
Widget _buildSpaceName() {
return SizedBox(
height: HomeSizes.workspaceSectionHeight,
child: MouseRegion(
onEnter: (_) => isHovered.value = true,
onExit: (_) => isHovered.value = false,
child: Stack(
alignment: Alignment.center,
children: [
ValueListenableBuilder(
valueListenable: onEditing,
builder: (context, onEditing, child) => Positioned(
left: 3,
top: 3,
bottom: 3,
right: isHovered.value || onEditing ? 66 : 0,
child: SpacePopup(
child: _buildChild(),
),
),
),
Positioned(
right: 4,
child: _buildRightIcon(),
),
],
),
),
);
}
Widget _buildChild() { Widget _buildChild() {
final color = Theme.of(context).isLightMode ? Colors.white : Colors.black; final color = Theme.of(context).isLightMode ? Colors.white : Colors.black;
final textSpan = TextSpan( final textSpan = TextSpan(

View File

@ -63,7 +63,12 @@ class _SidebarSpaceMenuItem extends StatelessWidget {
return FlowyButton( return FlowyButton(
text: Row( text: Row(
children: [ children: [
FlowyText.regular(space.name), Flexible(
child: FlowyText.regular(
space.name,
overflow: TextOverflow.ellipsis,
),
),
const HSpace(6.0), const HSpace(6.0),
if (space.spacePermission == SpacePermission.private) if (space.spacePermission == SpacePermission.private)
FlowyTooltip( FlowyTooltip(

View File

@ -491,7 +491,7 @@ class _SingleInnerViewItemState extends State<SingleInnerViewItem> {
? Expanded( ? Expanded(
child: Row( child: Row(
children: [ children: [
name, Flexible(child: name),
...widget.extendBuilder!(widget.view), ...widget.extendBuilder!(widget.view),
], ],
), ),