updateTheme method
Implementation
Future<void> updateTheme({required EpubTheme theme}) async {
checkEpubLoaded();
String? foregroundColor = theme.foregroundColor?.toHex();
String? backgroundColor;
final bgDecoration = theme.backgroundDecoration;
if (bgDecoration is BoxDecoration && bgDecoration.color != null) {
backgroundColor = bgDecoration.color!.toHex();
}
final customCss = theme.customCss;
await webViewController?.callAsyncJavaScript(
functionBody: 'updateTheme(backgroundColor, foregroundColor, customCss)',
arguments: {
'backgroundColor': backgroundColor,
'foregroundColor': foregroundColor,
'customCss': customCss,
},
);
}