Coder Social home page Coder Social logo

Comments (3)

hmy65 avatar hmy65 commented on June 15, 2024

Done. For anyone who does not want import constraintlayout-compose, cuz this dependency increases roughly ~110kb to the release build.

BoxWithConstraints(
    modifier = modifier
        .fillMaxWidth()
) {
    val maxHeightFloat = constraints.maxHeight.toFloat()
    Row(
        modifier = Modifier
            .align(if (rightSide) Alignment.TopEnd else Alignment.TopStart)
            .graphicsLayer(
                translationX = with(LocalDensity.current) { (if (rightSide) displacement.dp else -displacement.dp).toPx() },
                translationY = maxHeightFloat * normalizedOffsetPosition
            )
    ) {

// val (box, content) = createRefs()

        //  if (indicatorContent != null) {
        Box(
            modifier = Modifier
                .alpha(alpha)

// .constrainAs(content) {
// top.linkTo(box.top)
// bottom.linkTo(box.bottom)
// if (rightSide) end.linkTo(box.start)
// else start.linkTo(box.end)
// }
.testTag(TestTagsScrollbar.scrollbarIndicator),
) {
//indicatorContent(firstVisibleItemIndex.value, isSelected)
Text(text = firstVisibleItemIndex.value.toString())
}
// }

        Box(
            modifier = Modifier

// .align(if (rightSide) Alignment.TopEnd else Alignment.TopStart)
// .graphicsLayer(
// translationX = with(LocalDensity.current) { (if (rightSide) displacement.dp else -displacement.dp).toPx() },
// translationY = maxHeightFloat * normalizedOffsetPosition
// )
.padding(
start = if (rightSide) 0.dp else padding,
end = if (!rightSide) 0.dp else padding,
)
.clip(thumbShape)
.width(thickness)
.fillMaxHeight(normalizedThumbSize)
.alpha(alpha)
.background(if (isSelected) thumbSelectedColor else thumbColor)
// .constrainAs(box) {
// if (rightSide) end.linkTo(parent.end)
// else start.linkTo(parent.start)
// }
.testTag(TestTagsScrollbar.scrollbar)
)

    }

from lazycolumnscrollbar.

nanihadesuka avatar nanihadesuka commented on June 15, 2024

Will check out

from lazycolumnscrollbar.

nanihadesuka avatar nanihadesuka commented on June 15, 2024

The code you provided removes functionality and is a regression. For know I will keep the ConstraintLayout as I don't want to reinvent the functionality it provides for this case.

In case you provide a full working PR without ConstraintLayout I will merge.

from lazycolumnscrollbar.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.