Skip to content

Instantly share code, notes, and snippets.

View Starchild13's full-sized avatar
💭
I may be slow to respond.

Starchild Starchild13

💭
I may be slow to respond.
View GitHub Profile
@Composable
fun AnImage(name: String,role:String) {
val image = painterResource(R.drawable.android_logo)
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.background(Color.Black)
) {
Image(
Spacer(modifier = Modifier.height(height = 15.dp))
@Composable
fun icon_card_2(text: String, imagevector: ImageVector){
Row( modifier = Modifier.padding(top = 8.dp,bottom = 8.dp).fillMaxWidth(0.6f)) {
Icon(
imageVector = imagevector,
modifier = Modifier.size(size = 20.dp),
contentDescription = "Email Address",
tint = Color.Green
)
@Composable
fun icon_column(){
Column (horizontalAlignment=Alignment.CenterHorizontally,modifier = Modifier.wrapContentWidth()){
Divider(color = Color.Gray , modifier = Modifier.fillMaxWidth())
icon_card_2("+27 81 5316830", Icons.Filled.Phone)
Divider(color = Color.Gray , modifier = Modifier.fillMaxWidth())
icon_card_2("@JustJessZA", Icons.Filled.Share)
Divider(color = Color.Gray , modifier = Modifier.fillMaxWidth())
icon_card_2("jess1998mat@gmail.com",Icons.Filled.Email)
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
)
// Annotation to use experimental API for Foundation layout
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun GridExample() {
// Creating a LazyVerticalStaggeredGrid with fixed 3 columns
LazyVerticalStaggeredGrid(
columns = StaggeredGridCells.Fixed(3),
modifier = Modifier.padding(8.dp) // Adding padding around the entire grid
) {
// Iterating over items returned by getItems() function
// Annotation to use experimental API for Material3 components
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ChipItem(text: String, selected: MutableState<String>) {
// Defining a FilterChip composable
FilterChip(
modifier = Modifier.padding(end = 16.dp), // Adding padding to the end of the chip
selected = selected.value === text, // Chip is selected if its text matches the selected value
onClick = { selected.value = text }, // On click, set the chip's text as the selected value
label = { Text(text) } // Displaying the given text on the chip