Skip to content

Commit

Permalink
feat: building electricity screen
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Info committed Jul 2, 2024
1 parent 462d930 commit 0ea061f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun CampusCardInfoCard(
val text = if (it.data == null) {
"N/A"
} else {
"¥${it.data}"
"¥ ${it.data}"
}

Text(
Expand Down
69 changes: 69 additions & 0 deletions app/src/main/kotlin/com/zjutjh/ijh/ui/screen/ElectricityScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.zjutjh.ijh.ui.screen

import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.zjutjh.ijh.R
import com.zjutjh.ijh.ui.component.BackIconButton
import com.zjutjh.ijh.ui.component.IJhScaffold
import com.zjutjh.ijh.ui.theme.IJhTheme

@Composable
fun ElectricityRoute() {
ElectricityScreen()
}

@Composable
private fun ElectricityScreen() {
ElectricityScaffold(onBackClick = { /*TODO*/ }) {
Card {
Text(stringResource(id = R.string.dorm_electricity))
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun ElectricityScaffold(
onBackClick: () -> Unit,
content: @Composable BoxScope.(PaddingValues) -> Unit
) {
IJhScaffold(topBar = {
ElectricityTopBar(
scrollBehavior = it,
onBackClick = onBackClick,
)
}, content = content)
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun ElectricityTopBar(
scrollBehavior: TopAppBarScrollBehavior,
onBackClick: () -> Unit,
) {
TopAppBar(
title = {
Text(stringResource(id = R.string.dorm_electricity))
},
navigationIcon = {
BackIconButton(onBackClick)
},
scrollBehavior = scrollBehavior,
)
}

@Preview
@Composable
private fun ElectricityScreenPreview() {
IJhTheme {
ElectricityScreen()
}
}

0 comments on commit 0ea061f

Please sign in to comment.