diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt index ef32286..f287392 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/ui/DrawerUI.kt @@ -22,21 +22,20 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester -import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import mg.dot.feufaro.Platform import mg.dot.feufaro.getPlatform import mg.dot.feufaro.pdf.PrintSettings import mg.dot.feufaro.pdf.defaultPrintSettings @@ -562,7 +561,7 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { scope.launch { codeContent = sourceContent @@ -571,14 +570,10 @@ fun MainScreenWithDrawer( solfaScreenModel.loadExternalFile(originalPath) } } - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = Icons.AutoMirrored.Default.Undo, - contentDescription = null, - tint = Color.Blue - ) - } + }, + containerColor = Color(0x20000000), + icon = Icons.AutoMirrored.Default.Undo + ) } AnimatedVisibility( @@ -586,7 +581,7 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { scope.launch { try { @@ -597,14 +592,10 @@ fun MainScreenWithDrawer( e.printStackTrace() } } - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = Icons.Filled.SaveAs, - contentDescription = null, - tint = Color.Blue - ) - } + }, + containerColor = Color(0x20000000), + icon = Icons.Filled.SaveAs + ) } AnimatedVisibility( @@ -612,17 +603,13 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.toggleEditorMode(false) - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = Icons.Default.Close, - contentDescription = null, - tint = Color.Blue - ) - } + }, + containerColor = Color(0x20000000), + icon = Icons.Default.Close + ) } } else { AnimatedVisibility( @@ -632,30 +619,24 @@ fun MainScreenWithDrawer( ) { Row { Column { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.descGridCount(1) - }, modifier = Modifier.size(30.dp).alpha(0.45f) - ) { - Icon( - Icons.Default.Remove, - contentDescription = null, - tint = Color.Blue - ) - } + }, + containerColor = Color(0x15000000), + size = 30.dp, + icon = Icons.Default.Remove + ) } Column { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.addGridCount(1) - }, modifier = Modifier.size(30.dp).alpha(0.45f) - ) { - Icon( - Icons.Default.Add, - contentDescription = null, - tint = Color.Blue - ) - } + }, + containerColor = Color(0x15000000), + size = 30.dp, + icon = Icons.Default.Add + ) } } } @@ -664,18 +645,14 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.toggleQRCodeVisibility() sharedScreenModel.setExpandedFAB(false) - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = Icons.Filled.QrCode, - contentDescription = "share qr", - tint = Color.Blue - ) - } + }, + containerColor = Color(0x15000000), + icon = Icons.Filled.QrCode + ) } @@ -684,17 +661,13 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { showPrintSettings = !showPrintSettings - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = Icons.Filled.Print, - contentDescription = "Imprimer", - tint = Color.Blue - ) - } + }, + containerColor = Color(0x15000000), + icon = Icons.Filled.Print + ) } AnimatedVisibility( @@ -702,32 +675,24 @@ fun MainScreenWithDrawer( enter = fadeIn() + scaleIn() + slideInVertically { it / 2 }, exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 } ) { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.setMidiCtrl(!showMidiCtrl) - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle, - contentDescription = "Jouer", - tint = Color.Blue - ) - } + }, + containerColor = Color(0x15000000), + icon = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle + ) } if (!showMidiCtrl) { - FloatingActionButton( + MyFAB( onClick = { sharedScreenModel.setExpandedFAB(!isExpanded) refreshTrigeer++ sharedScreenModel.loadNewSong("$midiFile") - }, modifier = Modifier.alpha(0.45f) - ) { - Icon( - imageVector = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu, - contentDescription = "MenuFermer", - tint = Color.Blue - ) - } + }, + containerColor = if (isExpanded) Color(0x25000000) else Color.Transparent, + icon = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu + ) } AnimatedVisibility( visible = showMidiCtrl, @@ -810,7 +775,7 @@ fun MainScreenWithDrawer( } }, modifier = Modifier - .size(56.dp) + .size(55.dp) .alpha(0.6f) .background( color = Color.Blue, @@ -916,6 +881,27 @@ fun MainScreenWithDrawer( }) } +@Composable +private fun MyFAB( + onClick: () -> Unit, + containerColor: Color, + size: Dp ?= 55.dp, + icon: ImageVector +) { + FloatingActionButton( + onClick = onClick, + modifier = Modifier.size(size!!), + containerColor = containerColor, + elevation = FloatingActionButtonDefaults.elevation(0.dp, 0.dp, 0.dp, 0.dp) + ) { + Icon( + imageVector = icon, + contentDescription = null, + tint = Color.Blue.copy(alpha = 0.75f) + ) + } +} + val LocalFullscreenController = staticCompositionLocalOf<(Boolean) -> Unit> { { _ -> } } \ No newline at end of file