package com.example.hello import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) //enableEdgeToEdge() setContent { PreviewMessageCard() } } } data class Message(val author: String, val body: String) @Composable fun MessageCard(msg: Message){ Row { Image( painter = painterResource(R.drawable._0220224_075737), contentDescription = "kwiatek", modifier = Modifier .width(100.dp) // obrazek był za duży .padding(5.dp) ) Column (modifier = Modifier.padding(10.dp)){ Text(msg.author, color = Color.Blue, modifier = Modifier .background(Color.Yellow) ) Text(msg.body, fontSize = 30.sp, modifier = Modifier .padding(2.dp) .border(width = 2.dp, color = Color.Blue) .padding(2.dp) ) } } } @Preview @Composable fun PreviewMessageCard(){ MessageCard(Message("Marek", "Hello World")) }