mirror of
https://github.com/InsanusMokrassar/KotlinPublicationScriptsBuilder.git
synced 2026-04-03 23:02:21 +00:00
complete restyling
This commit is contained in:
@@ -8,10 +8,11 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.DefaultSmallVerticalMargin
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.TitleText
|
||||
|
||||
actual abstract class View {
|
||||
internal open val defaultModifier = Modifier.fillMaxWidth().padding(8.dp)
|
||||
internal open val defaultModifier = Modifier.fillMaxWidth()
|
||||
@Composable
|
||||
actual abstract fun build()
|
||||
}
|
||||
@@ -22,10 +23,11 @@ actual fun View.DrawVertically(
|
||||
block: @Composable () -> Unit
|
||||
) {
|
||||
TitleText(title)
|
||||
DefaultSmallVerticalMargin()
|
||||
|
||||
Column(defaultModifier) {
|
||||
block()
|
||||
}
|
||||
|
||||
Spacer(Modifier.fillMaxWidth().height(8.dp))
|
||||
DefaultSmallVerticalMargin()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ actual class GpgSigningOptionDrawer(
|
||||
@Composable
|
||||
override fun GpgSigning.draw() {
|
||||
if (mavenInfoView.gpgSignProperty == this) {
|
||||
Button({}, Modifier.padding(8.dp)) {
|
||||
Button({}, Modifier.padding(8.dp, 0.dp)) {
|
||||
Text(name)
|
||||
}
|
||||
} else {
|
||||
@@ -28,7 +28,7 @@ actual class GpgSigningOptionDrawer(
|
||||
{
|
||||
mavenInfoView.gpgSignProperty = this
|
||||
},
|
||||
Modifier.padding(8.dp)
|
||||
Modifier.padding(8.dp, 0.dp)
|
||||
) {
|
||||
Text(name)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.CommonText
|
||||
@@ -21,7 +19,7 @@ actual object LicensesDrawer : Drawer<LicensesView> {
|
||||
licensesOffersToShow.value.forEach {
|
||||
Column(Modifier.padding(16.dp, 8.dp, 8.dp, 8.dp)) {
|
||||
CommonText(it.title) {
|
||||
licensesListState.add(it.toLicenseState())
|
||||
itemsList.add(it.toLicenseState())
|
||||
licenseSearchFilter = ""
|
||||
}
|
||||
Divider()
|
||||
@@ -29,29 +27,5 @@ actual object LicensesDrawer : Drawer<LicensesView> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button({ licensesListState.add(LicenseState()) }, Modifier.padding(8.dp)) {
|
||||
CommonText("Add empty license")
|
||||
}
|
||||
|
||||
licensesListState.forEach { license ->
|
||||
Column(Modifier.padding(8.dp)) {
|
||||
CommonTextField(
|
||||
license.id,
|
||||
"License ID",
|
||||
) { license.id = it }
|
||||
CommonTextField(
|
||||
license.title,
|
||||
"License title",
|
||||
) { license.title = it }
|
||||
CommonTextField(
|
||||
license.url ?: "",
|
||||
"License URL",
|
||||
) { license.url = it }
|
||||
Button({ licensesListState.remove(license) }, Modifier.padding(8.dp)) {
|
||||
CommonText("Remove",)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,32 @@ package dev.inmo.kmppscriptbuilder.core.ui
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.CommonText
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.DefaultBox
|
||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
||||
|
||||
actual class ListViewDrawer<T> : Drawer<ListView<T>> {
|
||||
@Composable
|
||||
override fun ListView<T>.draw() {
|
||||
Button({ itemsList.add(createItem()) }) {
|
||||
CommonText(addItemText,)
|
||||
}
|
||||
itemsList.forEach { item ->
|
||||
Column(Modifier.padding(8.dp)) {
|
||||
DefaultBox {
|
||||
buildView(item)
|
||||
Button({ itemsList.remove(item) }, Modifier.padding(8.dp)) {
|
||||
OutlinedButton({ itemsList.remove(item) }, Modifier.padding(8.dp)) {
|
||||
CommonText(removeItemText,)
|
||||
}
|
||||
}
|
||||
Button({ itemsList.add(createItem()) }) {
|
||||
CommonText(addItemText,)
|
||||
}
|
||||
}
|
||||
if (itemsList.isEmpty()) {
|
||||
Button({ itemsList.add(createItem()) }) {
|
||||
CommonText(addItemText,)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ actual class ProjectTypeDrawer(
|
||||
@Composable
|
||||
override fun ProjectType.draw() {
|
||||
if (projectTypeView.projectType == this) {
|
||||
Button({}, Modifier.padding(8.dp)) {
|
||||
Button({}, Modifier.padding(8.dp, 0.dp)) {
|
||||
Text(name)
|
||||
}
|
||||
} else {
|
||||
@@ -29,7 +29,7 @@ actual class ProjectTypeDrawer(
|
||||
{
|
||||
projectTypeView.projectType = this
|
||||
},
|
||||
Modifier.padding(8.dp)
|
||||
Modifier.padding(8.dp, 0.dp)
|
||||
) {
|
||||
Text(name)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package dev.inmo.kmppscriptbuilder.core.ui.utils
|
||||
import androidx.compose.foundation.clickable
|
||||
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.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Divider
|
||||
@@ -50,7 +52,7 @@ actual fun SwitchWithLabel(
|
||||
@Composable
|
||||
actual fun CommonTextField(
|
||||
presetText: String,
|
||||
hint: String,
|
||||
hint: String?,
|
||||
onFocusChanged: (Boolean) -> Unit,
|
||||
onChange: (String) -> Unit
|
||||
) {
|
||||
@@ -61,8 +63,10 @@ actual fun CommonTextField(
|
||||
onFocusChanged(it.isFocused)
|
||||
},
|
||||
singleLine = true,
|
||||
label = {
|
||||
CommonText(hint,)
|
||||
label = hint ?.let {
|
||||
{
|
||||
CommonText(hint)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -94,3 +98,15 @@ actual fun <T> ButtonsPanel(
|
||||
actual fun DefaultDivider() {
|
||||
Divider()
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DefaultSmallVerticalMargin() {
|
||||
Spacer(Modifier.padding(0.dp, 4.dp))
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DefaultBox(block: @Composable () -> Unit) {
|
||||
Column(Modifier.padding(8.dp)) {
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user