From c25ac4a9a9e2f7aaf659f4c858862db1e276e734 Mon Sep 17 00:00:00 2001 From: Danya_Mochalov Date: Mon, 9 Oct 2023 18:09:28 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A7=D1=82=D0=BE-=D1=82=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=83=D1=87=D0=B0=D0=B5=D1=82=D1=81=D1=8F...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 4 +-- .idea/misc.xml | 2 +- .../java/com/example/shawarma/MainActivity.kt | 12 +++------ .../example/shawarma/screens/MainNavBar.kt | 26 ++++++++++++++----- .../authorization/AuthorizationScreen.kt | 14 +++++++--- .../registration/RegistrationScreen.kt | 9 ++++--- gradle.properties | 1 - 7 files changed, 41 insertions(+), 27 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 4d1c209..5c591b0 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,11 @@ - + - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index f478693..b0137f1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/app/src/main/java/com/example/shawarma/MainActivity.kt b/app/src/main/java/com/example/shawarma/MainActivity.kt index b5c31a3..fd16c24 100644 --- a/app/src/main/java/com/example/shawarma/MainActivity.kt +++ b/app/src/main/java/com/example/shawarma/MainActivity.kt @@ -17,16 +17,10 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) setContent { - ShawarmaTheme { - // A surface container using the 'background' color from the theme - Surface( - color = MyLightYellow, - modifier = Modifier.fillMaxSize() - ) - { + MainNavBar() - } - } + + } } } diff --git a/app/src/main/java/com/example/shawarma/screens/MainNavBar.kt b/app/src/main/java/com/example/shawarma/screens/MainNavBar.kt index b3f8b69..0234602 100644 --- a/app/src/main/java/com/example/shawarma/screens/MainNavBar.kt +++ b/app/src/main/java/com/example/shawarma/screens/MainNavBar.kt @@ -1,23 +1,35 @@ package com.example.shawarma.screens +import android.annotation.SuppressLint +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material.Scaffold +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import com.example.shawarma.screens.authorization.AuthorizationScreen import com.example.shawarma.screens.registration.RegistrationScreen +import com.example.shawarma.ui.theme.MyLightYellow import com.example.shawarma.utils.ScreenPaths +@SuppressLint("UnusedMaterialScaffoldPaddingParameter") @Composable fun MainNavBar() { val navController = rememberNavController() - - NavHost(navController = navController, startDestination = ScreenPaths.authorization.name) { - composable(ScreenPaths.authorization.name) { - AuthorizationScreen(navController) - } - composable(ScreenPaths.registration.name) { - RegistrationScreen(navController) + Scaffold( + backgroundColor = MyLightYellow, + modifier = Modifier.fillMaxSize() + ) {scaffoldPadding -> + NavHost(navController = navController, startDestination = ScreenPaths.authorization.name) { + composable(ScreenPaths.authorization.name) { + AuthorizationScreen(navController) + } + composable(ScreenPaths.registration.name) { + RegistrationScreen(navController) + } } } } \ No newline at end of file diff --git a/app/src/main/java/com/example/shawarma/screens/authorization/AuthorizationScreen.kt b/app/src/main/java/com/example/shawarma/screens/authorization/AuthorizationScreen.kt index c51ef5c..47cd77e 100644 --- a/app/src/main/java/com/example/shawarma/screens/authorization/AuthorizationScreen.kt +++ b/app/src/main/java/com/example/shawarma/screens/authorization/AuthorizationScreen.kt @@ -1,5 +1,6 @@ package com.example.shawarma.screens.authorization +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.imePadding @@ -33,8 +34,10 @@ import com.example.shawarma.widgets.ShawarmaLogo1 @Composable fun AuthorizationScreen(navHostController: NavHostController) { - ShawarmaLogo1() - AuthorizationCard(navHostController) + Box(contentAlignment = Alignment.TopCenter){ + ShawarmaLogo1() + AuthorizationCard(navHostController) + } } @Composable @@ -47,12 +50,15 @@ fun AuthorizationCard(navHostController: NavHostController) { modifier = Modifier .zIndex(2f) .verticalScroll(rememberScrollState()) - .imePadding().padding(10.dp) + .imePadding() + .padding(10.dp) .fillMaxHeight() ) { Card( shape = RoundedCornerShape(20.dp), - modifier = Modifier.size(275.dp, 290.dp + 72.dp).padding(top = 72.dp) + modifier = Modifier + .size(275.dp, 290.dp + 72.dp) + .padding(top = 72.dp) ) { Column( horizontalAlignment = Alignment.CenterHorizontally diff --git a/app/src/main/java/com/example/shawarma/screens/registration/RegistrationScreen.kt b/app/src/main/java/com/example/shawarma/screens/registration/RegistrationScreen.kt index 022d1a0..6eb6ebd 100644 --- a/app/src/main/java/com/example/shawarma/screens/registration/RegistrationScreen.kt +++ b/app/src/main/java/com/example/shawarma/screens/registration/RegistrationScreen.kt @@ -3,6 +3,7 @@ package com.example.shawarma.screens.registration import androidx.compose.foundation.background import androidx.compose.foundation.gestures.FlingBehavior import androidx.compose.foundation.gestures.ScrollScope +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.imePadding @@ -28,6 +29,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.zIndex import androidx.navigation.NavHostController +import com.example.shawarma.screens.authorization.AuthorizationCard import com.example.shawarma.ui.theme.JejuFamily import com.example.shawarma.ui.theme.MyLightRed import com.example.shawarma.utils.ScreenPaths @@ -36,9 +38,10 @@ import com.example.shawarma.widgets.ShawarmaLogo1 @Composable fun RegistrationScreen(navHostController: NavHostController) { - RegistrationCard(navHostController) - ShawarmaLogo1() - + Box(contentAlignment = Alignment.TopCenter){ + ShawarmaLogo1() + RegistrationCard(navHostController) + } } @Composable diff --git a/gradle.properties b/gradle.properties index aa511e3..239f54f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,5 +23,4 @@ kotlin.code.style=official android.nonTransitiveRClass=true android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false -org.gradle.unsafe.configuration-cache=true android.suppressUnsupportedCompileSdk=34 \ No newline at end of file