Skip to content

Commit

Permalink
UI angepasst
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevynidd committed Sep 14, 2023
1 parent 4c76175 commit d590660
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.iml
.gradle
/local.properties
/.idea
/.idea/caches
/.idea/libraries
/.idea/modules.xml
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ android {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
kotlinCompilerExtensionVersion = "1.5.3"
}
packaging {
resources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
Expand Down Expand Up @@ -69,7 +69,7 @@ fun NavigationBar() {
)

Scaffold(
modifier = Modifier.safeDrawingPadding(),
modifier = Modifier.safeContentPadding(),
contentWindowInsets = WindowInsets(30.dp, 20.dp, 30.dp, 0.dp),
topBar = {
TopBar(navController)
Expand All @@ -93,6 +93,7 @@ fun NavigationBar() {
@Composable
fun TopBar(navController: NavHostController) {
val currentRoute = currentRoute(navController = navController)

TopAppBar(
title = {},
navigationIcon = {
Expand All @@ -118,7 +119,7 @@ fun TopBar(navController: NavHostController) {
}) {
Icon(
painter = painterResource(id = R.drawable.settings),
"Einstellungen"
contentDescription = "Einstellungen"
)
}
}
Expand All @@ -130,7 +131,6 @@ fun BottomBar(
navController: NavHostController,
items: List<ScreenDefinition>
) {

BubbleNavigationBar {
val currentRoute = currentRoute(navController = navController)
items.forEach { navigationItem ->
Expand All @@ -148,7 +148,6 @@ fun BottomBar(
)
}
}

}

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
package agb.loehne.blutspende_app.ui.screens

import agb.loehne.blutspende_app.ui.theme.Blutspende_AppTheme
import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp

@Composable
fun Blutwerte() {
Expand All @@ -20,6 +38,34 @@ fun Blutwerte() {
.background(MaterialTheme.colorScheme.background)
) {
Text("Blutwerte")

var menuOpen by remember {
mutableStateOf(false)
}
val currentMenuIcon: ImageVector by rememberUpdatedState(
if (menuOpen) Icons.Filled.Close else Icons.Filled.Menu
)

Box(Modifier.fillMaxSize()) {
FloatingActionButton(
shape = MaterialTheme.shapes.medium.copy(CornerSize(percent = 50)),
modifier = Modifier
.padding(bottom = 30.dp)
.align(alignment = Alignment.BottomEnd),
onClick = { menuOpen = !menuOpen }
) {
Crossfade(
targetState = currentMenuIcon,
label = "CrossfadeMenuIcon"
) { icon ->
Icon(
icon,
contentDescription = null
)
}
}
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.selection.selectable
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -56,7 +56,7 @@ fun Settings(navController: NavHostController) {
Column(
modifier = Modifier
.fillMaxSize()
.safeDrawingPadding()
.safeContentPadding()
) {
Column(
modifier = Modifier.fillMaxSize()
Expand All @@ -67,7 +67,7 @@ fun Settings(navController: NavHostController) {

Spacer(modifier = Modifier.size(20.dp))

DialogBlutgruppe(navController)
ButtonBlutgruppe(navController)
}
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ fun DialogDarstellung(
painter = painterResource(id = R.drawable.paint_brush),
"DarstellungIcon",
modifier = Modifier
.size(54.dp)
.size(50.dp)
.padding(end = 20.dp)
)
}
Expand Down Expand Up @@ -183,7 +183,7 @@ fun DialogDarstellung(

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DialogBlutgruppe(navController: NavHostController) {
fun ButtonBlutgruppe(navController: NavHostController) {

var showDialogBlutgruppe by remember { mutableStateOf(false) }
val viewModel: DatastoreViewModel = viewModel()
Expand All @@ -201,7 +201,7 @@ fun DialogBlutgruppe(navController: NavHostController) {
painter = painterResource(id = R.drawable.blood_drop),
"BlutgruppeIcon",
modifier = Modifier
.size(54.dp)
.size(56.dp)
.padding(end = 20.dp)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package agb.loehne.blutspende_app.ui.screens

import agb.loehne.blutspende_app.ui.theme.Blutspende_AppTheme
import androidx.activity.compose.BackHandler
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ class BlutgruppeViewModel : ViewModel() {

// Getter
val getShowDialog: Boolean get() = _showDialog.value
val getRadioOptions: List<String> get() = _radioOptions
val getImageIds: List<Int> get() = _imageIds

// Setter
fun setShowDialog(value: Boolean) {
_showDialog.value = value
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.1" apply false
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
}

0 comments on commit d590660

Please sign in to comment.