Add LazyColumnWithScrollBar
This commit is contained in:
1 parent
dd95878ba7
commit
0299ca8b1f
3 files changed
+41
-2
No files matched your search
@@ -198,6 +198,7 @@ dependencies {
|
||||
implementation("com.drakeet.drawer:drawer:1.0.3")
|
||||
implementation("com.github.chrisbanes:PhotoView:2.3.0") // Dead Dependency
|
||||
implementation("com.github.tachiyomiorg:DirectionalViewPager:1.0.0") // Dead Dependency
|
||||
implementation("com.github.nanihadesuka:LazyColumnScrollbar:1.6.3")
|
||||
// https://github.com/google/accompanist/releases
|
||||
implementation("com.google.accompanist:accompanist-themeadapter-material3:0.30.1")
|
||||
implementation("com.google.android.material:material:1.9.0-rc01")
|
||||
|
||||
@@ -28,7 +28,6 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ClearAll
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
@@ -75,6 +74,7 @@ import com.hippo.ehviewer.ui.addToFavorites
|
||||
import com.hippo.ehviewer.ui.dialog.SelectItemWithIconAdapter
|
||||
import com.hippo.ehviewer.ui.removeFromFavorites
|
||||
import com.hippo.ehviewer.ui.widget.Deferred
|
||||
import com.hippo.ehviewer.ui.widget.LazyColumnWithScrollBar
|
||||
import com.hippo.ehviewer.ui.widget.ListInfoCard
|
||||
import com.hippo.ehviewer.ui.widget.setMD3Content
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
@@ -113,7 +113,7 @@ class HistoryScene : BaseScene() {
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
LazyColumn(
|
||||
LazyColumnWithScrollBar(
|
||||
contentPadding = paddingValues,
|
||||
) {
|
||||
items(
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.hippo.ehviewer.ui.widget
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import my.nanihadesuka.compose.InternalLazyColumnScrollbar
|
||||
|
||||
@Composable
|
||||
fun LazyColumnWithScrollBar(
|
||||
modifier: Modifier = Modifier,
|
||||
state: LazyListState = rememberLazyListState(),
|
||||
contentPadding: PaddingValues = PaddingValues(0.dp),
|
||||
content: LazyListScope.() -> Unit,
|
||||
) = Box(
|
||||
modifier = modifier,
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier,
|
||||
state = state,
|
||||
contentPadding = contentPadding,
|
||||
content = content,
|
||||
)
|
||||
Box(modifier = Modifier.padding(contentPadding)) {
|
||||
InternalLazyColumnScrollbar(
|
||||
listState = state,
|
||||
thumbColor = MaterialTheme.colorScheme.primary,
|
||||
thumbSelectedColor = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user