Skip to content

Commit

Permalink
update carditem padding
Browse files Browse the repository at this point in the history
add settings
  • Loading branch information
springeye committed Jan 19, 2024
1 parent c0fc868 commit 777b0d7
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.ui.unit.dp
fun ITextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier,
modifier: Modifier=Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = LocalTextStyle.current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fun CardItem(
var hover by remember {
mutableStateOf(false)
}
var background = Modifier.clip(RoundedCornerShape(radius))
var background = modifier.clip(RoundedCornerShape(radius))
.onPointerEvent(PointerEventType.Enter) {
hover = true;
}
Expand All @@ -64,7 +64,6 @@ fun CardItem(
.background(if (hover) hoverColor else color)

Box(modifier = background
.then(modifier)
.border(borderWidth,if (hover) hoverBorderColor else borderColor,shape = RoundedCornerShape(radius))
.padding(paddingValues),
content = content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import com.github.springeye.memosc.LoadingAnimation
import com.github.springeye.memosc.LocalNotification
import com.github.springeye.memosc.ui.home.HomeScreen
import com.github.springeye.memosc.ui.login.LoginScreen
import com.github.springeye.memosc.ui.user.LoginScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi

object AppScreen : Screen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,27 @@ object ResourcesTab : Tab {
val model = getScreenModel<MemoModel>()
val settings = getScreenModel<AppModel>().state.value
val group by model.resourcesGroup.collectAsState(mapOf())
CardItem(modifier = Modifier.fillMaxSize()) {
CardItem(
modifier = Modifier.verticalScroll(rememberScrollState()).padding(10.dp).fillMaxWidth()
) {
Column {
for (entry in group) {
for (entry in group) {
Row {
Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.padding(horizontal = 15.dp).padding(top = 10.dp)) {
Text("${entry.key.formatDate("yyyy")}", style = MaterialTheme.typography.bodySmall)
Text("${entry.key.formatDate("MM")}", style = MaterialTheme.typography.titleMedium)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(horizontal = 15.dp).padding(top = 10.dp)
) {
Text(
"${entry.key.formatDate("yyyy")}",
style = MaterialTheme.typography.bodySmall
)
Text(
"${entry.key.formatDate("MM")}",
style = MaterialTheme.typography.titleMedium
)
}

FlowRow(modifier = Modifier.verticalScroll(rememberScrollState())) {
FlowRow() {
for (resource in entry.value) {
KamelImage(
asyncPainterResource(resource.uri(settings.host)),
Expand All @@ -63,7 +74,7 @@ object ResourcesTab : Tab {
.clip(RoundedCornerShape(4.dp)),
contentScale = ContentScale.FillWidth,

)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
package com.github.springeye.memosc.ui.home.tab

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.navigator.tab.Tab
import cafe.adriel.voyager.navigator.tab.TabOptions
import com.github.springeye.memosc.components.CardItem
import com.github.springeye.memosc.components.ITextField

object SettingsTab:Tab{
@Composable
override fun Content() {
Text("home2")
Scaffold {
CardItem(modifier = Modifier.verticalScroll(rememberScrollState()).padding(10.dp).fillMaxWidth()) {
Column {
ITextField("", onValueChange = {}, placeholder = {
Text("input server address")
})
}
}
}
}

override val options: TabOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.springeye.memosc.ui.login
package com.github.springeye.memosc.ui.user

import com.github.springeye.memosc.LocalNotification
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -40,6 +40,7 @@ import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.github.springeye.memosc.ui.home.HomeScreen
import com.github.springeye.memosc.ui.login.LoginScreenModel
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource

Expand Down

0 comments on commit 777b0d7

Please sign in to comment.