Android Frame customisation

Create theme

Android theme resource file must be created inside application's android resources folder, e.x., your_app/android/app/src/main/res/values/themes.xml.

Theme must set parent Theme.Kevin.Base.

<?xml version="1.0" encoding="utf-8"?>

    <!-- Customise general properties -->
    <style name="CustomTheme" parent="Theme.Kevin.Base">
        <item name="colorPrimary">#5d80fe</item>
        <item name="colorPrimaryVariant">#0b1e42</item>
        <item name="colorOnPrimary">#ffffff</item>

Detailed theme attributes' information can be found here.

When using code shrinking for release builds, drawables, which are referenced in a theme/styles, should be added to your_app/android/app/src/main/res/raw/keep.xml file like that:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools=""
    tools:keep="@drawable/kevin_ic_toolbar_arrow_back" />

Set theme

When theme resource is created, theme must be set inside application's main() method. KevinThemeAndroid() object must contain theme's name as string.

Future<void> main() async {
  const androidTheme = KevinThemeAndroid('CustomTheme');

  await Kevin.setTheme(
    androidTheme: androidTheme,

Last updated