mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-05-18 06:24:12 +02:00
feat(connector): add list of all projects screen
This commit is contained in:
parent
f014aee71b
commit
5256ea64a6
@ -60,7 +60,10 @@ class CreateProject : Screen {
|
||||
|
||||
Button(
|
||||
contentPadding = ButtonDefaults.ButtonWithIconContentPadding,
|
||||
onClick = { /* TODO Add re-direction to project lists */ }
|
||||
onClick = {
|
||||
// TODO save new project and make sure it redirects to list page
|
||||
navigator.pop()
|
||||
}
|
||||
) {
|
||||
Icon(Icons.Outlined.Add, "Create Project", modifier = Modifier.size(18.dp))
|
||||
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||
|
@ -0,0 +1,68 @@
|
||||
package tab.project
|
||||
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.rememberScrollbarAdapter
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||
import androidx.compose.material.icons.outlined.Add
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
|
||||
class ListProjects : Screen {
|
||||
@Composable
|
||||
override fun Content() {
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
val state = rememberLazyListState(0)
|
||||
|
||||
Scaffold (
|
||||
floatingActionButton = {
|
||||
ExtendedFloatingActionButton(
|
||||
onClick = { navigator.push(CreateProject()) },
|
||||
content = {
|
||||
Icon(Icons.Outlined.Add, "Create New Project")
|
||||
Text("New Project")
|
||||
}
|
||||
)
|
||||
}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth(0.7F),
|
||||
) {
|
||||
LazyColumn(state = state) {
|
||||
items(50) { index ->
|
||||
ListItem(
|
||||
overlineContent = { Text("Emergency") },
|
||||
headlineContent = { Text("Project $index") },
|
||||
trailingContent = { Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, "Open Project") }
|
||||
)
|
||||
HorizontalDivider()
|
||||
}
|
||||
}
|
||||
VerticalScrollbar(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterEnd)
|
||||
.fillMaxHeight(),
|
||||
adapter = rememberScrollbarAdapter(
|
||||
scrollState = state,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ object Projects : Tab {
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
Navigator(NoProjects) {
|
||||
Navigator(ListProjects()) {
|
||||
CurrentScreen()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user