mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 03:12:15 +00:00
Use Material3 native shapes
This commit is contained in:
parent
93d52af7e7
commit
ce3b419d81
@ -5,7 +5,6 @@ import androidx.compose.animation.animateColorAsState
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Done
|
import androidx.compose.material.icons.filled.Done
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@ -21,7 +20,6 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.looker.droidify.database.entity.Repository
|
import com.looker.droidify.database.entity.Repository
|
||||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@ -40,13 +38,13 @@ fun RepositoryItem(
|
|||||||
modifier = modifier
|
modifier = modifier
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(RoundedCornerShape(LocalShapes.current.large))
|
.clip(MaterialTheme.shapes.large)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = { onClick(repository) },
|
onClick = { onClick(repository) },
|
||||||
onLongClick = { onLongClick(repository) }
|
onLongClick = { onLongClick(repository) }
|
||||||
),
|
),
|
||||||
color = backgroundColor,
|
color = backgroundColor,
|
||||||
shape = RoundedCornerShape(LocalShapes.current.large)
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
|
@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.requiredHeight
|
|||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp
|
|||||||
import com.looker.droidify.database.entity.Repository
|
import com.looker.droidify.database.entity.Repository
|
||||||
import com.looker.droidify.entity.Screenshot
|
import com.looker.droidify.entity.Screenshot
|
||||||
import com.looker.droidify.network.CoilDownloader
|
import com.looker.droidify.network.CoilDownloader
|
||||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
|
||||||
import com.looker.droidify.ui.compose.utils.NetworkImage
|
import com.looker.droidify.ui.compose.utils.NetworkImage
|
||||||
|
|
||||||
data class ScreenshotItem(
|
data class ScreenshotItem(
|
||||||
@ -54,7 +53,7 @@ fun ScreenshotList(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.wrapContentWidth()
|
.wrapContentWidth()
|
||||||
.requiredHeight(300.dp)
|
.requiredHeight(300.dp)
|
||||||
.clip(RoundedCornerShape(LocalShapes.current.large))
|
.clip(MaterialTheme.shapes.large)
|
||||||
.clickable { onScreenShotClick(it.screenShot) },
|
.clickable { onScreenShotClick(it.screenShot) },
|
||||||
data = image
|
data = image
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.looker.droidify.R
|
import com.looker.droidify.R
|
||||||
import com.looker.droidify.ui.compose.components.InstallButton
|
import com.looker.droidify.ui.compose.components.InstallButton
|
||||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
|
||||||
import com.looker.droidify.ui.compose.utils.*
|
import com.looker.droidify.ui.compose.utils.*
|
||||||
import com.looker.droidify.utility.extension.text.formatSize
|
import com.looker.droidify.utility.extension.text.formatSize
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ fun Header(
|
|||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = modifier.fillMaxWidth(),
|
||||||
shape = RoundedCornerShape(LocalShapes.current.large)
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package com.looker.droidify.ui.compose.theme
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
|
||||||
import androidx.compose.runtime.staticCompositionLocalOf
|
|
||||||
import androidx.compose.ui.unit.Dp
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
|
|
||||||
@Immutable
|
|
||||||
data class ShapeSize(
|
|
||||||
val small: Dp = 4.dp,
|
|
||||||
val medium: Dp = 8.dp,
|
|
||||||
val large: Dp = 16.dp,
|
|
||||||
)
|
|
||||||
|
|
||||||
val LocalShapes = staticCompositionLocalOf { ShapeSize() }
|
|
@ -5,7 +5,6 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import com.looker.droidify.utility.isBlackTheme
|
import com.looker.droidify.utility.isBlackTheme
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -14,17 +13,14 @@ fun AppTheme(
|
|||||||
blackTheme: Boolean = isBlackTheme,
|
blackTheme: Boolean = isBlackTheme,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
|
MaterialTheme(
|
||||||
CompositionLocalProvider(LocalShapes provides ShapeSize()) {
|
colorScheme = when {
|
||||||
MaterialTheme(
|
darkTheme && blackTheme -> BlackColors
|
||||||
colorScheme = when {
|
darkTheme -> DarkColors
|
||||||
darkTheme && blackTheme -> BlackColors
|
else -> LightColors
|
||||||
darkTheme -> DarkColors
|
},
|
||||||
else -> LightColors
|
content = content
|
||||||
},
|
)
|
||||||
content = content
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val LightColors = lightColorScheme(
|
private val LightColors = lightColorScheme(
|
||||||
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.combinedClickable
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.shape.CornerBasedShape
|
import androidx.compose.foundation.shape.CornerBasedShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -18,7 +17,6 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@ -26,7 +24,7 @@ fun ExpandableCard(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
preExpanded: Boolean = false,
|
preExpanded: Boolean = false,
|
||||||
backgroundColor: Color = MaterialTheme.colorScheme.background,
|
backgroundColor: Color = MaterialTheme.colorScheme.background,
|
||||||
shape: CornerBasedShape = RoundedCornerShape(LocalShapes.current.large),
|
shape: CornerBasedShape = MaterialTheme.shapes.large,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
expandedContent: @Composable () -> Unit = {},
|
expandedContent: @Composable () -> Unit = {},
|
||||||
mainContent: @Composable () -> Unit
|
mainContent: @Composable () -> Unit
|
||||||
|
@ -4,7 +4,6 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.gestures.rememberTransformableState
|
import androidx.compose.foundation.gestures.rememberTransformableState
|
||||||
import androidx.compose.foundation.gestures.transformable
|
import androidx.compose.foundation.gestures.transformable
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -19,7 +18,6 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import coil.compose.SubcomposeAsyncImage
|
import coil.compose.SubcomposeAsyncImage
|
||||||
import coil.compose.SubcomposeAsyncImageContent
|
import coil.compose.SubcomposeAsyncImageContent
|
||||||
import com.looker.droidify.R
|
import com.looker.droidify.R
|
||||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NetworkImage(
|
fun NetworkImage(
|
||||||
@ -27,7 +25,7 @@ fun NetworkImage(
|
|||||||
data: String?,
|
data: String?,
|
||||||
contentScale: ContentScale = ContentScale.Crop,
|
contentScale: ContentScale = ContentScale.Crop,
|
||||||
backgroundColor: Color = MaterialTheme.colorScheme.surface,
|
backgroundColor: Color = MaterialTheme.colorScheme.surface,
|
||||||
shape: Shape = RoundedCornerShape(LocalShapes.current.medium)
|
shape: Shape = MaterialTheme.shapes.medium
|
||||||
) {
|
) {
|
||||||
SubcomposeAsyncImage(
|
SubcomposeAsyncImage(
|
||||||
modifier = modifier.clip(shape),
|
modifier = modifier.clip(shape),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user