DocumentScreen: extract BottomBar
This commit is contained in:
@@ -112,27 +112,7 @@ fun DocumentScreen(
|
|||||||
bottomBar = {
|
bottomBar = {
|
||||||
Column {
|
Column {
|
||||||
PageList(pageIds, imageLoader, currentPageIndex, toCameraScreen)
|
PageList(pageIds, imageLoader, currentPageIndex, toCameraScreen)
|
||||||
Row(
|
BottomBar(showPdfDialog, showNewDocDialog)
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
|
|
||||||
.padding(start = 8.dp, end = 8.dp, top = 16.dp, bottom = 32.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.End
|
|
||||||
) {
|
|
||||||
Button(onClick = { showPdfDialog.value = true }) {
|
|
||||||
Icon(Icons.Default.PictureAsPdf, contentDescription = "Generate PDF")
|
|
||||||
Spacer(Modifier.width(8.dp))
|
|
||||||
Text("Generate PDF")
|
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
|
||||||
MyIconButton(
|
|
||||||
icon = Icons.Default.RestartAlt,
|
|
||||||
contentDescription = "Restart",
|
|
||||||
onClick = { showNewDocDialog.value = true },
|
|
||||||
modifier = Modifier.padding(vertical = 8.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
@@ -236,6 +216,34 @@ private fun PageList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun BottomBar(
|
||||||
|
showPdfDialog: MutableState<Boolean>,
|
||||||
|
showNewDocDialog: MutableState<Boolean>,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
|
||||||
|
.padding(start = 8.dp, end = 8.dp, top = 16.dp, bottom = 32.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.End
|
||||||
|
) {
|
||||||
|
Button(onClick = { showPdfDialog.value = true }) {
|
||||||
|
Icon(Icons.Default.PictureAsPdf, contentDescription = "Generate PDF")
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text("Generate PDF")
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
MyIconButton(
|
||||||
|
icon = Icons.Default.RestartAlt,
|
||||||
|
contentDescription = "Restart",
|
||||||
|
onClick = { showNewDocDialog.value = true },
|
||||||
|
modifier = Modifier.padding(vertical = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NewDocumentDialog(onConfirm: () -> Unit, showDialog: MutableState<Boolean>) {
|
fun NewDocumentDialog(onConfirm: () -> Unit, showDialog: MutableState<Boolean>) {
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
@@ -281,7 +289,6 @@ fun MyIconButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Preview
|
@Preview
|
||||||
fun DocumentScreenPreview() {
|
fun DocumentScreenPreview() {
|
||||||
|
|||||||
Reference in New Issue
Block a user