Skip to content
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

- Save Button was not properly visible fixed UI issue #137

Open
wants to merge 1 commit into
base: multimodule
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ android {
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}

packagingOptions {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ package android.template.feature.mymodel.ui
import android.template.core.ui.MyApplicationTheme
import android.template.feature.mymodel.ui.MyModelUiState.Success
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.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
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.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -59,20 +63,39 @@ internal fun MyModelScreen(
Column(modifier) {
var nameMyModel by remember { mutableStateOf("Compose") }
Row(
modifier = Modifier.fillMaxWidth().padding(bottom = 24.dp),
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
TextField(
value = nameMyModel,
onValueChange = { nameMyModel = it }
)

Button(modifier = Modifier.width(96.dp), onClick = { onSave(nameMyModel) }) {
Text("Save")
Box(Modifier.weight(7f)) {
OutlinedTextField(
value = nameMyModel,
onValueChange = { nameMyModel = it }
)
}
Box(Modifier.weight(3f)) {
Button(modifier = Modifier.fillMaxWidth(), onClick = { onSave(nameMyModel) }) {
Text("Save")
}
}
}
items.forEach {
Text("Saved item: $it")
Card(
Modifier
.fillMaxWidth()
.padding(top = 10.dp, bottom = 10.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
),
) {
Text(
"Saved item: $it",
modifier = Modifier
.padding(16.dp),
textAlign = TextAlign.Center,
)
}
}
}
}
Expand Down