diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/components/TextField.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/components/TextField.kt index 662a987..1c6ad1f 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/components/TextField.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/components/TextField.kt @@ -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, diff --git a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/components/Card.kt b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/components/Card.kt index 0fb316f..9930883 100644 --- a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/components/Card.kt +++ b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/components/Card.kt @@ -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; } @@ -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) diff --git a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/app/AppScreen.kt b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/app/AppScreen.kt index d716334..18ff820 100644 --- a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/app/AppScreen.kt +++ b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/app/AppScreen.kt @@ -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 { diff --git a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/ResourcesTab.kt b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/ResourcesTab.kt index efd7f37..0335ac1 100644 --- a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/ResourcesTab.kt +++ b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/ResourcesTab.kt @@ -43,16 +43,27 @@ object ResourcesTab : Tab { val model = getScreenModel() val settings = getScreenModel().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)), @@ -63,7 +74,7 @@ object ResourcesTab : Tab { .clip(RoundedCornerShape(4.dp)), contentScale = ContentScale.FillWidth, - ) + ) } } } diff --git a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/SettingsTab.kt b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/SettingsTab.kt index c4d64d3..798a781 100644 --- a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/SettingsTab.kt +++ b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/home/tab/SettingsTab.kt @@ -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 diff --git a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreen.kt b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/user/LoginScreen.kt similarity index 98% rename from composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreen.kt rename to composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/user/LoginScreen.kt index 12a0461..936ccb0 100644 --- a/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreen.kt +++ b/composeApp/src/desktopMain/kotlin/com/github/springeye/memosc/ui/user/LoginScreen.kt @@ -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 @@ -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