Mikołaj Karwowski
02/09/2025, 6:24 PMButtonDefaults.MinWidth
From my experience it is a common scenario where the designs don't care about how it's done on our side
I don't feel like removing that minimum width/height as it is there for a reason
I can create a composable that takes in expected padding from text and calculates the real/remaining padding to apply to the button
Or straight up implement it using a Layout composable, but...
I feel like there should be an easier way to implement it, no?
Or is the best solution to force the designer to start taking our minimum button heights/widths and paddings into account when creating those designs?
The best I've found so far is to create a rectangle in Figma for example and match the centers of it with the center of the text, but then the margins become weird (6/23dp) and it smells like introducing own fantasy into layouts when we - as devs - are supposed to realize them 1:1 as they are given.Aditya Bhaskar
02/09/2025, 7:36 PMAditya Bhaskar
02/09/2025, 7:38 PMMikołaj Karwowski
02/09/2025, 9:27 PMMikołaj Karwowski
02/09/2025, 9:28 PMJonathan
02/09/2025, 11:39 PMText
in a Box
and either take the padding defined in Figma and apply it to the modifier passed to the parent Box
or many set the height specified in the design on the Box directly. Using a height modifier is my preferred choice if you want to make sure the bounds of the button matches Figma regardless of the text scaling. The clock listener should be added to the Box directly so that it's entire area (hitbox) is clickable; which is what a user would expect.