如何定制TradingView.widget在Flutter InAppWebView?



我想自定义我的TradingView图表小部件,这是在一个InAppWebView小部件。我可以显示图表,但是,我想更改图表小部件的背景颜色、字体和价格滚动条的类型。我该怎么做呢?有什么文件吗?我在stackoverflow上搜索了很多,但任何推荐都不起作用。我想让图表类似于binance的图表。

感谢所有的回复!:)

String _testCode() {
return """
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">  
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget(
{
"autosize": true,
"symbol": "AAPL",
"interval": "D",
"timezone": "exchange",
"theme": "dark",
"style": "1",
"toolbar_bg": "#ff7518", <!-- Does Not Work-->
"hide_side_toolbar": false,
"allow_symbol_change": true,
"save_image": false,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650",
"locale": "en",
"overrides": {  <!-- Does Not Work-->
"paneProperties.background": "#ffffff",
},
}
);
</script>
</div>
<!-- TradingView Widget END -->
""";
}
@override
Widget build(BuildContext context) {
return InAppWebView(
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
transparentBackground: true,
javaScriptEnabled: true,
),
ios: IOSInAppWebViewOptions(
disallowOverScroll: true,
),
),
onWebViewCreated: (InAppWebViewController controller) async {
controller.loadUrl(
urlRequest: URLRequest(
url: Uri.dataFromString(
//_generateCode(binanceSymbol),
_testCode(),
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'),
),
),
);
},
);
}

try

String _testCode() {
return """
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">  
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"autosize": true,
"symbol": "AAPL",
"interval": "D",
"timezone": "exchange",
"theme": "dark",
"style": "1",
"toolbar_bg": "#ff7518",
"hide_side_toolbar": false,
"allow_symbol_change": true,
"save_image": false,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650",
"locale": "en",
"overrides": {
"paneProperties.background": "#ffffff",
}
});
</script>
</div>
<!-- TradingView Widget END -->
""";
}

相关内容

  • 没有找到相关文章

最新更新