Skip to content

Commit

Permalink
add max width for bottomsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Fethi Tewelde committed Oct 3, 2024
1 parent 185c2a8 commit b16ad10
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import com.android.build.api.dsl.LibraryExtension
import com.tewelde.rijksmuseum.configureKotlinAndroid
import com.tewelde.rijksmuseum.configureKotlinMultiplatform
import com.tewelde.rijksmuseum.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import com.tewelde.rijksmuseum.configureKotlinAndroid
import com.tewelde.rijksmuseum.configureKotlinMultiplatform

class KotlinMultiplatformConventionPlugin: Plugin<Project> {
override fun apply(target: Project) = with(target) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import coil3.network.ktor3.KtorNetworkFetcherFactory
import coil3.request.CachePolicy
import coil3.request.crossfade
import coil3.util.DebugLogger
import com.tewelde.rijksmuseum.navigation.RijksmuseumNavGraph
import com.tewelde.rijksmuseum.core.designsystem.theme.RijksmuseumTheme
import com.tewelde.rijksmuseum.navigation.RijksmuseumNavGraph
import okio.FileSystem
import org.jetbrains.compose.ui.tooling.preview.Preview
import org.koin.compose.KoinContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.tewelde.rijksmuseum.core.domain.di

import com.tewelde.rijksmuseum.core.data.di.dataModule
import com.tewelde.rijksmuseum.core.domain.DownloadImageUseCase
import com.tewelde.rijksmuseum.core.domain.GetArtDetailUseCase
import com.tewelde.rijksmuseum.core.domain.GetArtsUseCase
import com.tewelde.rijksmuseum.core.domain.DownloadImageUseCase
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.module

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.tewelde.rijksmuseum.core.permissions.delegate

import co.touchlab.kermit.Logger
import com.tewelde.rijksmuseum.core.permissions.model.Permission
import com.tewelde.rijksmuseum.core.permissions.model.PermissionState
import com.tewelde.rijksmuseum.core.permissions.util.DeniedAlwaysException
Expand Down
15 changes: 13 additions & 2 deletions feature/arts/src/androidMain/kotlin/Utils.android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import com.tewelde.rijksmuseum.core.model.Art
import io.github.vinceglb.filekit.core.FileKitPlatformSettings
import kotlinx.coroutines.CoroutineScope
Expand All @@ -16,7 +17,17 @@ import okio.FileSystem
import kotlin.coroutines.coroutineContext

@Composable
actual fun screenHeight(): Int = LocalContext.current.resources.displayMetrics.heightPixels
actual fun screenHeight(): Int {
val view = LocalView.current
return remember { view.resources.displayMetrics.heightPixels }
}

@Composable
actual fun screenWidth(): Int {
val view = LocalView.current
return remember { view.resources.displayMetrics.widthPixels }
}


actual class FileUtil(private val context: Context) {
actual fun filesystem(): FileSystem? = FileSystem.SYSTEM
Expand Down
3 changes: 3 additions & 0 deletions feature/arts/src/commonMain/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import okio.FileSystem
@Composable
expect fun screenHeight(): Int

@Composable
expect fun screenWidth(): Int

expect val Art.artUrl: String

expect val minGridSize: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import com.tewelde.rijksmuseum.resources.saving_success
import com.tewelde.rijksmuseum.resources.settings
import org.jetbrains.compose.resources.getString
import screenHeight
import screenWidth

@Composable
fun DetailScreenRoute(
Expand Down Expand Up @@ -172,7 +173,7 @@ fun DetailScreen(
containerColor = MaterialTheme.colorScheme.surface,
contentColor = MaterialTheme.colorScheme.onSurface,
sheetTonalElevation = 0.dp,
// sheetMaxWidth = 100000.dp, // TODO get screen size per platform
sheetMaxWidth = screenWidth().dp,
sheetContent = {
when (uiState.state) {
is State.Loading,
Expand Down
14 changes: 13 additions & 1 deletion feature/arts/src/desktopMain/kotlin/Utils.desktop.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.platform.LocalWindowInfo
import com.tewelde.rijksmuseum.core.model.Art
Expand All @@ -8,7 +9,18 @@ import okio.FileSystem

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenHeight(): Int = LocalWindowInfo.current.containerSize.height
actual fun screenHeight(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.height }
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenWidth(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.width }
}


actual class FileUtil {
actual fun filesystem(): FileSystem? = FileSystem.SYSTEM
Expand Down
13 changes: 12 additions & 1 deletion feature/arts/src/iosMain/kotlin/Utils.ios.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.platform.LocalWindowInfo
import com.tewelde.rijksmuseum.core.model.Art
Expand All @@ -19,7 +20,17 @@ import kotlin.coroutines.coroutineContext

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenHeight(): Int = LocalWindowInfo.current.containerSize.height
actual fun screenHeight(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.height }
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenWidth(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.width }
}

actual class FileUtil {
actual fun filesystem(): FileSystem? = FileSystem.SYSTEM
Expand Down
12 changes: 11 additions & 1 deletion feature/arts/src/wasmJsMain/kotlin/Utils.wasmJs.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.platform.LocalWindowInfo
import com.tewelde.rijksmuseum.core.model.Art
Expand All @@ -8,8 +9,17 @@ import okio.FileSystem

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenHeight(): Int = LocalWindowInfo.current.containerSize.height
actual fun screenHeight(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.height }
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
actual fun screenWidth(): Int {
val view = LocalWindowInfo.current
return remember { view.containerSize.width }
}

actual class FileUtil {
actual fun filesystem(): FileSystem? = null
Expand Down

0 comments on commit b16ad10

Please sign in to comment.