mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
Added settings tab
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:reboot_launcher/src/page/info_page.dart';
|
||||
import 'package:reboot_launcher/src/page/settings_page.dart';
|
||||
import 'package:reboot_launcher/src/page/launcher_page.dart';
|
||||
import 'package:reboot_launcher/src/page/server_page.dart';
|
||||
import 'package:reboot_launcher/src/util/os.dart';
|
||||
@@ -54,7 +54,7 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
||||
items: [
|
||||
_createPane("Home", FluentIcons.game),
|
||||
_createPane("Lawin", FluentIcons.server_enviroment),
|
||||
_createPane("Info", FluentIcons.info),
|
||||
_createPane("Settings", FluentIcons.settings)
|
||||
],
|
||||
trailing: WindowTitleBar(focused: _focused)),
|
||||
content: NavigationBody(
|
||||
@@ -62,7 +62,7 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
||||
children: [
|
||||
const LauncherPage(),
|
||||
ServerPage(),
|
||||
const InfoPage()
|
||||
SettingsPage()
|
||||
]
|
||||
)
|
||||
),
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
const String _discordLink = "https://discord.gg/NJU4QjxSMF";
|
||||
|
||||
class InfoPage extends StatelessWidget {
|
||||
const InfoPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
const Expanded(child: SizedBox()),
|
||||
Column(
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 48,
|
||||
backgroundImage: AssetImage("assets/images/auties.png")),
|
||||
const SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
const Text("Made by Auties00"),
|
||||
const SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
Button(
|
||||
child: const Text("Join the discord"),
|
||||
onPressed: () => launchUrl(Uri.parse(_discordLink))),
|
||||
],
|
||||
),
|
||||
const Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft, child: Text("Version 3.10${kDebugMode ? '-DEBUG' : ''}")))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import 'package:reboot_launcher/src/widget/username_box.dart';
|
||||
import 'package:reboot_launcher/src/widget/version_selector.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../controller/settings_controller.dart';
|
||||
import '../util/binary.dart';
|
||||
import '../util/reboot.dart';
|
||||
import '../widget/warning_info.dart';
|
||||
@@ -29,10 +30,11 @@ class LauncherPage extends StatefulWidget {
|
||||
class _LauncherPageState extends State<LauncherPage> {
|
||||
final GameController _gameController = Get.find<GameController>();
|
||||
final BuildController _buildController = Get.find<BuildController>();
|
||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if(_gameController.updater == null) {
|
||||
if(_gameController.updater == null && _settingsController.autoUpdate.value){
|
||||
_gameController.updater = compute(downloadRebootDll, _updateTime)
|
||||
..then((value) => _updateTime = value)
|
||||
..onError(_saveError);
|
||||
|
||||
86
lib/src/page/settings_page.dart
Normal file
86
lib/src/page/settings_page.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
||||
import 'package:reboot_launcher/src/widget/file_selector.dart';
|
||||
import 'package:reboot_launcher/src/widget/smart_switch.dart';
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
||||
|
||||
SettingsPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Form(
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
FileSelector(
|
||||
label: "Reboot DLL",
|
||||
placeholder: "Type the path to the reboot dll",
|
||||
controller: _settingsController.rebootDll,
|
||||
windowTitle: "Select a dll",
|
||||
folder: false,
|
||||
extension: "dll",
|
||||
validator: _checkDll
|
||||
),
|
||||
|
||||
FileSelector(
|
||||
label: "Console DLL",
|
||||
placeholder: "Type the path to the console dll",
|
||||
controller: _settingsController.consoleDll,
|
||||
windowTitle: "Select a dll",
|
||||
folder: false,
|
||||
extension: "dll",
|
||||
validator: _checkDll
|
||||
),
|
||||
|
||||
FileSelector(
|
||||
label: "Cranium DLL",
|
||||
placeholder: "Type the path to the cranium dll",
|
||||
controller: _settingsController.craniumDll,
|
||||
windowTitle: "Select a dll",
|
||||
folder: false,
|
||||
extension: "dll",
|
||||
validator: _checkDll
|
||||
),
|
||||
|
||||
SmartSwitch(
|
||||
value: _settingsController.autoUpdate,
|
||||
label: "Update DLLs"
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
|
||||
const Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Text("Version 3.11${kDebugMode ? '-DEBUG' : ''}")
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
String? _checkDll(String? text) {
|
||||
if (text == null || text.isEmpty) {
|
||||
return "Empty dll path";
|
||||
}
|
||||
|
||||
if (!File(text).existsSync()) {
|
||||
return "This dll doesn't exist";
|
||||
}
|
||||
|
||||
if (!text.endsWith(".dll")) {
|
||||
return "This file is not a dll";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user