refactor: new close button like ios(but not liquid glass)

This commit is contained in:
yet300
2025-09-30 12:52:56 +04:00
parent 6cccaaed5b
commit 696f698046
2 changed files with 30 additions and 20 deletions
@@ -9,6 +9,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Bluetooth import androidx.compose.material.icons.filled.Bluetooth
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Lock import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.filled.Public import androidx.compose.material.icons.filled.Public
import androidx.compose.material.icons.filled.Security import androidx.compose.material.icons.filled.Security
@@ -550,24 +551,39 @@ fun AboutSheet(
.height(64.dp) .height(64.dp)
.background(MaterialTheme.colorScheme.background.copy(alpha = topBarAlpha)) .background(MaterialTheme.colorScheme.background.copy(alpha = topBarAlpha))
) { ) {
TextButton( CloseButton(
onClick = onDismiss, onClick = onDismiss,
modifier = Modifier modifier = modifier
.align(Alignment.CenterEnd) .align(Alignment.CenterEnd)
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp),
) {
Text(
text = "Close",
style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Bold),
color = MaterialTheme.colorScheme.onBackground
) )
} }
} }
} }
} }
}
} }
@Composable
fun CloseButton(
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
IconButton(
onClick = onClick,
modifier = modifier
.size(32.dp),
colors = IconButtonDefaults.iconButtonColors(
contentColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f),
containerColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.1f)
)
) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = "Close",
modifier = Modifier.size(18.dp)
)
}
}
/** /**
* Password prompt dialog for password-protected channels * Password prompt dialog for password-protected channels
* Kept as dialog since it requires user input * Kept as dialog since it requires user input
@@ -551,22 +551,16 @@ fun LocationChannelsSheet(
.height(56.dp) .height(56.dp)
.background(MaterialTheme.colorScheme.background.copy(alpha = topBarAlpha)) .background(MaterialTheme.colorScheme.background.copy(alpha = topBarAlpha))
) { ) {
TextButton( CloseButton(
onClick = onDismiss, onClick = onDismiss,
modifier = Modifier modifier = modifier
.align(Alignment.CenterEnd) .align(Alignment.CenterEnd)
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp),
) {
Text(
text = "Close",
style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Bold),
color = MaterialTheme.colorScheme.onBackground
) )
} }
} }
} }
} }
}
// Lifecycle management: when presented, sample both nearby and bookmarked geohashes // Lifecycle management: when presented, sample both nearby and bookmarked geohashes
LaunchedEffect(isPresented, availableChannels, bookmarks) { LaunchedEffect(isPresented, availableChannels, bookmarks) {