mirror of
https://github.com/Ashinch/ReadYou.git
synced 2025-01-31 11:35:10 +01:00
fix(ui): show top bar divider
This commit is contained in:
parent
58ce1a44f2
commit
cd9c31e456
@ -1,5 +1,6 @@
|
||||
package me.ash.reader.ui.page.home.reading
|
||||
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@ -47,6 +48,7 @@ fun Content(
|
||||
author: String? = null,
|
||||
link: String? = null,
|
||||
publishedDate: Date,
|
||||
scrollState: ScrollState,
|
||||
listState: LazyListState,
|
||||
isLoading: Boolean,
|
||||
contentPadding: PaddingValues = PaddingValues(),
|
||||
@ -75,7 +77,7 @@ fun Content(
|
||||
modifier = modifier
|
||||
.padding(top = contentPadding.calculateTopPadding())
|
||||
.fillMaxSize()
|
||||
.verticalScroll(rememberScrollState())
|
||||
.verticalScroll(scrollState)
|
||||
|
||||
) {
|
||||
// Top bar height
|
||||
|
@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@ -16,6 +17,7 @@ import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@ -32,6 +34,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import me.ash.reader.R
|
||||
import me.ash.reader.infrastructure.preference.LocalPullToSwitchArticle
|
||||
import me.ash.reader.infrastructure.preference.LocalReadingAutoHideToolbar
|
||||
@ -167,8 +170,10 @@ fun ReadingPage(
|
||||
saver = LazyListState.Saver
|
||||
) { LazyListState() }
|
||||
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
showTopDivider = snapshotFlow {
|
||||
listState.firstVisibleItemIndex != 0
|
||||
scrollState.value != 0 || listState.firstVisibleItemIndex != 0
|
||||
}.collectAsStateValue(initial = false)
|
||||
|
||||
CompositionLocalProvider(
|
||||
@ -200,6 +205,7 @@ fun ReadingPage(
|
||||
link = link,
|
||||
publishedDate = publishedDate,
|
||||
isLoading = content is ReaderState.Loading,
|
||||
scrollState = scrollState,
|
||||
listState = listState,
|
||||
onImageClick = { imgUrl, altText ->
|
||||
currentImageData = ImageData(imgUrl, altText)
|
||||
|
Loading…
x
Reference in New Issue
Block a user