flutter webview加载本地文件出现跨域解决方案

一直报错

[INFO:CONSOLE(17)] "Access to image at 'file:///android_asset/flutter_assets/assets/jump/box_bottom.png' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https.", source: file:///android_asset/flutter_assets/assets/jump/index.html (17) 

flutter 的webview封装

下面的是加载本地html文件为网页展示

..loadFlutterAsset("assets/jump/index.html");

 但是打包后的网页内图片访问 就出上面的问题了

想要解决

将图片转换成dataUrl 替换进前端代码中去

在线转换生成DataURL\DataUri、图片转为DataURL\DataUri--查错网

去掉file-loader 

const box_bottom =
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbwAAAAyBAMAAADVU3PwAAAAMFBMVEVerGr+bmH/xgD///9osXL/dmr/ySXo8+n/6uf/9+H/2XCUx5r/n5aTx5n/nZX/ySDNqwUbAAABPklEQVRo3u3arUoFURTF8Q1OE8NBponhCDdY/FjqvdcvBgwG02AxmKZp1WYUm00wGBUEm6BgFhGMgk8gPoIv4OQ565ziLfew/nHDCr++DVkn3jhnwE3ju/UeAAzvfdDxFeIDXNauW/kBYPDugg7PEwOcVdateAHQf7agvZP4wDBsfFivZVx70hHig0HtwsqWceFIB4lBv7KwomWcGmk3PjCse9YdcMvu84gPNh3rDXhl95nEYMNYT8CjkSbjA8OaZ/0CDbsvID5Ydax9oGb3MjFYMdYOUBmpiA8My541B3ga4oMlx5oGHC0xWDTWBGC06EA88cQTTzzxxBNPPPHEE0888cQTTzzxxBNPPPHEE0888cQTTzzx/s3L/3VgdI8f2471A3yz+2xisGWsL+DTSFPRQf5vO5k/XWWdeOPcH7PNWv+r2q/BAAAAAElFTkSuQmCC";

const box_middle =
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbwAAAAyCAYAAAAnfW7DAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44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xbJ7OGQxON60lsIQCSyiwhAJLKLCEAksosIRyBQYWWPq5AgMLLP1cgYEFln6uwMACSz9XYGCBpZ8rMLDA0s8VGFhg6ecKDCyw9HMFBhZY+rkCA0sJy5FMYAkFllBgCQXWX/buoAgAGIhBYCb+RVdCv1yGtYAADjHWIcY6xFiHGOsrHJWxdoSjMtaOcFTG2hGOylg7wlEZa0c4KmPtCEdlrB3hqIy1IxyVsXaEozLWjnBUxtoRjspYO8JRGWtHOCpj7QhHZawd4aiMtSMclbF2hKMy1o5wVMbaEY7KWDvCURlrRzgqY+0IR2WsHeGojLUjHJWxdoSjMtaOcFTG2hGOylg7wlEZa0c4KmPtCEdlrB3hqIy1IxyVsXaEo2CMwX04Hjt1jOswCERRNNB4F8j7X+X/U6AYKenyYqScW42h42jcd6otH+MYfYMe+9Q3ahx9VlTVBsv12Kf+3cb71y+e8zJXl5N+T7+MVa//uvO5Sa3mWfHWbb+n38ZauNq6SnVXMGtnncC6Aasak+j8n3vVjtncqjVYd2HNf1sbc1yAYG2GVUbjMsHaGmsJFqxPBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAsWrESwYMFKBAvW30YjixZgMEUWAJ/J/UQDNhRSAAAAAElFTkSuQmCC";

export { box_bottom, box_middle, box_top, Dot, express };

使用

import { express } from "../res/dataUrl";

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

import 'package:webview_flutter/webview_flutter.dart';

enum GameStatus {
  ready,
  start,
  stop,
}

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

  @override
  State<JumpGame> createState() => _LocalViewState();
}

class _LocalViewState extends State<JumpGame> {
  late WebViewController controller;

  GameStatus curStatus = GameStatus.ready;

