Я почти гений
This commit is contained in:
parent
6fc39a2396
commit
1a3a0d4cd7
@ -27,9 +27,10 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.navigation.NavHostController
|
|
||||||
import com.example.mobileapp.ui.theme.MobileAppTheme
|
import com.example.mobileapp.ui.theme.MobileAppTheme
|
||||||
|
|
||||||
|
val buttonHeightStandard = 72.dp
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun PlaceholderInputField(label: String){
|
fun PlaceholderInputField(label: String){
|
||||||
@ -102,7 +103,7 @@ fun IconButton(iconLeft: ImageVector, label: String, backgroundColor: Color, tex
|
|||||||
onClick = onClickAction,
|
onClick = onClickAction,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.requiredHeight(64.dp)
|
.requiredHeight(buttonHeightStandard)
|
||||||
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = backgroundColor
|
containerColor = backgroundColor
|
||||||
@ -134,7 +135,7 @@ fun ActiveButton(label: String, backgroundColor: Color, textColor: Color, onClic
|
|||||||
onClick = onClickAction,
|
onClick = onClickAction,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.requiredHeight(64.dp)
|
.requiredHeight(buttonHeightStandard)
|
||||||
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = backgroundColor
|
containerColor = backgroundColor
|
||||||
|
@ -44,25 +44,29 @@ import com.example.mobileapp.ui.theme.ButtonColor1
|
|||||||
import com.example.mobileapp.ui.theme.ButtonColor2
|
import com.example.mobileapp.ui.theme.ButtonColor2
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DataListScroll(navController: NavHostController){
|
fun <T : Any> DataListScroll(navController: NavHostController, dataList: List<T>){
|
||||||
val storySingleton = StorySingleton()
|
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
){
|
){
|
||||||
item {
|
item {
|
||||||
addNewListItem(navController, "editstory")
|
when(dataList[0]){
|
||||||
|
is Story -> addNewListItem(navController, "editstory")
|
||||||
|
is Mail -> addNewListItem(navController, "editmail")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
items(storySingleton.getStoryList()){ item ->
|
items(dataList){ item ->
|
||||||
DataListItem(item = item, navController = navController)
|
when(item){
|
||||||
|
is Story -> StoryListItem(item = item, navController = navController)
|
||||||
|
is Mail -> MailListItem(item = item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DataListItem(item: Story, navController: NavHostController){
|
fun StoryListItem(item: Story, navController: NavHostController){
|
||||||
val isExpanded = remember {
|
val isExpanded = remember {
|
||||||
mutableStateOf(false)
|
mutableStateOf(false)
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ fun NavigationButton(navController: NavHostController,
|
|||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.requiredHeight(64.dp)
|
.requiredHeight(72.dp)
|
||||||
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = backgroundColor
|
containerColor = backgroundColor
|
||||||
|
@ -12,16 +12,18 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
import com.example.mobileapp.components.DataListScroll
|
import com.example.mobileapp.components.DataListScroll
|
||||||
import com.example.mobileapp.components.NavBar
|
import com.example.mobileapp.components.NavBar
|
||||||
|
import com.example.mobileapp.entities.StorySingleton
|
||||||
import com.example.mobileapp.ui.theme.BackgroundItem1
|
import com.example.mobileapp.ui.theme.BackgroundItem1
|
||||||
import com.example.mobileapp.ui.theme.BackgroundItem2
|
import com.example.mobileapp.ui.theme.BackgroundItem2
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ListDataScreen(navController: NavHostController){
|
fun ListDataScreen(navController: NavHostController){
|
||||||
|
val storySingleton = StorySingleton()
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(BackgroundItem1)
|
.background(BackgroundItem1)
|
||||||
) {
|
) {
|
||||||
DataListScroll(navController)
|
DataListScroll(navController, storySingleton.getStoryList())
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,18 +10,21 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
|
import com.example.mobileapp.components.DataListScroll
|
||||||
import com.example.mobileapp.components.MailListScroll
|
import com.example.mobileapp.components.MailListScroll
|
||||||
import com.example.mobileapp.components.NavBar
|
import com.example.mobileapp.components.NavBar
|
||||||
|
import com.example.mobileapp.entities.MailSingleton
|
||||||
import com.example.mobileapp.ui.theme.BackgroundItem1
|
import com.example.mobileapp.ui.theme.BackgroundItem1
|
||||||
import com.example.mobileapp.ui.theme.BackgroundItem2
|
import com.example.mobileapp.ui.theme.BackgroundItem2
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ListMailScreen(navController: NavHostController){
|
fun ListMailScreen(navController: NavHostController){
|
||||||
|
val mailSingleton = MailSingleton()
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(BackgroundItem1)
|
.background(BackgroundItem1)
|
||||||
) {
|
) {
|
||||||
MailListScroll(navController)
|
DataListScroll(navController, mailSingleton.getMailList())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user