Coder Social home page Coder Social logo

How to show a composable on a fixed position inside CollapsingToolbarScaffold regardless of toolbar state? about compose-collapsing-toolbar HOT 3 CLOSED

pesjak avatar pesjak commented on September 4, 2024 1
How to show a composable on a fixed position inside CollapsingToolbarScaffold regardless of toolbar state?

from compose-collapsing-toolbar.

Comments (3)

Nek-12 avatar Nek-12 commented on September 4, 2024 1

I have similar issue here. I want to use collapsing toolbar without CollapsingToolbarScaffold() because I'd like to use regular Scaffold() to have a bottom app bar placeholder. My problem can also be solved by having bottom app bar as a pinned component just like @pesjak described

from compose-collapsing-toolbar.

onebone avatar onebone commented on September 4, 2024 1

One possible workaround for your case is to offset the button manually according to the toolbar state.

Button(modifier = Modifier.offset { IntOffset(0, -state.offsetY) }) { ... }

I see this as a common use case, so I am planning to support such scenarios in the near future. Just as using CollapsingToolbarLayout in the Jetpack library, align() modifier will allow users to fix components in an arbitrary position in the layout.

// not possible right now, but will be available in the near future version
CollapsingToolbarScaffold(
	// ...
) {
	Button( // placed at the bottom center regardless of scroll state
		modifier = Modifier.align(Alignment.BottomCenter)
	)
}

from compose-collapsing-toolbar.

Nek-12 avatar Nek-12 commented on September 4, 2024

Also, I ended up using CollapsingToolbarScaffold + another Scaffold for everything else except toolbar. Works fine for my case explained above , and Google seems to have ended up using multiple scaffolds too in their projects.

from compose-collapsing-toolbar.

Related Issues (20)

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.