Я её обязательно сдам
This commit is contained in:
parent
c6aeb58bdd
commit
6f19337903
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
@ -18,6 +18,8 @@ import com.example.mobileapp.entities.MailSingleton
|
||||
import com.example.mobileapp.entities.Story
|
||||
import com.example.mobileapp.entities.StorySingleton
|
||||
import com.example.mobileapp.screens.Authorization
|
||||
import com.example.mobileapp.screens.EditMailScreen
|
||||
import com.example.mobileapp.screens.EditStoryScreen
|
||||
import com.example.mobileapp.screens.ListDataScreen
|
||||
import com.example.mobileapp.screens.ListMailScreen
|
||||
import com.example.mobileapp.screens.MainScreen
|
||||
@ -82,5 +84,11 @@ fun AppNavigation(navController: NavHostController){
|
||||
composable("settings"){
|
||||
SettingsScreen(navController = navController)
|
||||
}
|
||||
composable("editstory"){
|
||||
EditStoryScreen(navController = navController)
|
||||
}
|
||||
composable("editmail"){
|
||||
EditMailScreen(navController = navController)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,12 @@ package com.example.mobileapp.components
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@ -17,9 +20,12 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
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
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@ -88,6 +94,30 @@ fun SearchInputField(){
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ActiveButton(label: String, backgroundColor: Color, textColor: Color){
|
||||
Button(
|
||||
onClick = {
|
||||
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(64.dp)
|
||||
.padding(top = 8.dp, start = 16.dp, bottom = 8.dp, end = 16.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = backgroundColor
|
||||
),
|
||||
shape = RoundedCornerShape(10.dp)
|
||||
) {
|
||||
Text(
|
||||
text = label,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = textColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun PlaceholderTextFieldPreview() {
|
||||
|
@ -33,6 +33,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
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.R
|
||||
import com.example.mobileapp.entities.Mail
|
||||
import com.example.mobileapp.entities.MailSingleton
|
||||
@ -43,7 +44,7 @@ import com.example.mobileapp.ui.theme.ButtonColor1
|
||||
import com.example.mobileapp.ui.theme.ButtonColor2
|
||||
|
||||
@Composable
|
||||
fun DataListScroll(){
|
||||
fun DataListScroll(navController: NavHostController){
|
||||
val storySingleton = StorySingleton()
|
||||
val isFirstTime = remember { mutableStateOf(true) }
|
||||
|
||||
@ -53,7 +54,7 @@ fun DataListScroll(){
|
||||
.fillMaxWidth()
|
||||
){
|
||||
item {
|
||||
addNewListItem()
|
||||
addNewListItem(navController, "editstory")
|
||||
}
|
||||
items(storySingleton.getStoryList()){ item ->
|
||||
DataListItem(item = item)
|
||||
@ -140,7 +141,7 @@ fun DataListItemButton(label: String, backgroundColor: Color, textColor: Color){
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MailListScroll(){
|
||||
fun MailListScroll(navController: NavHostController){
|
||||
val mailSingleton = MailSingleton()
|
||||
|
||||
LazyColumn(
|
||||
@ -149,7 +150,7 @@ fun MailListScroll(){
|
||||
.fillMaxWidth()
|
||||
){
|
||||
item {
|
||||
addNewListItem()
|
||||
addNewListItem(navController, "editmail")
|
||||
}
|
||||
items(mailSingleton.getMailList()){ item ->
|
||||
MailListItem(item = item)
|
||||
@ -225,15 +226,14 @@ fun MailListItem(item: Mail){
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun addNewListItem(){
|
||||
fun addNewListItem(navController: NavHostController, destination: String){
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 18.dp, top = 8.dp, end = 18.dp, bottom = 8.dp)
|
||||
.clickable {
|
||||
|
||||
navController.navigate(destination)
|
||||
},
|
||||
shape = RoundedCornerShape(15.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
|
@ -1,25 +1,68 @@
|
||||
package com.example.mobileapp.screens
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavHostController
|
||||
import com.example.mobileapp.R
|
||||
import com.example.mobileapp.components.ActiveButton
|
||||
import com.example.mobileapp.components.NavigationButton
|
||||
import com.example.mobileapp.components.PasswordInputField
|
||||
import com.example.mobileapp.components.PlaceholderInputField
|
||||
import com.example.mobileapp.ui.theme.ButtonColor1
|
||||
import com.example.mobileapp.ui.theme.ButtonColor2
|
||||
|
||||
@Composable
|
||||
fun EditStoryScreen(navController: NavHostController) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(bottom = 8.dp)
|
||||
) {
|
||||
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.editplaceholder),
|
||||
contentDescription = "editplaceholder",
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.size(512.dp)
|
||||
.padding(8.dp)
|
||||
.align(Alignment.CenterHorizontally))
|
||||
PlaceholderInputField(label = "Название")
|
||||
ActiveButton(label = "Выбрать обложку", backgroundColor = ButtonColor1, textColor = Color.Black)
|
||||
PlaceholderInputField(label = "Описание")
|
||||
NavigationButton(navController = navController, destination = "listdata", label = "Назад",
|
||||
backgroundColor = ButtonColor2, textColor = Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EditMailScreen(navController: NavHostController) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(bottom = 8.dp)
|
||||
) {
|
||||
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.mailplaceholder),
|
||||
contentDescription = "mailplaceholder",
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.size(512.dp)
|
||||
.padding(8.dp)
|
||||
.align(Alignment.CenterHorizontally))
|
||||
PlaceholderInputField(label = "Заголовок")
|
||||
PlaceholderInputField(label = "Текс поста")
|
||||
NavigationButton(navController = navController, destination = "mail", label = "Назад",
|
||||
backgroundColor = ButtonColor2, textColor = Color.White)
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ fun ListDataScreen(navController: NavHostController){
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight(0.9f)
|
||||
){
|
||||
DataListScroll()
|
||||
DataListScroll(navController)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
@ -27,7 +27,7 @@ fun ListMailScreen(navController: NavHostController){
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight(0.9f)
|
||||
){
|
||||
MailListScroll()
|
||||
MailListScroll(navController)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
@ -10,6 +10,7 @@ val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
|
||||
//Мои кастомная палитра
|
||||
val BackgroundItem1 = Color(0xff3a425d)
|
||||
val BackgroundItem2 = Color(0xffe4ecfc)
|
||||
val ButtonColor1 = Color(0xffb8d0e0)
|
||||
|
Loading…
Reference in New Issue
Block a user