当我使用该函数将数据添加到数据库时,并且在我添加的服务器上Access-Control-Allow-Origin,它不会被 CORS 阻止,但是当我查看浏览器控制台工具选项卡控制台时仍然出错
Access to XMLHttpRequest at 'https://int.goo.id/api/pg/sso.register' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)
如何停用 CORS?
如何在 Flutter Web 中隐藏密钥和其他私人信息web/index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<script src="main.dart.js" type="application/javascript"></script>
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#config-web-app -->
<script src="https://www.gstatic.com/firebasejs//6.3.3/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-storage.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-functions.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "API_KEY",
authDomain: "authDomain.firebaseapp.com",
databaseURL: "databaseURL.firebaseio.com",
projectId: "fir-projectId",
storageBucket: "storageBucket.appspot.com",
messagingSenderId: "123456789",
appId: "1:123456789:web:123456789"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我们可以在 Flutter Web 应用程序中实现 Firebase Analytics 吗?如果没有,还有其他选择吗?
在 Flutter 应用程序version中,pubspec.yaml文件中有一个属性来指定应用程序版本。
在为 Web 构建时是否可以从 dart 代码访问此值?
我在flutter web中创建了一个登录表单,当我登录时,chrome检测到输入的密码,但只提供保存密码,而用户名保持空白。
Google 建议使用以下 HTML 表单,以便凭证管理器可以检测需要存储的凭证。
<form id="signup" method="post">
<input name="email" type="text" autocomplete="username email">
<input name="display-name" type="text" autocomplete="name">
<input name="password" type="password" autocomplete="new-password">
<input type="submit" value="Sign Up!">
</form>
Run Code Online (Sandbox Code Playgroud)
在我的表单中,我同时使用了电子邮件和用户名,但 chrome 凭据管理器仍然无法检测到用户名。
我们如何在flutter web中创建带有自动完成标签的表单?
问题: 当我在浏览器中将 Flutter 应用程序作为 Web 应用程序运行时,我可以使用浏览器的文本搜索功能 Ctrl + F 来搜索页面上的文本。搜索功能会查找当前显示在屏幕上的所有搜索词实例,但不会查找当前不在视图中的所有其他文本实例。
示例: 在下面的示例中,我正在搜索单词tile,总共使用了 8 次:蓝色瓷砖 4 次,紫色瓷砖 4 次。但是,当我搜索单词tile 时,浏览器只会找到搜索时当前显示在屏幕上的单词的 4 个实例。它会忽略搜索时未在屏幕上呈现的所有单词实例。
文档: Flutter 和 Dart 文档没有关于可搜索文本的任何信息,我没有看到任何其他类似的小部件或属性可用。
尝试:我曾尝试使用 SelectableText 小部件,但同样的问题仍然存在。
尝试过的包: https: //pub.dev/packages/file_picker
尝试了通过 GitHub 共享的示例代码实现。但返回的文件路径null与
Web 平台相同。移动平台中的相同实现返回预期的路径。
注意事项:
目标是从路径读取文件而不是上传。任何实现这一目标的解决方法都会有所帮助。
颤动通道:测试版
当我在网络上运行我的项目时,异常消息和堆栈跟踪是
"Should never encounter KeyData when transitMode is rawKeyData."
at Object.throw_ [as throw] (http://localhost:2621/dart_sdk.js:5061:11)
at Object.assertFailed (http://localhost:2621/dart_sdk.js:4986:15)
at hardware_keyboard.KeyEventManager.new.handleKeyData (http://localhost:2621/packages/flutter/src/services/restoration.dart.lib.js:5334:28)
at http://localhost:2621/dart_sdk.js:160131:47
at Object.invoke (http://localhost:2621/dart_sdk.js:179656:7)
at _engine.EnginePlatformDispatcher.__.invokeOnKeyData (http://localhost:2621/dart_sdk.js:160131:17)
at _engine.KeyboardBinding.__.[_onKeyData] (http://localhost:2621/dart_sdk.js:158922:49)
at _engine.KeyboardConverter.new.handleEvent (http://localhost:2621/dart_sdk.js:159210:16)
at http://localhost:2621/dart_sdk.js:158929:74
at loggedHandler (http://localhost:2621/dart_sdk.js:158906:43)
Error: Assertion failed: file:///E:/flutter_windows_2.5.2-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart:787:16
Run Code Online (Sandbox Code Playgroud) 我正在dlblack.dev 上慢慢建立我的个人网站,并且我正在尝试为它增添一点趣味。例如,从计算机(而不是平板电脑或手机,因为它们没有鼠标指针),如果您将鼠标悬停在任何可点击的项目上,它不会改变您的鼠标指针以表明它是可点击的,并且可点击的对象根本不会改变。我决定遵循这个 FilledStacks 教程,但它没有提到关于解决这个问题的任何内容。
基本上发生的事情是,当我通过教程视频(他在那里编写骨架扩展类)获得大约 2.5 分钟并尝试复制它时,VS Code 将几乎整个类声明(除了名称)红线。我正在写的内容与他在 2:26 屏幕上显示的内容完全相同,这是我的代码:
import 'package:flutter/material.dart';
import 'dart:html' as html;
extension HoverExtension on Widget{
}
Run Code Online (Sandbox Code Playgroud)
当我这样做时,“扩展”、“开”和“小部件”都被红线了。当我将鼠标悬停在“扩展”上时,它会显示以下内容:
Undefined class 'extension'.
Try changing the name to the name of an existing class, or creating a class with the name 'extension'. dartundefined_class
This requires the 'extension-methods' language feature to be enabled.
Try updating your pubspec.yaml to set the minimum SDK constraint to 2.6 or higher, and running 'pub get'. dart(experiment_not_enabled) …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的 Flutter 应用程序部署到 GitHub Pages。应用程序运行良好flutter run -d chrome并使用成功构建flutter build web --release
我将代码推送到我的存储库:https : //github.com/learyjk/superpacecalcweb
部署活动日志显示成功部署。但是当我单击“查看部署”按钮时,我只会看到一个空白页面。Javascript 控制台说:
加载资源失败:服务器响应状态为 404 () https://learyjk.github.io/main.dart.js
我也尝试将 /index.html 附加到 URL 的末尾,但没有成功。
有任何想法吗?错误输出不是很详细,所以我不太知道从哪里开始......
GitHub 页面链接:https : //learyjk.github.io/superpacecalcweb/
谢谢!