我创建了一个flutter项目(windows平台)。我构建应用程序而不是使用 inno setup 创建安装文件,但是当我在安装后运行应用程序时,它在后台运行而不是在前台运行。我尝试用管理员运行它,它仍然在后台运行。我第一次创建基于 Windows 的 Flutter 应用程序。我可能会错过一些重要的事情,例如许可或其他事情,请指导我如何解决此问题。此外,当我构建应用程序并从发布文件夹运行它时,它仍然在后台运行。
如果您想查看代码的任何部分或我可以为您提供的任何其他内容。我不知道有什么相关的事情可以分享。
我正在使用以下依赖项(可能相关):
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
motion_toast: ^2.7.8
sqflite_common_ffi: ^2.3.0+2
path_provider: ^2.1.1
intl: ^0.19.0
image_picker: ^1.0.4
get: ^4.6.6
main.dart:
import 'package:attendance_system/splashScreen.dart';
import 'package:flutter/material.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'database.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
final dbHelper = DatabaseHelper.instance;
dbHelper.db;
runApp(
MaterialApp(
restorationScopeId: "some-Id-here",
title: 'Attendance',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
initialRoute: 'SplashScreen',
routes: {
'SplashScreen': (context) => const SplashScreen(),
},
),
);
}
我尝试使用 winRar 和 inno setup 来构建安装程序,但它仍然在后台运行
flutter doctor 的结果
PS C:\Users\ARcaN\Desktop\Projects\Attendance System> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.19045.3803], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.85.1)
[√] Connected device (3 available)
[√] Network resources
• No issues found!
还指导我如何构建 .exe 进行分发以在另一台设备上运行该应用程序
您是否使用 Flutter 版本创建 Flutter 项目 < 3.13?
请参阅 https://github.com/flutter/flutter/issues/119415 以供参考。
使用 Flutter 3.7 或 3.10 创建的应用在升级到 Flutter 3.13 或主通道后需要迁移。如果 Windows 项目尚未修改,此迁移将自动进行。
如果 Windows 项目已被修改,重新创建
flutter_window.cpp
文件的最简单方法是删除整个 windows 文件夹并在现有项目中运行 flutter create --platforms web .
使用最新的 Flutter 版本。