Adrián Lázaro
07/21/2023, 11:57 AMinterface SampleInterface {
fun modifier(param1, params...): Modifier
}
The function is showing a warning: "Modifier factory functions should be extensions on Modifier". If the function was a normal extension function over Modifier this was not a problem, but it's a function of an interface, so you do know how I can avoid this warning?
All implementatios of the interface, starts from the original Modifier and adds some params.Jorn Hertsig
07/21/2023, 12:02 PMinterface Sample {
fun Modifier.something(param1: Type): Modifier
}
Adrián Lázaro
07/21/2023, 12:14 PMJorn Hertsig
07/21/2023, 12:17 PMBoxScope
has Modifier methods as well, for example Modifier.align
.Adrián Lázaro
07/21/2023, 12:22 PMJorn Hertsig
07/21/2023, 12:23 PMwith(mySample) { Modifier.something(...) }
Stylianos Gakis
07/21/2023, 12:23 PMwith(YourSampleImplementation) {
Modifier.something()
}
You need to have your Sample interface in the context, same with how BoxScope is in the context when you’re inside the Box composable lambdaStylianos Gakis
07/21/2023, 12:24 PMthen
Modifier.fillMaxSize().then(with(mySample) { Modifier.something(...) })
Adrián Lázaro
07/21/2023, 12:30 PMephemient
07/21/2023, 12:35 PMwith(mySample) {
Modifier
.fillMaxSize()
.something()