  @override
  void initState() {
    super.initState();
    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) {},
        ),
      )
      ..addJavaScriptChannel('App', onMessageReceived: onMessageReceived)
      ..loadFlutterAsset("assets/jump/index.html");
  }

  void onMessageReceived(JavaScriptMessage message) async {
    final messageJson = json.decode(message.message);
    print(messageJson);
    final messageMethod = messageJson["method"];
    final messageData = messageJson["data"] ?? {};
    switch (messageMethod) {
      case "start":
        show(
          Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Text("开始"),
              ElevatedButton(
                  onPressed: () {
                    SmartDialog.dismiss();
                  },
                  child: Text("开始"))
            ],
          ),
        );
        break;
      case 'jumpSuccess':
        // await Future.delayed(const Duration(milliseconds: 500));

        show(
          Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                ElevatedButton(
                  style:
                      ElevatedButton.styleFrom(backgroundColor: Colors.orange),
                  onPressed: () {
                    SmartDialog.dismiss();
                  },
                  child: Text("继续"),
                ),
              ],
            ),
          ),
        );

        break;
      case 'gameOver':
        // await Future.delayed(const Duration(milliseconds: 500));
        // Get.bottomSheet(
        //   isScrollControlled: true,
        //   ignoreSafeArea: true,
        //   isDismissible: false,
        //   backgroundColor: Colors.transparent,
        //   enableDrag: false,
        //   Container(
        //     height: 1.sh,
        //     width: double.infinity,
        //     color: Colors.red,
        //     child:
        //   ),
        // );

        show(Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              ElevatedButton(
                style: ElevatedButton.styleFrom(backgroundColor: Colors.orange),
                onPressed: () {
                  SmartDialog.dismiss();
                  controller.reload();
                },
                child: Text("重新开始"),
              ),
            ],
          ),
        ));

        break;
    }
    // ScaffoldMessenger.of(context).showSnackBar(
    //   SnackBar(content: Text(message.message)),
    // );
  }

  void show(Widget child) {
    SmartDialog.show(builder: (context) {
      return Container(
        height: 1.sh,
        width: 1.sw,
        color: Colors.black26,
        alignment: Alignment.center,
        child: child,
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      top: false,
      bottom: false,
      child: Scaffold(
        appBar: AppBar(
          title: const Text(
            '跳一跳',
            style: TextStyle(color: Color(0xff333333)),
          ),
        ),
        body: WebViewWidget(controller: controller),
      ),
    );
  }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/637080.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

留学服务平台应用架构的设计与优化

随着全球化进程的加速和人们对国际化教育的需求不断增长&#xff0c;留学服务平台在满足学生留学需求的同时也面临着诸多挑战。在这样的背景下&#xff0c;设计一个高效、稳定且安全可靠的留学服务平台应用架构显得尤为重要。本文将就留学服务平台应用架构的设计与优化进行探讨…

JKTECH柔性振动盘用途

柔性振动盘的作用与用途 在现代工业自动化领域&#xff0c;柔性振动盘凭借其独特的功能和广泛的应用场景&#xff0c;正逐渐成为生产线上的重要工具。柔性振动盘&#xff0c;又称柔性供料器&#xff0c;它结合了传统振动盘的高效性和现代自动化技术的灵活性&#xff0c;为各种…

vulhub——Aria2、bash、catic

文章目录 一、Aria2 任意文件写入漏洞二、CVE-2014-6271&#xff08;Bash Shell 漏洞&#xff09;三、CVE-2022-46169&#xff08;Cacti 前台命令注入漏洞&#xff09; 一、Aria2 任意文件写入漏洞 Aria2是一个命令行下轻量级、多协议、多来源的下载工具&#xff08;支持 HTTP…

【MySQL精通之路】InnoDB(10)-行格式

目录 1.表数据结构 1.1 聚集索引数据结构 1.2 辅助索引数据结构 2.行格式 2.1 REDUNDANT行格式 2.2 REDUNDANT存储特性 2.3 COMPACT行格式 2.4 COMPACT存储特性 2.5 DYNAMIC行格式 2.6 DYNAMIC存储特性 2.7 COMPRESSED行格式 2.8 COMPRESSED存储特性 3.定义表格的…

我怎么使用AI大语言模型学英语

今天已经是我开始英语拉练任务的第39天了&#xff0c;一直在笃定的、雷打不动的、机械笨拙的重复做一件事&#xff0c;那就是使用AI工具&#xff0c;将我想要说的话翻译成英文&#xff0c;生成语音文件&#xff0c;每天朗读三小时&#xff0c;最终整个背下来。我也在思考&#…

【人工智能】数据分析与机器学习——泰坦尼克号(更新中)

1912年4月15日&#xff0c;泰坦尼克号在首次航行期间撞上冰山后沉没&#xff0c;船上共有2224名乘客和乘务人员&#xff0c;最终有1502人遇难。沉船导致大量伤亡的重要原因之一是&#xff0c;没有足够的救生艇给乘客和船员。虽然从这样的悲剧性事故中幸存下来有一定的运气因素&…

Aware接口作用

介绍 Aware&#xff08;感知&#xff09;接口是一个标记&#xff0c;里面没有任何方法,实际方法定义都是子接口确定&#xff08;相当于定义了一套规则&#xff0c;并建议子接口中应该只有一个无返回值的方法&#xff09;。 我们知道spring已经定义好了很多对象&#xff0c;如…

半导体测试基础 - 基本概念

随着芯片集成度越来越高&#xff0c;手动测试已无法满足需求&#xff0c;因此要用到自动化测试设备&#xff08;ATE&#xff0c;Automated Test Equipment&#xff09;。因为现在的芯片原来越复杂&#xff0c;普通的 Bench 测试没法满足需求。ATE 可检测集成电路功能之完整性&a…

Joomla 3.7.0 (CVE-2017-8917) SQL注入漏洞环境

1 漏洞概述 Joomla是一个基于PHP的内容管理系统&#xff08;CMS&#xff09;&#xff0c;广泛应用于各类网站。2017年&#xff0c;Joomla 3.7.0版本被发现存在SQL注入漏洞&#xff08;CVE-2017-8917&#xff09;&#xff0c;攻击者可以利用该漏洞对数据库进行未授权查询或操作…

Centos 7.9 使用 iso 搭建本地 YUM 源

Centos 7.9 使用 iso 搭建本地 YUM 源 1 建立挂载点 [rootlocalhost ~]# mkdir -p /media/cdrom/ 2 创建光盘存储路径 [rootlocalhost ~]# mkdir -p /mnt/cdrom/ 3 上传 CentOS-7-x86_64-Everything-2207-02.iso 到 光盘存储路径 [rootlocalhost ~]# ls /mnt/cdrom/ CentOS-…

基于机器学习模型预测信用卡潜在用户(XGBoost、LightGBM和Random Forest)

基于机器学习模型预测信用卡潜在用户&#xff08;XGBoost、LightGBM和Random Forest&#xff09; 随着数据科学和机器学习的发展&#xff0c;越来越多的企业开始利用这些技术来提高运营效率。在这篇博客中&#xff0c;我将分享如何利用机器学习模型来预测信用卡的潜在客户。此…

如何设计足够可靠的分布式缓存体系,以满足大中型移动互联网系统的需要?no.31

传统 CAP 的突破 随着分布式系统的不断演进&#xff0c;会不断遇到各种问题&#xff0c;特别是当前&#xff0c;在大中型互联网系统的演进中&#xff0c;私有云、公有云并行发展且相互融合&#xff0c;互联网系统的部署早已突破单个区域&#xff0c;系统拓扑走向全国乃至全球的…

[深度学习]基于yolov8+bytetrack+pyqt5实现车辆进出流量统计+车辆实时测速实现

以前使用过yolov5deepsort实现过车辆进出流量统计车辆实时测速&#xff0c;可以看我往期视频&#xff0c;这回改成yolov8bytetrack实现&#xff0c;实时性更好&#xff0c;原理和原来一样。车流量进出统计车速测量优点&#xff1a; 使用目标检测算法考虑bbox抖动&#xff0c;解…

利用Python去除PDF水印

摘要 本文介绍了如何使用 Python 中的 PyMuPDF 和 OpenCV 库来从 PDF 文件中移除水印&#xff0c;并将每个页面保存为图像文件的方法。我们将深入探讨代码背后的工作原理&#xff0c;并提供一个简单的使用示例。 导言 简介&#xff1a;水印在许多 PDF 文件中都很常见&#x…

Spark项目实训(一)

目录 实验任务一&#xff1a;计算级数 idea步骤分步&#xff1a; 完整代码&#xff1a; linux步骤分布&#xff1a; 实验任务二&#xff1a;统计学生成绩 idea步骤分布&#xff1a; 完整代码&#xff1a; linux步骤分步&#xff1a; 实验任务一&#xff1a;计算级数 请…

【Linux001】centos常用命令总结总结(已更新)

1.熟悉、梳理、总结下centos知识体系。 2.Linux相关知识&#xff0c;在日常开发中必不可少&#xff0c;如一些必知必会的常用命令&#xff0c;如环境搭建、应用部署等。同时&#xff0c;也要谨慎使用一些命令&#xff0c;如rm -rf&#xff0c;防止一些生产事故的发生。 3.欢迎点…

洗衣行业在线预约小程序源码系统 在线下单+上门取件+订单状态跟踪 带网站的源代码包以及搭建部署教程

开发背景 在现代社会&#xff0c;人们越来越注重时间的利用和生活的便捷性。传统的洗衣服务模式往往需要消费者亲自将衣物送到洗衣店&#xff0c;然后再等待取衣&#xff0c;整个过程既耗时又不方便。此外&#xff0c;随着移动互联网的普及&#xff0c;人们更习惯于通过手机应…

Soybean Admin:一款高效、现代化的后台管理模板探索

随着前端技术的快速发展&#xff0c;越来越多的开发者开始寻求使用最新技术栈来构建高效、用户友好的后台管理系统。Soybean Admin作为一款基于Vue3、Vite5、TypeScript、Pinia、NaiveUI和UnoCSS等前沿技术的后台管理模板&#xff0c;为我们提供了一个全新的解决方案。本文将深…

List、IList、ArrayList 和 Dictionary

List 类型: 泛型类命名空间: System.Collections.Generic作用: List<T> 表示一个强类型的对象列表&#xff0c;可以通过索引访问。提供了搜索、排序和操作列表的方法。特点: 类型安全&#xff0c;性能较好&#xff0c;适用于需要强类型和高效操作的场景。例子: List<…

数字人系统OEM源码及赚钱方式详解!

当前&#xff0c;数字人直播的热度持续上涨&#xff0c;应用场景日益丰富。而随着数字人直播所蕴含的前景和潜力被不断挖掘一批又一批的创业者纷纷开始入局分羹。其中&#xff0c;数字人系统OEM源码模式作为最为常见的入局方式之一&#xff0c;更是备受瞩目。 所谓数字人系统O…