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

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

View File

@ -33,7 +33,7 @@ val buttonHeightStandard = 72.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PlaceholderInputField(label: String){
fun PlaceholderInputField(label: String, isSingleLine: Boolean){
var text = remember { mutableStateOf("") }
OutlinedTextField(
@ -47,7 +47,9 @@ fun PlaceholderInputField(label: String){
modifier = Modifier
.fillMaxWidth()
.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)
@ -93,7 +95,8 @@ fun SearchInputField(){
modifier = Modifier
.fillMaxWidth()
.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() {
MobileAppTheme {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
PlaceholderInputField("Email")
PlaceholderInputField("Email", true)
}
}
}

View File

@ -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
fun MailListItem(item: Mail){
val isExpanded = remember {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,21 +1,14 @@
package com.example.mobileapp.screens
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.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
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){

View File

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

View File

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