This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Image( | |
painter = painterResource(id = R.drawable.cake), contentDescription = "", | |
contentScale = ContentScale.Crop, | |
modifier = Modifier | |
.layoutId("headerImage") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val context = LocalContext.current | |
val motionScene = remember { | |
context.resources | |
.openRawResource(R.raw.motion_scene) | |
.readBytes() | |
.decodeToString() | |
} | |
MotionLayout( | |
motionScene = MotionScene(content = motionScene), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val context = LocalContext.current | |
val motionScene = remember { | |
context.resources | |
.openRawResource(R.raw.motion_scene) | |
.readBytes() | |
.decodeToString() | |
} | |
MotionLayout( | |
motionScene = MotionScene(content = motionScene), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
ConstraintSets: { | |
start: { | |
.... | |
}, | |
end: { | |
.... | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val motionState = rememberMotionLayoutState() | |
MotionLayout( | |
motionScene = /* our motion scene json */, | |
motionLayoutState = motionState, | |
modifier = Modifier | |
.fillMaxSize() | |
.background(LightGray) | |
) { ... } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colors.background | |
) { | |
RecipeDetail() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation "androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha03" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onBackPressed() { | |
engine.navigationChannel.popRoute() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onResume() { | |
super.onResume() | |
engine.lifecycleChannel.appIsResumed() | |
} | |
override fun onPause() { | |
super.onPause() | |
engine.lifecycleChannel.appIsPaused() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onDestroy() { | |
super.onDestroy() | |
detachFlutterView() | |
} | |
private fun detachFlutterView() { | |
engine.activityControlSurface.detachFromActivity() | |
engine.lifecycleChannel.appIsDetached() | |
binding.flutterView.detachFromFlutterEngine() | |
} |