The ASAP SDK allows you to customize the UI of the help widget as required.
Predefined themes
The SDK UI comes with two predefined themes: light and dark.
Android
Setting up a theme type
You can customize the theme type in the SDK help widget using the below code:
import
'package:zohodesk_portal_configuration/zohodesk_portal_configuration.dart'
show ZohodeskPortalConfiguration;
import 'package:zohodesk_portal_configuration/data/configuration_model.dart';
ZohodeskPortalConfiguration.setTheme(ZDPTheme.system);
ZDPTheme.system: By default, the system theme is selected. If you want to change the theme to light/dark mode, use the following methods:
• ZDPTheme.light: Changes the SDK help widget theme to light irrespective of the system settings.
• ZDPTheme.dark: Changes the SDK help widget theme to dark regardless of the system settings.
Code is standard for both iOS and Android platforms.
Customized colors in the particular theme
Android
To customize the colours of the particular theme, follow the below steps:
Step 1: To customize a particular colour, include the following method in the Android project folder Application class:
- ZDPTheme theme = new ZDPTheme.Builder(true)
.setColorPrimary(Color.parseColor(colorString))
.setColorAccent(Color.parseColor(colorString))
.build();
ZDPortalConfiguration.setThemeBuilder(theme);
Step 2: As instructed in setting up a theme type, configure the theme type (dark or light) to reflect the customized colour within the application.
iOS
You can override the default dark and light theme in the SDK help widget.
To update the default light theme, include the following method:
- ZDPThemeManager.updateLightTheme(theme: <#ZDPThemeProtocol#>)
To update the default dark theme, include the following method:
ZDPThemeManager.updateDarkTheme(theme: <#ZDPThemeProtocol#>)
Here, ZDPThemeProtocol contains the list of properties representing the most used colours across the SDK, such as primaryTextColor and navigationBarTextColor. All properties in the protocol are optional. You can create any class conforming to this protocol, implement one or more properties, and pass an object of that class to the updateLightTheme or updateDarkTheme method. The colours you set in the class will override the default theme.
Setting up a theme involves choosing a predefined theme. The SDK's theme can be customized, but its overall appearance will always be either dark or light, depending on your chosen theme.