Release Notes
Announcements
Light + Default Color | Light + Orange | Dark + Default Color | Dark + Green Theme |
![]() | ![]() | ![]() | ![]() |
ThemeState API.Method | Parameter | Return Value | Description |
setThemeMode | ThemeType | void | Sets the theme mode, saves the setting, and refreshes the UI. ThemeType.SYSTEM: Follows system settings.ThemeType.LIGHT: Enables light mode.ThemeType.DARK: Enables dark mode. |
Method | Parameter | Return Value | Description |
setPrimaryColor | String | Unit | Sets the primary theme color using a Hex string (e.g., "#1C66E5"). |
clearPrimaryColor | None | Unit | Removes the custom theme color and resets to the default blue. |
setThemeMode and setPrimaryColor automatically persist the configuration. No manual save is required. Settings are restored on app startup.Property | Type | Description |
currentMode | ThemeType | The current theme mode. |
currentPrimaryColor | String? | The current primary theme color (Hex value). |
hasCustomPrimaryColor | Boolean | Indicates if a custom primary color is set. |
isDarkMode | Boolean | Indicates if dark mode is active. |
ComponentTheme and configure MaterialApp as shown below. For implementation details, see the demo:@overrideWidget build(BuildContext context) {return ComponentTheme(child: MultiProvider(providers: [ChangeNotifierProvider.value(value: LocaleProvider()),],child: Builder(builder: (context) {final themeState = BaseThemeProvider.of(context);final isDarkMode = themeState.isDarkMode;// ...... other configuration omittedreturn MaterialApp(themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light,// ...... other configuration omitted);}),),);


appConfig.json. Configuration items map directly to fields in AppBuilder. Appearance settings are located under the theme section:{"theme": {"mode": "light", // Theme mode: "light" for Light Mode, "dark" for Dark Mode, "system" to follow device settings"primaryColor": "#E65100" // Primary color in Hex format},"messageList": {"alignment": "two-sided","enableReadReceipt": false,"messageActionList": ["copy","recall","quote","forward","delete"]},"conversationList": {"enableCreateConversation": true,"conversationActionList": ["delete","mute","pin","markUnread"]},"messageInput": {"hideSendButton": false,"attachmentPickerMode": "collapsed"},"search": {"hideSearch": false},"avatar": {"shape": "circular"}}
Parameter | Type | Options | Description |
mode | String | "system", "light", "dark" | Theme mode |
primaryColor | String | Hex value, e.g., "#0ABF77" | Primary theme color |

assets:- assets/
class _MyAppState extends State<MyApp> {bool _isInitialized = false;@overridevoid initState() {super.initState();_initializeApp();}Future<void> _initializeApp() async {await StorageUtil.init();await AppBuilder.init(configPath: 'packages/uikit_next/assets/appConfig.json');if (mounted) {setState(() {_isInitialized = true;});}}}
setThemeMode API. Example:val themeState = ThemeState.sharedColumn {Button(onClick = {themeState.setThemeMode(ThemeMode.SYSTEM)}) { Text(text = "Follow System") }Button(onClick = {themeState.setThemeMode(ThemeMode.LIGHT)}) { Text(text = "Light Mode") }Button(onClick = {themeState.setThemeMode(ThemeMode.DARK)}) { Text(text = "Dark Mode") }}
setPrimaryColor API. Provide a Hex color value, and TUIKit Flutter will automatically generate a full palette for UI components. No manual color adaptation is required.final themeState = BaseThemeProvider.of(context);themeState.setPrimaryColor('#1C66E5');
themeState.colors throughout your app to maintain a consistent look when switching themes.if (themeState.isDarkMode) {// Currently in dark mode} else {// Currently in light mode}
themeState.clearPrimaryColor() // Removes custom theme colorthemeState.setThemeMode(ThemeType.SYSTEM) // Switches to system default mode
final themeState = BaseThemeProvider.of(context);final config = themeState.currentTheme;print("Mode: ${config.type}");print("Primary color: ${config.primaryColor ?? "Default"}");
themeState.setThemeMode(ThemeType.DARK)themeState.setPrimaryColor("#0ABF77")
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback