mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
Redesigned whole UI
This commit is contained in:
@@ -1,121 +1,110 @@
|
||||
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||
import 'package:reboot_launcher/src/controller/settings_controller.dart';
|
||||
import 'package:reboot_launcher/src/util/os.dart';
|
||||
import 'package:reboot_launcher/src/widget/shared/smart_switch.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../util/checks.dart';
|
||||
import '../widget/setting/url_updater.dart';
|
||||
import '../widget/shared/file_selector.dart';
|
||||
import '../widget/shared/setting_tile.dart';
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
final GameController _gameController = Get.find<GameController>();
|
||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
||||
|
||||
SettingsPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
_settingsController.advancedMode.value ? _advancedSettings : _easySettings;
|
||||
|
||||
Widget get _advancedSettings => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
Widget build(BuildContext context) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const RebootUpdaterInput(),
|
||||
_createFileSelector(),
|
||||
_createConsoleSelector(),
|
||||
_createGameSelector(),
|
||||
_createVersionInfo(),
|
||||
_createAdvancedSwitch()
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _easySettings => SizedBox.expand(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 48,
|
||||
backgroundImage: AssetImage("assets/images/auties.png")),
|
||||
SettingTile(
|
||||
title: "File settings",
|
||||
subtitle: "This section contains all the settings related to files used by Fortnite",
|
||||
expandedContent: [
|
||||
_createFileSetting(
|
||||
title: "Game server",
|
||||
description: "This file is injected to create a game server to host matches",
|
||||
controller: _settingsController.rebootDll
|
||||
),
|
||||
_createFileSetting(
|
||||
title: "Unreal engine console",
|
||||
description: "This file is injected to unlock the Unreal Engine Console in-game",
|
||||
controller: _settingsController.consoleDll
|
||||
),
|
||||
_createFileSetting(
|
||||
title: "Authentication patcher",
|
||||
description: "This file is injected to redirect all HTTP requests to the local backend",
|
||||
controller: _settingsController.authDll
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
const Text("Made by Auties00"),
|
||||
const SizedBox(
|
||||
height: 4.0,
|
||||
SettingTile(
|
||||
title: "Automatic updates",
|
||||
subtitle: "Choose whether the launcher and its files should be automatically updated",
|
||||
contentWidth: null,
|
||||
content: Obx(() => ToggleSwitch(
|
||||
checked: _settingsController.autoUpdate(),
|
||||
onChanged: (value) => _settingsController.autoUpdate.value = value
|
||||
))
|
||||
),
|
||||
_versionText,
|
||||
const SizedBox(
|
||||
height: 8.0,
|
||||
height: 16.0,
|
||||
),
|
||||
Button(
|
||||
child: const Text("Switch to advanced mode"),
|
||||
onPressed: () => _settingsController.advancedMode.value = true
|
||||
)
|
||||
],
|
||||
),
|
||||
SettingTile(
|
||||
title: "Custom launch arguments",
|
||||
subtitle: "Enter additional arguments to use when launching the game",
|
||||
content: TextFormBox(
|
||||
placeholder: "args",
|
||||
controller: _gameController.customLaunchArgs,
|
||||
)
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
SettingTile(
|
||||
title: "Create a bug report",
|
||||
subtitle: "Help me fix bugs by reporting them",
|
||||
content: Button(
|
||||
onPressed: () => launchUrl(Uri.parse("https://discord.com/channels/998020695223193670/1031262639457828910")),
|
||||
child: const Text("Report a bug"),
|
||||
)
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget _createAdvancedSwitch() => SmartSwitch(
|
||||
label: "Advanced Mode",
|
||||
value: _settingsController.advancedMode
|
||||
);
|
||||
|
||||
Widget _createVersionInfo() => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text("Version Status"),
|
||||
const SizedBox(height: 6.0),
|
||||
Button(
|
||||
child: _versionText,
|
||||
onPressed: () => launchUrl(safeBinariesDirectory.uri)
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
Widget _createGameSelector() => Tooltip(
|
||||
message: "The dll that is injected to make the game work",
|
||||
child: FileSelector(
|
||||
label: "Cranium DLL",
|
||||
placeholder:
|
||||
"Type the path to the dll used for authentication",
|
||||
controller: _settingsController.authDll,
|
||||
windowTitle: "Select a dll",
|
||||
folder: false,
|
||||
extension: "dll",
|
||||
validator: checkDll,
|
||||
validatorMode: AutovalidateMode.always
|
||||
Widget _createFileSetting({required String title, required String description, required TextEditingController controller}) => ListTile(
|
||||
title: Text(title),
|
||||
subtitle: Text(description),
|
||||
trailing: SizedBox(
|
||||
width: 256,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormBox(
|
||||
placeholder: "path",
|
||||
controller: controller,
|
||||
validator: checkDll,
|
||||
autovalidateMode: AutovalidateMode.always
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8.0,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 21.0),
|
||||
child: Button(
|
||||
onPressed: () { },
|
||||
child: const Icon(FluentIcons.open_folder_horizontal),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Widget _createConsoleSelector() => Tooltip(
|
||||
message: "The dll that is injected when a client is launched",
|
||||
child: 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,
|
||||
validatorMode: AutovalidateMode.always),
|
||||
);
|
||||
|
||||
Widget _createFileSelector() => Tooltip(
|
||||
message: "The dll that is injected when a server is launched",
|
||||
child: 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,
|
||||
validatorMode: AutovalidateMode.always),
|
||||
);
|
||||
|
||||
Widget get _versionText => const Text("6.4${kDebugMode ? '-DEBUG' : '-RELEASE'}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user