11package com.flipcash.app.tokens.internal
22
3+ import androidx.compose.foundation.background
34import androidx.compose.foundation.layout.Arrangement
45import androidx.compose.foundation.layout.Box
56import androidx.compose.foundation.layout.PaddingValues
67import androidx.compose.foundation.layout.Row
78import androidx.compose.foundation.layout.Spacer
9+ import androidx.compose.foundation.layout.WindowInsets
810import androidx.compose.foundation.layout.fillMaxSize
911import androidx.compose.foundation.layout.fillMaxWidth
1012import androidx.compose.foundation.layout.height
13+ import androidx.compose.foundation.layout.navigationBars
1114import androidx.compose.foundation.layout.navigationBarsPadding
15+ import androidx.compose.foundation.layout.offset
1216import androidx.compose.foundation.layout.padding
17+ import androidx.compose.foundation.layout.wrapContentSize
1318import androidx.compose.foundation.lazy.LazyColumn
1419import androidx.compose.foundation.lazy.rememberLazyListState
1520import androidx.compose.material.Divider
1621import androidx.compose.material.Text
1722import androidx.compose.runtime.Composable
1823import androidx.compose.runtime.LaunchedEffect
1924import androidx.compose.runtime.getValue
25+ import androidx.compose.runtime.mutableStateOf
26+ import androidx.compose.runtime.remember
27+ import androidx.compose.runtime.setValue
2028import androidx.compose.runtime.snapshotFlow
2129import androidx.compose.ui.Alignment
2230import androidx.compose.ui.Modifier
31+ import androidx.compose.ui.graphics.Brush
32+ import androidx.compose.ui.graphics.Color
2333import androidx.compose.ui.input.nestedscroll.nestedScroll
34+ import androidx.compose.ui.platform.LocalDensity
2435import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
2536import androidx.compose.ui.res.stringResource
2637import androidx.compose.ui.unit.dp
@@ -36,7 +47,11 @@ import com.flipcash.app.tokens.internal.components.info.TokenDetailsSection
3647import com.flipcash.app.tokens.internal.components.marketcap.generateMarketCapData
3748import com.flipcash.features.tokens.R
3849import com.getcode.theme.CodeTheme
50+ import com.getcode.ui.core.addIf
51+ import com.getcode.ui.core.debugBounds
52+ import com.getcode.ui.core.drawWithGradient
3953import com.getcode.ui.core.isScrolledToStart
54+ import com.getcode.ui.core.measured
4055import com.getcode.ui.core.verticalScrollStateGradient
4156import com.getcode.ui.theme.ButtonState
4257import com.getcode.ui.theme.CodeButton
@@ -68,15 +83,16 @@ private fun TokenInfoScreen(
6883 dispatch : (TokenInfoViewModel .Event ) -> Unit
6984) {
7085 val listState = rememberLazyListState()
71- val hazeState = rememberHazeState()
86+
7287 CodeScaffold (
73- bottomBar = { BottomBar (state, hazeState, dispatch) }
88+ bottomBar = { BottomBar (state, dispatch) }
7489 ) { innerPadding ->
7590 Box (
7691 modifier = Modifier .verticalScrollStateGradient(
7792 listState,
7893 color = CodeTheme .colors.background,
7994 isLongGradient = true ,
95+ showAtEnd = false ,
8096 )
8197 ) {
8298 LazyColumn (
@@ -86,7 +102,6 @@ private fun TokenInfoScreen(
86102 start = innerPadding.calculateStartPadding(),
87103 end = innerPadding.calculateEndPadding(),
88104 )
89- .hazeSource(hazeState)
90105 .sheetResignmentBehavior(listState),
91106 state = listState,
92107 ) {
@@ -211,27 +226,42 @@ private fun TokenInfoScreen(
211226@Composable
212227private fun BottomBar (
213228 state : TokenInfoViewModel .State ,
214- hazeState : HazeState ,
215229 dispatch : (TokenInfoViewModel .Event ) -> Unit
216230) {
217- Row (
218- modifier = Modifier
219- .fillMaxWidth()
220- .navigationBarsPadding()
221- .hazeEffect(
222- state = hazeState,
223- style = HazeMaterials .ultraThin(
224- containerColor = CodeTheme .colors.background.copy(0.15f )
225- )
226- ) {
227- this .blurRadius = 20 .dp
228- this .progressive = HazeProgressive .LinearGradient (
229- startIntensity = 1f ,
230- endIntensity = 1f
231+ var buttonHeight by remember { mutableStateOf(0 .dp) }
232+
233+ Box {
234+ Box (
235+ modifier = Modifier
236+ .fillMaxWidth()
237+ .height(buttonHeight)
238+ .drawWithGradient(
239+ color = CodeTheme .colors.background,
240+ startY = { 0f },
241+ endY = { size.height * 0.1f }
231242 )
232- }
233- .padding(horizontal = CodeTheme .dimens.inset)
234- .padding(vertical = CodeTheme .dimens.grid.x3),
243+ )
244+ BottomBarButtons (
245+ modifier = Modifier
246+ .measured { buttonHeight = it.height }
247+ .navigationBarsPadding()
248+ .padding(horizontal = CodeTheme .dimens.inset)
249+ .padding(vertical = CodeTheme .dimens.grid.x3),
250+ state = state,
251+ dispatch = dispatch
252+ )
253+ }
254+ }
255+
256+ @Composable
257+ private fun BottomBarButtons (
258+ state : TokenInfoViewModel .State ,
259+ modifier : Modifier = Modifier ,
260+ dispatch : (TokenInfoViewModel .Event ) -> Unit
261+ ) {
262+ Row (
263+ modifier = modifier
264+ .fillMaxWidth(),
235265 verticalAlignment = Alignment .CenterVertically ,
236266 horizontalArrangement = Arrangement .spacedBy(CodeTheme .dimens.grid.x2),
237267 ) {
0 commit comments