fix: detect if quickemu is insalled
This commit is contained in:
parent
31e1d2de8e
commit
bba41d6938
|
@ -58,8 +58,11 @@ void main() async {
|
|||
// Don't forget to also change the size in linux/my_application.cc:50
|
||||
setWindowMinSize(const Size(692, 580));
|
||||
setWindowMaxSize(const Size(692, 580));
|
||||
gOperatingSystems = await loadOperatingSystems(false);
|
||||
AppVersion.packageInfo = await PackageInfo.fromPlatform();
|
||||
final foundQuickGet = await Process.run('which', ['quickget']);
|
||||
if (foundQuickGet.exitCode == 0) {
|
||||
gOperatingSystems = await loadOperatingSystems(false);
|
||||
AppVersion.packageInfo = await PackageInfo.fromPlatform();
|
||||
}
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
|
|
|
@ -2,8 +2,10 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:gettext_i18n/gettext_i18n.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:quickgui/src/mixins/app_version.dart';
|
||||
import 'package:quickgui/src/pages/deget_not_found_page.dart';
|
||||
import 'package:quickgui/src/supported_locales.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
|
@ -40,13 +42,15 @@ class _AppState extends State<App> with PreferencesMixin {
|
|||
theme: ThemeData(primarySwatch: Colors.pink),
|
||||
darkTheme: ThemeData.dark(),
|
||||
themeMode: appSettings.themeMode,
|
||||
home: const MainPage(),
|
||||
home: AppVersion.packageInfo == null
|
||||
? const DebgetNotFoundPage()
|
||||
: const MainPage(),
|
||||
supportedLocales: supportedLocales.map((s) => s.contains("_")
|
||||
? Locale(s.split("_")[0], s.split("_")[1])
|
||||
: Locale(s)),
|
||||
localizationsDelegates: [
|
||||
GettextLocalizationsDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
...GlobalMaterialLocalizations.delegates,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
locale:
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DebgetNotFoundPage extends StatelessWidget {
|
||||
const DebgetNotFoundPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'quickemu was not found in your PATH',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
const Text(
|
||||
'Please install it and try again.',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
text: 'See ',
|
||||
children: [
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
launchUrl(
|
||||
Uri.parse(
|
||||
'https://github.com/quickemu-project/quickemu'),
|
||||
);
|
||||
},
|
||||
text: 'github.com/quickemu-project/quickemu',
|
||||
style: const TextStyle(color: Colors.blue),
|
||||
),
|
||||
const TextSpan(text: ' for more information'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@ dependencies:
|
|||
desktop_notifications: ^0.6.1
|
||||
flutter_svg: ^0.23.0
|
||||
gettext_i18n: ^1.0.2
|
||||
url_launcher: ^6.1.6
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in New Issue