Skip to content

Make dialog content bigger & scrollable 📺 (#9) #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/main/kotlin/ThemeColorPicker.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand All @@ -16,6 +31,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import java.awt.Dimension

@Composable
internal fun ThemeColorPicker(
Expand Down Expand Up @@ -48,6 +64,8 @@ internal fun ThemeColorPicker(
onCloseRequest = { isDialogVisible = false },
title = colorName,
) {
window.size = Dimension(400, 400)

ColorPickerDialogContent(
currentColor,
onOkClicked = { pickedColor ->
Expand All @@ -59,6 +77,7 @@ internal fun ThemeColorPicker(
)
}
}

@Composable
private fun ColorPickerDialogContent(
currentColor: Color,
Expand All @@ -67,9 +86,12 @@ private fun ColorPickerDialogContent(
recentlyUsedColors: List<Color> = listOf(),
) {
var pickedColor by remember { mutableStateOf(currentColor) }
val scrollState = rememberScrollState()

Column(
modifier = modifier.fillMaxSize().padding(16.dp),
modifier = modifier.fillMaxSize()
.padding(16.dp)
.verticalScroll(scrollState),
horizontalAlignment = Alignment.CenterHorizontally
) {
Box(
Expand Down