我正在构建一个 Flutter 桌面应用程序,我想让应用程序在系统托盘上运行,而不是仅仅关闭它。
我是颤振的新手,并根据要求执行一项任务。
我正在创建一个可以在所有平台上运行的应用程序,如 iOS、Android、桌面(MacOS、Linux、Windows)和网络。
现在客户端想要自定义 MenuBar 并添加一些额外的操作并设置 MenuItem 的分组。
菜单栏如下所示:
有没有可能通过flutter来完成这个任务?
当我尝试将我的应用程序构建到 Flutter Desktop 时,它失败并显示以下消息:
Running "flutter pub get" in project...
Launching lib/main.dart on Linux in debug mode...
Exception: No Linux desktop project configured. See https://github.com/flutter/flutter/wiki/Desktop-shells#create to learn about adding Linux support to a project.
Run Code Online (Sandbox Code Playgroud)
我的配置是:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel master, 1.20.0-3.0.pre.126, on Linux, locale en_US.UTF-8)
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[?] Chrome - develop for the web
[?] Linux toolchain - develop …Run Code Online (Sandbox Code Playgroud) 我最近开始使用 flutter for windows。我正在关注这个firebase 和 flutter 教程。在第 4 课中,我遇到了 Firebase Auth 错误:
颤振:MissingPluginException(在频道 plugins.flutter.io/firebase_auth 上找不到方法 signInAnonymously 的实现)
我认为问题是因为我正在为 Windows 构建。我不知道如何将 firebase 添加到 Windows 应用程序中。任何帮助表示赞赏
这是完整的日志:
Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Waiting for Windows to report its views...
Debug service listening on ws://127.0.0.1:60688/97Ok8iT1Hjo=/ws
Syncing files to device Windows...
flutter: MissingPluginException(No implementation found for method signInAnonymously on channel plugins.flutter.io/firebase_auth)
flutter: error signing in
Run Code Online (Sandbox Code Playgroud)
编辑 1
pubspec.yaml 文件(依赖项部分)
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.14.0+5
cloud_firestore: ^0.12.9+4 …Run Code Online (Sandbox Code Playgroud) 我有一个 Flutter 应用程序,我在 Flutter 中为 macOS 构建了它。但我无法找到一种对 Application.app 包进行协同设计的方法。我已经在互联网上搜索过,但找不到合适的方法来做到这一点。
在 Flutter 桌面应用程序中,我想知道当用户用鼠标单击按钮时,他们是否也按住了某个键(如 Shift、Control、Alt 等)。
如何才能做到这一点?
编辑
我最初的问题不够清楚。
我有一个动态复选框列表,我想使用 SHIFT+单击来选择最后一个选定的复选框和按下 SHIFT 选定的复选框之间的所有内容。
我看过 FocusNode 但这似乎只适用于 1 个元素。
我正在尝试在 Visual Studio 2019 中创建和运行 Flutter 桌面应用程序,我已经下载了所需的文件(MSBuild 和 MSVC),但仍然出现错误。我使用的是 2013 版并卸载了它并安装了 2019 版,并且所有内容都已更新
当我运行 flutter run 命令时会发生这种情况
Launching lib\main.dart on Windows in debug mode...
Unable to find suitable Visual Studio toolchain. Please run `flutter doctor` for more details.
Run Code Online (Sandbox Code Playgroud)
当我运行 flutter 医生给我这个错误
[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.4.5)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
development with C++" workload, and include these components:
MSBuild
MSVC v142 …Run Code Online (Sandbox Code Playgroud) 我尝试在桌面上运行/调试我的应用程序(使用所有默认值安装 Visual Studio 2019 后),但我不能:)并且发生了此错误:
D:\Visual Studio IDE\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: Custom build for 'D:\Location\Some Location\MyFlutterAppLocation\build\windows\CMakeFiles\a50fa560346c71769b697565b5a2d59b\flutter_windows.dll.rule;D:\Location\MyFlutterAppLocation\build\windows\CMakeFiles\eb8cecdef0b53de6eb232004d53dfd8a\flutter_assemble.rule' exited with code 1. [D:\Location\Some Location\MyFlutterAppLocation\build\windows\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.
Run Code Online (Sandbox Code Playgroud) 我在桌面 Windows 上使用sqflite ffi作为我的数据库。我按照示例中的方式设置了所有内容。该应用程序正在调试构建,但如果我在发布模式下运行该应用程序,我会在sqfliteFfiInit(). 我该如何解决这个问题?
Invalid argument(s): Failed to load dynamic library (126)
Run Code Online (Sandbox Code Playgroud)
Future<void> init() async {
try {
sqfliteFfiInit();
} catch (e) {
print(e.toString());
}
_databaseFactory = databaseFactoryFfi;
String path = '${await _databaseFactory.getDatabasesPath()}\\myDB.db';
_db = await _databaseFactory.openDatabase(path);
final List<Map<String, dynamic>> result = await _db.query(
'sqlite_master',
where: 'name = ?',
whereArgs: <String>['MyDB'],
);
if(result.isEmpty){
await _db.execute('''
CREATE TABLE MyDB (
id INTEGER PRIMARY KEY,
name TEXT
)
''');
}
}
Run Code Online (Sandbox Code Playgroud)