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
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
SpaceIcon(
dimension: 20,

View File

@ -53,30 +53,6 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
Widget build(BuildContext context) {
return ValueListenableBuilder(
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) {
final style = HoverStyle(
hoverColor: isHovered
@ -89,13 +65,44 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
.add(SpaceEvent.expand(widget.space, !widget.isExpanded)),
child: FlowyHoverContainer(
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() {
final color = Theme.of(context).isLightMode ? Colors.white : Colors.black;
final textSpan = TextSpan(

View File

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

View File

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