Skip to content

Commit

Permalink
Merge branch 'AddShopScreen'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/com/example/kkneed/ui/BottomBarView.kt
  • Loading branch information
Wukexin committed Feb 22, 2023
2 parents 5b3496b + 2fb9ba7 commit 1880071
Show file tree
Hide file tree
Showing 10 changed files with 612 additions and 14 deletions.
90 changes: 90 additions & 0 deletions app/src/main/java/com/example/kkneed/screen/home/DayScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.example.kkneed.screen.home

import android.annotation.SuppressLint
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Scaffold
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.example.kkneed.R
import com.example.kkneed.ui.MostUseTopAppBar
import com.example.kkneed.ui.ShopDetailBottomBar
import com.example.kkneed.ui.theme.KKNeedTheme

@OptIn(ExperimentalMaterialApi::class)
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
fun HealthScreen(navController: NavController) {
Scaffold(
backgroundColor = MaterialTheme.colorScheme.background,
topBar = {
MostUseTopAppBar(
appBarHeight = 64.dp,
navController = navController,
title = "每日一食"
)
},
) {
Box(modifier = Modifier.fillMaxSize()){
Image(
painter = painterResource(R.drawable.daypic),
contentDescription = "",
modifier = Modifier
.clip(RoundedCornerShape(0))
.fillMaxSize(),
contentScale = ContentScale.Crop,
alignment = Alignment.TopCenter,
)
Column(
modifier = Modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Bottom,
) {
Image(
painter = painterResource(R.drawable.daybottom),
contentDescription = "",
modifier = Modifier
.clip(RoundedCornerShape(0))
.fillMaxWidth()
.height(118.dp),
contentScale = ContentScale.Crop,
alignment = Alignment.TopCenter,
)
// Card(
// modifier = Modifier
// .fillMaxWidth()
// .height(118.dp),
// onClick = {},
// backgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp),
// elevation = 0.dp,
// ){
//
// }
}
}

}
}

@Preview
@Composable
fun PreviewHealthScreen() {
KKNeedTheme {
val navController = rememberNavController()
HealthScreen(navController)
}
}
70 changes: 70 additions & 0 deletions app/src/main/java/com/example/kkneed/screen/shop/HealthScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.example.kkneed.screen.shop

import android.annotation.SuppressLint
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Scaffold
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.example.kkneed.R
import com.example.kkneed.ui.DetailList
import com.example.kkneed.ui.DetailTabBar
import com.example.kkneed.ui.MostUseTopAppBar
import com.example.kkneed.ui.ShopDetailBottomBar
import com.example.kkneed.ui.components.DetailChip
import com.example.kkneed.ui.theme.KKNeedTheme

@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
fun HealthScreen(navController: NavController) {
Scaffold(
backgroundColor = MaterialTheme.colorScheme.background,
topBar = {
MostUseTopAppBar(
appBarHeight = 64.dp,
navController = navController,
title = "康康卡片"
)
},
bottomBar = {
ShopDetailBottomBar()
}
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.background(color = MaterialTheme.colorScheme.onPrimary)
.padding(horizontal = 16.dp)
) {
DetailList(title = "可口可乐300ml", "可口可乐公司")
DetailChip(state = false, title = listOf("超级加工食品", "减脂期适量", "糖尿病适量"))
Spacer(modifier = Modifier.height(12.dp))
DetailTabBar()

}
}
}

@Preview
@Composable
fun PreviewHealthScreen() {
KKNeedTheme {
val navController = rememberNavController()
HealthScreen(navController)
}
}
Loading

0 comments on commit 1880071

Please sign in to comment.