1
1
package com.cornellappdev.scoop.components
2
2
3
+ import android.util.Log
3
4
import androidx.compose.foundation.layout.Box
4
5
import androidx.compose.foundation.layout.fillMaxSize
5
6
import androidx.compose.foundation.layout.height
@@ -19,12 +20,15 @@ import com.cornellappdev.scoop.ui.theme.DarkGray
19
20
import com.cornellappdev.scoop.ui.theme.Gray
20
21
import com.cornellappdev.scoop.ui.theme.Green
21
22
import com.google.accompanist.pager.PagerState
23
+ import kotlinx.coroutines.CoroutineScope
24
+ import kotlinx.coroutines.Dispatchers
22
25
import kotlinx.coroutines.launch
26
+ import kotlinx.coroutines.withContext
23
27
24
28
@OptIn(ExperimentalMaterialApi ::class , com.google.accompanist.pager.ExperimentalPagerApi ::class )
25
29
@Composable
26
30
fun RightArrow (
27
- pagerState : PagerState ,
31
+ nextFunction : suspend () -> Unit ,
28
32
isComplete : Boolean = false,
29
33
) {
30
34
val scope = rememberCoroutineScope()
@@ -37,8 +41,11 @@ fun RightArrow(
37
41
enabled = isComplete,
38
42
backgroundColor = if (isComplete) Green else Gray ,
39
43
onClick = {
44
+ Log .d(" PAGERSTATE" , " button Clicked" )
40
45
scope.launch {
41
- pagerState.animateScrollToPage(pagerState.currentPage + 1 )
46
+ withContext(Dispatchers .IO ) {
47
+ nextFunction()
48
+ }
42
49
}
43
50
}
44
51
) {
0 commit comments