i want to share image of my component , but cannot accses view of it, to share. how i can accses view of my component or share image of it. my component is a card
@Composable
fun CardItem(modifier: Modifier=Modifier,card: Card, onClick:()->Unit) {
Box(
modifier
.background(
if (card.card_number == AllCardsActivity.NOCARD) MaterialTheme.colorScheme.secondary
else MaterialTheme.colorScheme.primary,
RoundedCornerShape(20.dp)
)
.width(CardWidth)
) {
Column(Modifier.padding(25.dp)) {....
CodePudding user response:
i want to share image of my component
If you mean that you want to capture a Bitmap
of a composable for the purposes of sharing it, there are at least three libraries for this:
- https://github.com/PatilShreyas/Capturable
- https://github.com/KaustubhPatange/kapture
- https://github.com/SmartToolFactory/Compose-Screenshot
And all three are open source, so if you do not like them for some reason, you can examine their implementations, contribute back changes, etc.