Stefano Rodriguez
11/03/2020, 9:18 AMWithConstraints
composable and a drawLayer
modifier with scaleX and scaleY, but it was much more cumbersome to achieve my expected result
https://api.flutter.dev/flutter/widgets/FittedBox-class.htmlAdam Powell
11/03/2020, 2:34 PMChristian
11/03/2020, 2:39 PMAdam Powell
11/03/2020, 2:42 PMfun Modifier.fittedBox(
// params
) = composed {
Modifier.layout {
to do the measurement and positioning chained together with a .drawLayer
after it to provide the scaling, and an optional clip before the layout if needed by the mode parameterremember { mutableStateOf(...) }
to share the computed scaling factor between the layout modifier and the drawLayer