ещё немного осталось

This commit is contained in:
maxnes3 2023-11-16 04:17:27 +04:00
parent 1a3a0d4cd7
commit 31b936fe0e
10 changed files with 20 additions and 41 deletions

@ -33,7 +33,7 @@ val buttonHeightStandard = 72.dp
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun PlaceholderInputField(label: String){ fun PlaceholderInputField(label: String, isSingleLine: Boolean){
var text = remember { mutableStateOf("") } var text = remember { mutableStateOf("") }
OutlinedTextField( OutlinedTextField(
@ -47,7 +47,9 @@ fun PlaceholderInputField(label: String){
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.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),
shape = RoundedCornerShape(10.dp)) shape = RoundedCornerShape(10.dp),
singleLine = isSingleLine
)
} }
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@ -93,7 +95,8 @@ fun SearchInputField(){
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(top = 16.dp, start = 16.dp, bottom = 8.dp, end = 16.dp), .padding(top = 16.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
shape = RoundedCornerShape(10.dp) shape = RoundedCornerShape(10.dp),
singleLine = true
) )
} }
@ -156,7 +159,7 @@ fun ActiveButton(label: String, backgroundColor: Color, textColor: Color, onClic
fun PlaceholderTextFieldPreview() { fun PlaceholderTextFieldPreview() {
MobileAppTheme { MobileAppTheme {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
PlaceholderInputField("Email") PlaceholderInputField("Email", true)
} }
} }
} }

@ -143,24 +143,6 @@ fun DataListItemButton(label: String, backgroundColor: Color, textColor: Color,
} }
} }
@Composable
fun MailListScroll(navController: NavHostController){
val mailSingleton = MailSingleton()
LazyColumn(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxWidth()
){
item {
addNewListItem(navController, "editmail")
}
items(mailSingleton.getMailList()){ item ->
MailListItem(item = item)
}
}
}
@Composable @Composable
fun MailListItem(item: Mail){ fun MailListItem(item: Mail){
val isExpanded = remember { val isExpanded = remember {

@ -19,7 +19,7 @@ import androidx.room.PrimaryKey
) )
data class Mail( data class Mail(
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
var id: Int?, var id: Int? = null,
@ColumnInfo(name = "message") @ColumnInfo(name = "message")
val message: String, val message: String,
@ColumnInfo(name="user_id") @ColumnInfo(name="user_id")

@ -20,7 +20,7 @@ import androidx.room.PrimaryKey
) )
data class Story( data class Story(
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
val id: Int?, val id: Int? = null,
@ColumnInfo(name = "title") @ColumnInfo(name = "title")
val title: String, val title: String,
@ColumnInfo(name = "description") @ColumnInfo(name = "description")

@ -7,7 +7,7 @@ import androidx.room.PrimaryKey
@Entity(tableName = "users") @Entity(tableName = "users")
data class User( data class User(
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
var id: Int?, var id: Int? = null,
@ColumnInfo(name = "login") @ColumnInfo(name = "login")
val login: String, val login: String,
@ColumnInfo(name = "password") @ColumnInfo(name = "password")

@ -37,7 +37,7 @@ fun Authorization(navController: NavHostController){
.size(512.dp) .size(512.dp)
.padding(8.dp) .padding(8.dp)
.align(Alignment.CenterHorizontally)) .align(Alignment.CenterHorizontally))
PlaceholderInputField(label = "Логин") PlaceholderInputField(label = "Логин", true)
PasswordInputField(label = "Пароль") PasswordInputField(label = "Пароль")
NavigationButton(navController = navController, destination = "main", label = "Вход", NavigationButton(navController = navController, destination = "main", label = "Вход",
backgroundColor = ButtonColor2, textColor = Color.White) backgroundColor = ButtonColor2, textColor = Color.White)

@ -35,12 +35,13 @@ fun EditStoryScreen(navController: NavHostController) {
contentDescription = "editplaceholder", contentDescription = "editplaceholder",
contentScale = ContentScale.Crop, contentScale = ContentScale.Crop,
modifier = Modifier modifier = Modifier
.size(512.dp) .size(384.dp)
.padding(8.dp) .padding(8.dp)
.align(Alignment.CenterHorizontally)) .align(Alignment.CenterHorizontally))
PlaceholderInputField(label = "Название") PlaceholderInputField(label = "Название", true)
ActiveButton(label = "Выбрать обложку", backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = {}) ActiveButton(label = "Выбрать обложку", backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = {})
PlaceholderInputField(label = "Описание") PlaceholderInputField(label = "Описание", true)
ActiveButton(label = "Сохранить", backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = {})
NavigationButton(navController = navController, destination = "listdata", label = "Назад", NavigationButton(navController = navController, destination = "listdata", label = "Назад",
backgroundColor = ButtonColor2, textColor = Color.White) backgroundColor = ButtonColor2, textColor = Color.White)
} }
@ -62,8 +63,8 @@ fun EditMailScreen(navController: NavHostController) {
.size(512.dp) .size(512.dp)
.padding(8.dp) .padding(8.dp)
.align(Alignment.CenterHorizontally)) .align(Alignment.CenterHorizontally))
PlaceholderInputField(label = "Заголовок") PlaceholderInputField(label = "Текс поста", false)
PlaceholderInputField(label = "Текс поста") ActiveButton(label = "Сохранить", backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = {})
NavigationButton(navController = navController, destination = "mail", label = "Назад", NavigationButton(navController = navController, destination = "mail", label = "Назад",
backgroundColor = ButtonColor2, textColor = Color.White) backgroundColor = ButtonColor2, textColor = Color.White)
} }

@ -1,21 +1,14 @@
package com.example.mobileapp.screens package com.example.mobileapp.screens
import androidx.compose.foundation.background 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.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
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.DataListScroll
import com.example.mobileapp.components.MailListScroll
import com.example.mobileapp.components.NavBar
import com.example.mobileapp.entities.MailSingleton 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
@Composable @Composable
fun ListMailScreen(navController: NavHostController){ fun ListMailScreen(navController: NavHostController){

@ -37,8 +37,8 @@ fun Registration(navController: NavHostController){
.size(384.dp) .size(384.dp)
.padding(8.dp) .padding(8.dp)
.align(Alignment.CenterHorizontally)) .align(Alignment.CenterHorizontally))
PlaceholderInputField(label = "Логин") PlaceholderInputField(label = "Логин", true)
PlaceholderInputField(label = "Email") PlaceholderInputField(label = "Email", true)
PasswordInputField(label = "Пароль") PasswordInputField(label = "Пароль")
PasswordInputField(label = "Пароль ещё раз") PasswordInputField(label = "Пароль ещё раз")
NavigationButton(navController = navController, destination = "main", NavigationButton(navController = navController, destination = "main",

@ -57,6 +57,6 @@ fun SettingsScreen(navController: NavHostController){
IconButton(iconLeft = Icons.Default.Info, label = "О приложении", IconButton(iconLeft = Icons.Default.Info, label = "О приложении",
backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = { }) backgroundColor = ButtonColor1, textColor = Color.Black, onClickAction = { })
IconButton(iconLeft = Icons.Default.ExitToApp, label = "Выйти", IconButton(iconLeft = Icons.Default.ExitToApp, label = "Выйти",
backgroundColor = Color.Red, textColor = Color.White, onClickAction = { }) backgroundColor = Color.Red, textColor = Color.White, onClickAction = { navController.navigate("") })
} }
} }