Я почти гений

This commit is contained in:
maxnes3 2023-11-16 03:06:38 +04:00
parent 6fc39a2396
commit 1a3a0d4cd7
5 changed files with 23 additions and 13 deletions

View File

@ -27,9 +27,10 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import com.example.mobileapp.ui.theme.MobileAppTheme
val buttonHeightStandard = 72.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PlaceholderInputField(label: String){
@ -102,7 +103,7 @@ fun IconButton(iconLeft: ImageVector, label: String, backgroundColor: Color, tex
onClick = onClickAction,
modifier = Modifier
.fillMaxWidth()
.requiredHeight(64.dp)
.requiredHeight(buttonHeightStandard)
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor
@ -134,7 +135,7 @@ fun ActiveButton(label: String, backgroundColor: Color, textColor: Color, onClic
onClick = onClickAction,
modifier = Modifier
.fillMaxWidth()
.requiredHeight(64.dp)
.requiredHeight(buttonHeightStandard)
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor

View File

@ -44,25 +44,29 @@ import com.example.mobileapp.ui.theme.ButtonColor1
import com.example.mobileapp.ui.theme.ButtonColor2
@Composable
fun DataListScroll(navController: NavHostController){
val storySingleton = StorySingleton()
fun <T : Any> DataListScroll(navController: NavHostController, dataList: List<T>){
LazyColumn(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxWidth()
){
item {
addNewListItem(navController, "editstory")
when(dataList[0]){
is Story -> addNewListItem(navController, "editstory")
is Mail -> addNewListItem(navController, "editmail")
}
}
items(storySingleton.getStoryList()){ item ->
DataListItem(item = item, navController = navController)
items(dataList){ item ->
when(item){
is Story -> StoryListItem(item = item, navController = navController)
is Mail -> MailListItem(item = item)
}
}
}
}
@Composable
fun DataListItem(item: Story, navController: NavHostController){
fun StoryListItem(item: Story, navController: NavHostController){
val isExpanded = remember {
mutableStateOf(false)
}

View File

@ -140,7 +140,7 @@ fun NavigationButton(navController: NavHostController,
},
modifier = Modifier
.fillMaxWidth()
.requiredHeight(64.dp)
.requiredHeight(72.dp)
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor

View File

@ -12,16 +12,18 @@ import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import com.example.mobileapp.components.DataListScroll
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.BackgroundItem2
@Composable
fun ListDataScreen(navController: NavHostController){
val storySingleton = StorySingleton()
Column(
modifier = Modifier
.fillMaxSize()
.background(BackgroundItem1)
) {
DataListScroll(navController)
DataListScroll(navController, storySingleton.getStoryList())
}
}

View File

@ -10,18 +10,21 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import com.example.mobileapp.components.DataListScroll
import com.example.mobileapp.components.MailListScroll
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.BackgroundItem2
@Composable
fun ListMailScreen(navController: NavHostController){
val mailSingleton = MailSingleton()
Column(
modifier = Modifier
.fillMaxSize()
.background(BackgroundItem1)
) {
MailListScroll(navController)
DataListScroll(navController, mailSingleton.getMailList())
}
}