title: Scroll all screen with a lazy column and paging library inside
body: <p>I'm new to Jetpack Compose and I'm not quite sure how to do what I need. In the screen below, I want to scroll the whole screen and not just the list at the bottom and when the scroll reaches the end of the list below, it still applies the paging library and goes to get more elements. I managed to get the Paging Library to work and the scroll in the list below too, but I can't make the rest of the page elements scroll as well - this is because only the list has scroll and not the rest of the page. Whenever I'm trying to do that, I get the following crash:</p>
  <p><code>Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.</code></p>
  <p>and I don't really know why.</p>
  <p>I leave you the code below and two screenshots: the first is the current state, where I can only scroll through the list. The second is what I intend, which is to scroll the entire page.</p>
  <p><strong>@Edit:</strong> I was able to implement all screen scroll with fixed height on the children lazy column, but that is not what I want.</p>
  <p><a href="https://i.stack.imgur.com/3RUiq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3RUiq.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/8lxRj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8lxRj.png" alt="enter image description here" /></a></p>
  <pre><code>@Composable
  @ExperimentalFoundationApi
  private fun MainActivityLayout(navController: NavHostController) {
      LazyColumn(
          modifier = Modifier
              .paint(
                  painter = painterResource(id = R.drawable.main_background),
                  contentScale = ContentScale.FillBounds
              )
              .fillMaxSize(),
          horizontalAlignment = Alignment.CenterHorizontally
      ) {
          item {
              HeightSpacer(Dimen40)
  
              Image(
                  painter = painterResource(id = R.drawable.ic_clearjobs_logo_2x),
                  contentDescription = null
              )
  
              HeightSpacer(Dimen47)
              Navigation(navController = navController)
          }
      }
  }
  </code></pre>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Composable
  @ExperimentalFoundationApi
  fun JobOpeningsScreen(viewModel: JobOpeningsViewModel = hiltViewModel()) {
      val uiState by viewModel.uiState.collectAsState()
  
      Column {
          ClearJobsScreenTitle(
              lightTitle = stringResource(id = R.string.job_openings_light_title),
              boldTitle = stringResource(id = R.string.job_openings_bold_title)
          )
  
          HeightSpacer(Dimen60)
          Row {
              CategoryButton()
              WidthSpacer(Dimen2)
              OrderByButton()
          }
          HeightSpacer(Dimen30)
          SearchTextField()
          HeightSpacer(Dimen60)
  
          when (uiState) {
              is BaseViewState.Data -&gt; JobOpeningsContent(
                  viewState = uiState.cast&lt;BaseViewState.Data&lt;JobOpeningsViewState&gt;&gt;().value
              )
              is BaseViewState.Loading -&gt; {
                  LoadingView()
              }
              else -&gt; {}
          }
  
          LaunchedEffect(key1 = viewModel, block = {
              viewModel.onTriggerEvent(JobOpeningsEvent.LoadJobOffers)
          })
      }
  }</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Composable
  fun JobOpeningsContent(viewState: JobOpeningsViewState) {
      val pagingItems = rememberFlowWithLifecycle(viewState.pagedData).collectAsLazyPagingItems()
  
      SwipeRefresh(
          state = rememberSwipeRefreshState(
              isRefreshing = pagingItems.loadState.refresh == LoadState.Loading
          ),
          onRefresh = { pagingItems.refresh() },
          indicator = { state, trigger -&gt;
              SwipeRefreshIndicator(
                  state = state,
                  refreshTriggerDistance = trigger,
                  scale = true
              )
          },
          content = {
              LazyColumn(
                  modifier = Modifier.width(Dimen320),
                  verticalArrangement = Arrangement.spacedBy(Dimen30)
              ) {
                  items(pagingItems.itemCount) { index -&gt;
                      pagingItems[index]?.let {
                          JobOpeningsRow(dto = it)
                      }
                  }
  
                  if (pagingItems.loadState.append == LoadState.Loading) {
                      item {
                          Box(
                              Modifier
                                  .padding(24.dp)
                          ) {
                              CircularProgressIndicator(Modifier.align(Alignment.Center))
                          }
                      }
                  }
              }
          }
      )
  }</code></pre>
  </div>
  </div>
  </p>