Assets
Setup your app icon, fonts and images.
Icons
tip
You can use the Icon Kitchen App to generate all the necessary icon sizes for your apps.
- In Android Studio, you'll need to replace the
mipmapfolder files inandroidApp/src/main/reswith your icons. If you used Icon Kitchen, you can replace allmipmapfolders with the ones in the generated zip. - In Xcode, select the
Assets.xcassetsfile and replace each icon with the corresponding one from from your assets or the Icon Kitchen zip file.
Fonts
tip
You can use the Google Fonts to find and download custom fonts.
- Add your custom fonts in .ttf format to the
shared/src/commonMain/composeResources/fontdirectory. - Go to
shared/src/commonMain/kotlin/com/zenithapps/mobilestack/ui/style/Typography.ktand add your font to theFontFamilyobject with the corresponding weight.
@Composable
private fun getFontFamily() = FontFamily(
Font(resource = Res.font.[YOUR_FONT_NAME], weight = FontWeight.Normal),
Font(resource = Res.font.[YOUR_FONT_NAME], weight = FontWeight.Bold)
)
Images
- Add your images to the
shared/src/commonMain/composeResources/drawabledirectory. - Use the
painterResourcefunction to load the image in your composable.
Image(
painter = painterResource(Res.drawable.[YOUR_IMAGE_NAME]),
contentDescription = "[YOUR_IMAGE_DESCRIPTION]"
)
tip
The easiest way to import images and svgs is to use the Resource Manager in Android Studio. Make sure you move them to composeResources/drawable after you import them.