From 9ecfdc2d123531f7e416fd3b5d6c73862eea8611 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Wed, 14 Aug 2024 14:32:26 +0200 Subject: [PATCH] Add fab in ReceivedScreen --- .../ui/screen/main/received/ReceivedScreen.kt | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt index 032c1b136..fa0539fd5 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt @@ -18,10 +18,55 @@ package com.infomaniak.swisstransfer.ui.screen.main.received +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.infomaniak.swisstransfer.ui.components.MainScreenFab +import com.infomaniak.swisstransfer.ui.components.MainScreenFabType +import com.infomaniak.swisstransfer.ui.screen.main.LocalNavType +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewMobile +import com.infomaniak.swisstransfer.ui.utils.PreviewTablet @Composable fun ReceivedScreen(navigateToDetails: (transferId: Int) -> Unit) { - Text("Received screen") + ReceivedScreen(navType = LocalNavType.current) +} + +@Composable +private fun ReceivedScreen(navType: NavigationSuiteType) { + Scaffold( + floatingActionButton = { + if (navType == NavigationSuiteType.NavigationBar) MainScreenFab(mainScreenFabType = MainScreenFabType.BOTTOM_BAR) + } + ) { contentPadding -> + Text( + text = "Received screen", + modifier = Modifier.padding(contentPadding), + ) + } +} + +@PreviewMobile +@Composable +private fun ReceivedScreenMobilePreview() { + SwissTransferTheme { + Surface { + ReceivedScreen(navType = NavigationSuiteType.NavigationBar) + } + } +} + +@PreviewTablet +@Composable +private fun ReceivedScreenTabletPreview() { + SwissTransferTheme { + Surface { + ReceivedScreen(navType = NavigationSuiteType.NavigationRail) + } + } }