English 中文(简体)
如何将html的档案放在海底和网络平台上,以冲碎?
原标题:how to view html files on the android and web platform in flutter?

I m creating a flutter project that can run on android & web platform. I m having problem with viewing html on web platform.

我在海底平台上使用了“金字眼”的原始网站概览,但这一原始图象并不支持网络平台。

import  package:webview_flutter/webview_flutter.dart ;

class HelpScreen extends StatefulWidget {
  const HelpScreen({super.key});

  @override
  HelpScreenState createState() {
    return HelpScreenState();
  }
}

class HelpScreenState extends State<HelpScreen> {
  WebViewController? _controller;

  @override
  Widget build(BuildContext? context) {
    // https://pub.dev/packages/webview_flutter
    _controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setBackgroundColor(const Color(0x00000000))
      ..setNavigationDelegate(
        NavigationDelegate(
          onProgress: (int progress) {
            // Update loading bar.
          },
          onPageStarted: (String url) {},
          onPageFinished: (String url) {},
          onWebResourceError: (WebResourceError error) {},
          onNavigationRequest: (NavigationRequest request) {
            return NavigationDecision.navigate;
          },
        ),
      )
      ..loadFlutterAsset("assets/Help.html");
    return Scaffold(
        appBar: AppBar(
          title: Text(
             help .tr,
            style: AppStyle.buildToolbarCommandTextStyle(),
          ),
          backgroundColor: AppStyle.logoGreen,
        ),
        body: WebViewWidget(controller: _controller!));
  }
}    
最佳回答
问题回答




相关问题
Flutter App cannot be installed on Android TV

I m building a Flutter app that should support Android TV and Mobile devices. Despite Google Play shows that it is supported, I cannot install app on my MiBox device. While trying to install it, both ...

Moving the icon button to the right causes rendering issues

I am trying to align the icon button to the right of the Text field, I tried the row which made the icon button not centered vertically and now I am trying out the Stack widget. Here is my code - ...

热门标签