您好,我想使用 Flutter 为我的文本悬停颜色。但我不知道怎么办。谁能告诉我该怎么做?这是我的代码......
Text(
"Lorem ipsum dolor sit amet,\n consectetur adipiscing elit.",
style: TextStyle(
color: Colors.white,
fontSize: 10,
fontFamily: 'Poppins',
)),
Run Code Online (Sandbox Code Playgroud) flutter flutter-dependencies flutter-layout flutter-animation flutter-web
我正在使用 go router 作为 flutter 应用程序,我可以在活动之间传递字符串参数,现在它正在工作,我想传递动态列表,但出现错误
参数类型“String”无法分配给参数类型“List”。(文档)
接收器活动有
class EditUserPage extends StatefulWidget {
final String name;
final List<dynamic> userinformation;
}
Run Code Online (Sandbox Code Playgroud)
在路线构建器上,我已经传递了如下数据
GoRoute(
path: 'editusers',
name:
'editusers/:name,:userinformation,'
builder: (BuildContext context, GoRouterState state) {
return EditUserPage(
state.params["name"]!,
state.params["userinformation"]!,
)
);
Run Code Online (Sandbox Code Playgroud)
错误出现在这一行 state.params["userinformation"]!, 参数类型“String”无法分配给参数类型“List”。
我想知道为什么 URL 中有主题标签?对于 Flutter Web 应用程序,例如:http://localhost:64392/#/home即使在生产中也是相同的结果。
我想知道为什么以及是否可以删除它?
我有以下代码呈现ListTileaTextFormField和ListTitlea DropdownButton。
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
new Expanded(
child: ListTile(
dense: true,
title: Text(
"Property Name",
style: TextStyle(fontWeight: FontWeight.bold),
),
subtitle: TextFormField(
decoration: InputDecoration(
labelText: 'Enter the property name'
),
),
isThreeLine: true,
)
),
new Expanded(
child: ListTile(
dense: true,
title: Text(
"Contact Name",
style: TextStyle(fontWeight: FontWeight.bold),
),
subtitle: DropdownButton<int>(
items: [
DropdownMenuItem<int>(
value: 1,
child: Text(
"John Smith",
),
),
DropdownMenuItem<int>(
value: 2,
child: Text(
"Jon …Run Code Online (Sandbox Code Playgroud) 有人可以向我解释一下热重载和 hor 重新启动,以及何时我不必这样做(例如需要执行重建的代码更改)以及何时可以。在 Flutter web 和 mobile 中调试时,如果我不确定我所做的更改是否影响了结果,我会关闭所有并重建项目......对这两种“快速构建”模式的一些见解“会让我对我在调试过程中点击的按钮更有信心;)
IDE:Android Studio 3.5.1
所以我正在使用 flutter web + cloud firestore
为了让云 Firestore 工作,我必须修改我的 index.html。问题是每次我跑
flutter build web
Run Code Online (Sandbox Code Playgroud)
它覆盖了我的 index.html,我必须手动重新添加所有必要的代码片段才能让它再次工作。
有没有一种方法可以在不覆盖 index.html 的情况下运行 flutter build web?
另一个相关问题是,当我将站点部署到 firebase 时,它工作正常,但是当我在本地运行此站点进行测试时,使用
flutter run -d chrome
Run Code Online (Sandbox Code Playgroud)
当它在 chrome 上运行时,该站点再次使用了一个全新的 index.html,没有必要的代码,所以它不起作用。我没有机会编辑 index.html 来应用必要的代码,因为它会立即构建并运行。
有没有办法解决这个问题?
无法切换到 flutter beta 频道 C:\Users\vairo_drrrnuo\IdeaProjects\bridge>flutter channel beta
Switching to flutter channel 'beta'...
git: From https://github.com/flutter/flutter
git: f994b7697..9b9b543d9 beta -> origin/beta
git: + cb8832388...7cd39d661 dds_integration_take_2 -> origin/dds_integration_take_2 (forced update)
git: 15a28159b..c68758fab master -> origin/master
git: * [new tag] 1.19.0-4.2.pre -> 1.19.0-4.2.pre
git: error: The following untracked working tree files would be overwritten by checkout:
git: examples/flutter_view/ios/Podfile
git: packages/flutter_tools/lib/src/base/platform.dart
git: Please move or remove them before you switch branches.
git: Aborting
Switching channels failed with error code 1.
Run Code Online (Sandbox Code Playgroud) 我想获取当前时区,例如欧洲/伦敦。flutter_native_timezone不适用于网络。如何获得?
在 Flutter 中使用 HttpsCallable 插件时,我正在努力获取要传递到我的 Cloud Function 的参数。
我的 Cloud Functions 中的日志显示没有传递任何参数。
我的云函数index.js
// acts as an endpoint getter for Python Password Generator FastAPI
exports.getPassword = functions.https.onRequest((req, res) => {
const useSymbols = req.query.useSymbols;
const pwLength = req.query.pwdLength;
// BUILD URL STRING WITH PARAMS
const ROOT_URL = `http://34.72.115.208/password?pwd_length=${pwLength}&use_symbols=${useSymbols}`;
const debug = {
pwLenType: typeof pwLength,
pwLen: pwLength,
useSymbolsType: typeof useSymbols,
useSymbols: useSymbols,
};
console.log(req.query);
console.log(debug);
// let password: any; // password to be received
cors(req, res, () => { …Run Code Online (Sandbox Code Playgroud) 我正在使用 flutter web 为我的业务创建一个网站。我将它托管在 firebase 主机上,网址为
https://xspectre-9a3b3.web.app/
现在,当我添加新域
https://xspectre.net 时,
该网站未在该域中加载并给出错误
main.dart.js:1 Uncaught SyntaxError: Unexpected token '<'
(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://xspectre.net/') with script ('https://xspectre.net/flutter_service_worker.js'): The script has an unsupported MIME type ('text/html').
Run Code Online (Sandbox Code Playgroud)
它也不适用于https://xspectre-9a3b3.firebaseapp.com/。我该怎么办?
编辑
我发现真正的错误不是 MIME 类型,因为它也在我的真实项目中。实际错误不知何故
Uncaught SyntaxError: Unexpected token '<'
Run Code Online (Sandbox Code Playgroud)
当我打开 main.dart.js 时,它向我显示了不同的代码。它向我展示了 html 文件而不是 main.dart.js 代码,我认为这就是导致问题的原因。我不知道这两个 URL 的文件如何或为什么不同。
**编辑 2 **
终于找到了根本问题。
每当我尝试执行 firebase init 时,它都会初始化整个 flutter 目录。这意味着它说,
You're about to initialize a Firebase project in …Run Code Online (Sandbox Code Playgroud)