Fixed some UI things and nightly

This commit is contained in:
Alessandro Autiero
2022-09-22 21:53:47 +02:00
parent c3a2456e5c
commit 2355b5eecd
20 changed files with 234 additions and 173 deletions

View File

@@ -1,5 +1,6 @@
import 'package:bitsdojo_window/bitsdojo_window.dart' hide WindowBorder;
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/foundation.dart';
import 'package:get_storage/get_storage.dart';
import 'package:reboot_launcher/src/page/info_page.dart';
import 'package:reboot_launcher/src/page/launcher_page.dart';
import 'package:reboot_launcher/src/page/server_page.dart';
@@ -25,7 +26,10 @@ class _HomePageState extends State<HomePage> with WindowListener {
@override
void initState() {
windowManager.addListener(this);
_future = downloadRebootDll();
var storage = GetStorage("update");
int? lastUpdateMs = storage.read("last_update");
_future = compute(downloadRebootDll, lastUpdateMs);
_future.then((value) => storage.write("last_update", value));
super.initState();
}
@@ -56,8 +60,8 @@ class _HomePageState extends State<HomePage> with WindowListener {
displayMode: PaneDisplayMode.top,
indicator: const EndNavigationIndicator(),
items: [
_createPane("Launcher", FluentIcons.game),
_createPane("Server", FluentIcons.server_enviroment),
_createPane("Home", FluentIcons.game),
_createPane("Lawin", FluentIcons.server_enviroment),
_createPane("Info", FluentIcons.info),
],
trailing: WindowTitleBar(focused: _focused)),
@@ -70,6 +74,7 @@ class _HomePageState extends State<HomePage> with WindowListener {
"An error occurred while loading the launcher: ${snapshot.error}",
textAlign: TextAlign.center));
}
return NavigationBody(
index: _index,
children: _createPages(snapshot.hasData));

View File

@@ -31,7 +31,7 @@ class InfoPage extends StatelessWidget {
),
const Expanded(
child: Align(
alignment: Alignment.bottomLeft, child: Text("Version 3.1${kDebugMode ? '-DEBUG' : ''}")))
alignment: Alignment.bottomLeft, child: Text("Version 3.4${kDebugMode ? '-DEBUG' : ''}")))
],
);
}

View File

@@ -16,7 +16,7 @@ class LauncherPage extends StatelessWidget {
children: [
UsernameBox(),
VersionSelector(),
DeploymentSelector(enabled: true),
DeploymentSelector(enabled: false),
const LaunchButton()
],
);

View File

@@ -1,14 +1,58 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:reboot_launcher/src/widget/local_server_switch.dart';
import 'package:reboot_launcher/src/widget/port_input.dart';
import 'package:reboot_launcher/src/widget/host_input.dart';
import 'package:reboot_launcher/src/widget/server_button.dart';
class ServerPage extends StatelessWidget {
import '../controller/server_controller.dart';
class ServerPage extends StatefulWidget {
const ServerPage({Key? key}) : super(key: key);
@override
State<ServerPage> createState() => _ServerPageState();
}
class _ServerPageState extends State<ServerPage> {
final ServerController _serverController = Get.find<ServerController>();
@override
void initState() {
if (_serverController.warning.value) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
await _showAdvancedUserWarning();
_serverController.warning.value = false;
});
}
super.initState();
}
Future<void> _showAdvancedUserWarning() async {
await showDialog(
context: context,
builder: (context) => ContentDialog(
content: const SizedBox(
width: double.infinity,
child: Text("This section is reserved for advanced users",
textAlign: TextAlign.center),
),
actions: [
SizedBox(
width: double.infinity,
child: FilledButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('I understand'),
),
)
],
)
);
}
@override
Widget build(BuildContext context) {
return Column(