Сделал info, осталось заполнить в нем инфу

This commit is contained in:
Кашин Максим 2023-10-27 21:20:32 +04:00
parent 9c557f636b
commit 4d638832bd
4 changed files with 120 additions and 6 deletions

View File

@ -33,17 +33,13 @@ import androidx.compose.ui.unit.em
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.example.labwork.R import com.example.labwork.R
import com.example.labwork.pages.ItemProduct import com.example.labwork.pages.ItemProduct
import com.example.labwork.pages.ListInfo
import com.example.labwork.pages.ListProduct import com.example.labwork.pages.ListProduct
import com.example.labwork.pages.getItemProducts import com.example.labwork.pages.getItemProducts
@Composable @Composable
fun ScreenInfo() { fun ScreenInfo() {
Text( ListInfo()
modifier = Modifier
.fillMaxSize()
.wrapContentHeight(),
text = "Тут будет главный экран..."
)
} }
@Composable @Composable

View File

@ -0,0 +1,118 @@
package com.example.labwork.pages
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.Tab
import androidx.compose.material.TabRow
import androidx.compose.material.TabRowDefaults
import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.labwork.R
import com.example.labwork.ui.theme.DarkBluePolitech
import com.example.labwork.ui.theme.LightBluePolitech
@Composable
fun ListInfo() {
var selectedTab by remember { mutableStateOf(0) }
Box(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier
.padding(16.dp)
.align(Alignment.TopCenter)
) {
Image(
painter = painterResource(id = R.drawable.logo_ulstu),
contentDescription = "Menu Image",
modifier = Modifier
.size(200.dp)
.align(CenterHorizontally)
.shadow(16.dp)
.background(color = Color.Transparent)
)
Spacer(modifier = Modifier.height(16.dp))
TabRow(
selectedTabIndex = selectedTab,
backgroundColor = LightBluePolitech,
contentColor = Color.White,
indicator = { tabPositions ->
TabRowDefaults.Indicator(
color = Color.White,
height = 4.dp,
modifier = Modifier
.tabIndicatorOffset(tabPositions[selectedTab])
)
},
modifier = Modifier.shadow(16.dp)
) {
Tab(
selected = selectedTab == 0,
onClick = { selectedTab = 0 }
) {
Text(
text = "Tab 1",
modifier = Modifier.padding(8.dp)
)
}
Tab(
selected = selectedTab == 1,
onClick = { selectedTab = 1 }
) {
Text(
text = "Tab 2",
modifier = Modifier.padding(8.dp)
)
}
Tab(
selected = selectedTab == 2,
onClick = { selectedTab = 2 }
) {
Text(
text = "Tab 3",
modifier = Modifier.padding(8.dp)
)
}
}
Spacer(modifier = Modifier.height(16.dp))
when (selectedTab) {
0 -> TabContent("Tab 1 Content")
1 -> TabContent("Tab 2 Content")
2 -> TabContent("Tab 3 Content")
}
}
}
}
@Composable
fun TabContent(content: String) {
Column(modifier = Modifier.fillMaxWidth()) {
Text(
text = content,
modifier = Modifier.padding(16.dp),
fontSize = 18.sp
)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB