Android Kaki

Build beautiful, usable products using required Components for Android.

Create invites with Jetpack Compose | by Caner Kaşeler | July 2023


import androidx.compose.basis.Canvas
import androidx.compose.basis.Picture
enter androidx.compose.basis.background
enter androidx.compose.basis.border
enter androidx.compose.basis.format.Association
enter androidx.compose.basis.format.Field
enter androidx.compose.basis.format.Column
enter androidx.compose.basis.format.Row
enter androidx.compose.basis.format.Spacer
enter androidx.compose.basis.format.fillMaxSize
enter androidx.compose.basis.format.fillMaxWidth
enter androidx.compose.basis.format.top
enter androidx.compose.basis.format.padding
enter androidx.compose.basis.format.dimension
import androidx.compose.basis.form.CircleShape
import androidx.compose.material3.Textual content
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
enter androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Coloration
import androidx.compose.ui.graphics.PathEffect
import androidx.compose.ui.format.ContentScale
import androidx.compose.ui.res.painterResource
enter androidx.compose.ui.textual content.TextStyle
enter androidx.compose.ui.textual content.font.FontFamily
enter androidx.compose.ui.textual content.font.FontWeight
enter androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
enter com.canerkaseler.threadscard.R
enter com.canerkaseler.threadscard.entity.Consumer

non-public val spaceBetweenItems = 28.dp
separate val framePadding = 24.dp

@Composable
Joyful CardFrontSide(
Consumer: Consumer
) {

// All the floor of the cardboard.
Field(
modifier = Modifier
.fillMaxSize()
.background(Coloration.White),
contentAlignment = Alignment.Heart,
) {

// The highest half circle is black.
CardBlackHalfCircles(modifier = Modifier.align(align = Alignment.TopCenter))

// Card content material.
Card content material(
date = consumer.date,
time = consumer.time,
instagram = customers.instagram,
userId = consumer.userId,
username = consumer.username,
userImage = consumer.userImage,
userQrCode = consumer.userQrCode,
)

// The underside black half circle.
CardBlackHalfCircles(modifier = Modifier.align(alignment = Alignment.BottomCenter))
}
}

@Composable
funCardBlackHalfCircles(
modifier: Modifier
) {
Oil paint(
modifier = modifier
.border (shade = Coloration.Magenta, width = 2.dp)
) {
drawCircle(
shade = Coloration.Black,
radius = 24.dp.toPx()
)
}
}

@Composable
enjoyable card content material(
date: String,
time: String,
instagram: Chain,
userId: String,
username: String,
userImage: Int,
userQrCode: Int,
) {
Column (
modifier = Modifier
) {

Spacer(modifier = Modifier.top(spaceBetweenItems))

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Type.SpaceBetween
) {

CardTitleText(title = “DATE”, data = date)

CardBrand(modifier = Modifier.align(alignment = Alignment.Backside))
}

Spacer(modifier = Modifier.top(spaceBetweenItems))

CardTitleText(title = “TIME”, data = time)

Spacer(modifier = Modifier.top(spaceBetweenItems))

CardTitleText(title = “USERNAME”, data = username)

Spacer(modifier = Modifier.top(spaceBetweenItems))

CardUserQrCode(userQrCode = userQrCode, modifier = Modifier.align(alignment = Alignment.Begin))

Spacer(modifier = Modifier.top(spaceBetweenItems))

CardDashDivider()

Spacer(modifier = Modifier.top(spaceBetweenItems))

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Type.SpaceBetween,
verticalAlignment = Alignment.CenterVertical
) {
Row (
verticalAlignment = Alignment.CenterVertical
) {

CardUserImage(userImage = userImage)

TagsInstagram(textual content = instagram)
}

CardUserId(textual content = userId)
}
}
}

@Composable
enjoyable CardTitleText(title: String, data: String) {
Column {
Letter(
modifier = Modifier.padding(
horizontal = framePadding
),
textual content = title,
shade = Coloration.Black,
fontWeight = FontWeight.ExtraBold,
fashion = TextStyle(
font dimension = 12.sp,
fontFamily = FontFamily.Monospace,
)
)

Letter(
modifier = Modifier.padding(
horizontal = framePadding
),
textual content = data,
shade = Coloration.Black,
fashion = TextStyle(
font dimension = 20.sp,
fontFamily = FontFamily.Monospace
)
)
}
}

@Composable
completely satisfied card model(
modifier: Modifier
) {
Picture(
modifier = modifier
.padding(
finish = framePadding
)
.dimension(dimension = 42.dp),
painter = painterResource (id = R.drawable.ic_threads_black),
content material description=””
)
}

@Composable
enjoyable CardDashDivider() {
Oil paint(
modifier
.fillMaxWidth()
.top(1.dp)) {
draw a line(
shade = Coloration.DarkGray,
begin = Offset (0f, 0f),
finish = Offset(dimension.width, 0f),
pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 14f), 0f)
)
}
}

@Composable
cheerfully CardUserQrCode(userQrCode: Int, modifier: Modifier) ​​{
Picture(
modifier = modifier
.padding(horizontal = framePadding)
.dimension(dimension = 56.dp),
painter = painterResource(id = userQrCode),
content material description=””
)
}

@Composable
cheerfully CardUserImage(userImage: Int) {
Picture(
modifier = Modifier
.padding(begin = framePadding)
.dimension(dimension = 42.dp)
.clip(Circle) ,
contentScale = ContentScale.Crop,
painter = painterResource(id = userImage),
contentDescription=””
)
}

@Composable
Joyful CardInstagram(textual content: String) {
Letter(
modifier = Modifier.padding(begin = 16.dp),
textual content = textual content,
shade = Coloration.Black,
fontWeight = FontWeight.SemiBold,
fashion = TextStyle(
font dimension = 12.sp,
fontFamily = FontFamily.Default,
letterSpacing = 0.7.sp,
)
)
}

@Composable
cheerfully CardUserId(textual content: String) {
Letter(
modifier = Modifier.padding(finish = framePadding),
textual content = textual content,
shade = Coloration.Black,
fontWeight = FontWeight.Gentle,
fashion = TextStyle(
font dimension = 14.sp,
fontFamily = FontFamily.Default,
letterSpacing = 1.sp,
)
)
}

@Composable
@Preview
enjoyable CardFrontSidePreview() {
The entrance of the cardboard (
Consumer(
username=”CANERKASELER”,
instagram = “canerkaseler”,
userId = “071030501”,
date = “Wednesday july 7”,
time = “03:24 pm”,
userImage = R.drawable.ic_user_avatar,
userQrCode = R.drawable.ic_qr_code,
)
)
}

John Wick: Chapter 4 (FREE) FULLMOVIE The Super Mario Bros Movie avatar 2 Where To Watch Creed 3 Free At Home Knock at the Cabin (2023) FullMovie Where To Watch Ant-Man 3 and the Wasp: Quantumania Cocaine Bear 2023 (FullMovie) Scream 6 Full Movie
Updated: July 18, 2023 — 8:50 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

androidkaki.com © 2023 Android kaki