Implement modern bottom navigation with icons and add Material3 FAB for "Klottra" in new UI
This commit is contained in:
@@ -3,18 +3,27 @@ package app.klottr
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Info
|
import androidx.compose.material.icons.filled.Info
|
||||||
|
import androidx.compose.material.icons.filled.Layers
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.Person
|
||||||
|
import androidx.compose.material.icons.filled.Place
|
||||||
import androidx.compose.material.icons.filled.Settings
|
import androidx.compose.material.icons.filled.Settings
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.FloatingActionButton
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.NavigationBar
|
||||||
|
import androidx.compose.material3.NavigationBarItem
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -281,7 +290,63 @@ fun KlottrAppShell(
|
|||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
if (useNewUi) {
|
if (useNewUi) {
|
||||||
Box(modifier = Modifier.padding(padding)) { }
|
Scaffold(
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
title = { Text("") },
|
||||||
|
actions = {
|
||||||
|
IconButton(onClick = { showAbout = true }) {
|
||||||
|
Icon(imageVector = Icons.Filled.Info, contentDescription = "Om")
|
||||||
|
}
|
||||||
|
IconButton(onClick = { showSettings = true }) {
|
||||||
|
Icon(imageVector = Icons.Filled.Settings, contentDescription = "Inställningar")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
bottomBar = {
|
||||||
|
NavigationBar {
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = false,
|
||||||
|
onClick = { /* TODO Lager */ },
|
||||||
|
icon = { Icon(Icons.Filled.Layers, contentDescription = "Lager") },
|
||||||
|
label = { Text("Lager") }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = false,
|
||||||
|
onClick = { /* TODO Nära */ },
|
||||||
|
icon = { Icon(Icons.Filled.Place, contentDescription = "Nära") },
|
||||||
|
label = { Text("Nära") }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = false,
|
||||||
|
onClick = { /* TODO Konto */ },
|
||||||
|
icon = { Icon(Icons.Filled.Person, contentDescription = "Konto") },
|
||||||
|
label = { Text("Konto") }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = false,
|
||||||
|
onClick = { /* TODO Meny */ },
|
||||||
|
icon = { Icon(Icons.Filled.Menu, contentDescription = "Meny") },
|
||||||
|
label = { Text("Meny") }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
floatingActionButton = {
|
||||||
|
FloatingActionButton(
|
||||||
|
onClick = { showWrite = true }
|
||||||
|
) {
|
||||||
|
Icon(Icons.Filled.Add, contentDescription = "Klottra")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
floatingActionButtonPosition = androidx.compose.material3.FabPosition.Center,
|
||||||
|
content = { innerPadding ->
|
||||||
|
Box(modifier = Modifier.padding(innerPadding)) {
|
||||||
|
// Här kan vi i framtiden lägga innehåll för de olika menyvalen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
//Box(modifier = Modifier.padding(padding)) { }
|
||||||
} else {
|
} else {
|
||||||
// --- Nytt: definiera listan + overrides före UI-anropet ---
|
// --- Nytt: definiera listan + overrides före UI-anropet ---
|
||||||
val foundList = remember(foundRefresh, forceEmptyFound) {
|
val foundList = remember(foundRefresh, forceEmptyFound) {
|
||||||
|
|||||||
Reference in New Issue
Block a user