From 0ed422da41051a8de98b209566713d2eab578379 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 13 Feb 2026 13:03:29 +0900 Subject: [PATCH] make profile name selectable --- .../flare/ui/component/CommonProfileHeader.kt | 31 ++++++++++--------- .../UI/Component/CommonProfileHeader.swift | 2 ++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/CommonProfileHeader.kt b/compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/CommonProfileHeader.kt index 92bb4a3e5..6ae7c8bdc 100644 --- a/compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/CommonProfileHeader.kt +++ b/compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/CommonProfileHeader.kt @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBars +import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -172,32 +173,34 @@ internal fun CommonProfileHeader( }.padding(horizontal = screenHorizontalPadding, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) { - Column { - RichText( - text = displayName, - textStyle = PlatformTheme.typography.title, + SelectionContainer { + Column { + RichText( + text = displayName, + textStyle = PlatformTheme.typography.title, // modifier = // Modifier // .sharedElement( // rememberSharedContentState(key = "profile-display-name-$userKey"), // animatedVisibilityScope = this@AnimatedVisibilityScope, // ), - ) - Row( - horizontalArrangement = Arrangement.spacedBy(4.dp), - verticalAlignment = Alignment.CenterVertically, - ) { - PlatformText( - text = handle, - style = PlatformTheme.typography.caption, + ) + Row( + horizontalArrangement = Arrangement.spacedBy(4.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + PlatformText( + text = handle, + style = PlatformTheme.typography.caption, // modifier = // Modifier // .sharedElement( // rememberSharedContentState(key = "profile-handle-$userKey"), // animatedVisibilityScope = this@AnimatedVisibilityScope, // ), - ) - handleTrailing.invoke(this) + ) + handleTrailing.invoke(this) + } } } content() diff --git a/iosApp/flare/UI/Component/CommonProfileHeader.swift b/iosApp/flare/UI/Component/CommonProfileHeader.swift index d0dc31b05..eb37856c1 100644 --- a/iosApp/flare/UI/Component/CommonProfileHeader.swift +++ b/iosApp/flare/UI/Component/CommonProfileHeader.swift @@ -108,10 +108,12 @@ struct CommonProfileHeader: View { RichText(text: user.name) .font(.headline) .frame(maxWidth: .infinity, alignment: .leading) + .textSelection(.enabled) HStack { Text(user.handle) .font(.subheadline) .foregroundColor(.gray) + .textSelection(.enabled) ForEach(0..