一直报错
[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/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9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EAksosIRyBQYWWPq5AgMLLP1cgYEFln6uwMACSz9XYGCBpZ8rMLDA0s8VGFhg6ecKDCyw9HMFBhZY+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),
),
);
}
}