mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
Fixed some small things
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
import 'package:bitsdojo_window/bitsdojo_window.dart' hide WindowBorder;
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:reboot_launcher/src/page/settings_page.dart';
|
||||
import 'package:reboot_launcher/src/page/launcher_page.dart';
|
||||
@@ -16,7 +17,13 @@ class HomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> with WindowListener {
|
||||
static const double _headerSize = 48.0;
|
||||
static const double _sectionSize = 97.0;
|
||||
static const int _headerButtonCount = 3;
|
||||
static const int _sectionButtonCount = 3;
|
||||
|
||||
bool _focused = true;
|
||||
bool _shouldMaximize = false;
|
||||
int _index = 0;
|
||||
|
||||
@override
|
||||
@@ -46,34 +53,76 @@ class _HomePageState extends State<HomePage> with WindowListener {
|
||||
return Stack(
|
||||
children: [
|
||||
NavigationView(
|
||||
pane: NavigationPane(
|
||||
selected: _index,
|
||||
onChanged: (index) => setState(() => _index = index),
|
||||
displayMode: PaneDisplayMode.top,
|
||||
indicator: const EndNavigationIndicator(),
|
||||
items: [
|
||||
_createPane("Home", FluentIcons.game),
|
||||
_createPane("Lawin", FluentIcons.server_enviroment),
|
||||
_createPane("Settings", FluentIcons.settings)
|
||||
],
|
||||
trailing: WindowTitleBar(focused: _focused)),
|
||||
content: NavigationBody(
|
||||
index: _index,
|
||||
children: [
|
||||
const LauncherPage(),
|
||||
ServerPage(),
|
||||
SettingsPage()
|
||||
]
|
||||
)
|
||||
pane: NavigationPane(
|
||||
size: const NavigationPaneSize(
|
||||
topHeight: _headerSize
|
||||
),
|
||||
selected: _index,
|
||||
onChanged: (index) => setState(() => _index = index),
|
||||
displayMode: PaneDisplayMode.top,
|
||||
indicator: const EndNavigationIndicator(),
|
||||
items: [
|
||||
PaneItem(
|
||||
title: const Text("Home"),
|
||||
icon: const Icon(FluentIcons.game),
|
||||
body: const LauncherPage()
|
||||
),
|
||||
|
||||
PaneItem(
|
||||
title: const Text("Lawin"),
|
||||
icon: const Icon(FluentIcons.server_enviroment),
|
||||
body: ServerPage()
|
||||
),
|
||||
|
||||
PaneItem(
|
||||
title: const Text("Settings"),
|
||||
icon: const Icon(FluentIcons.settings),
|
||||
body: SettingsPage()
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
|
||||
_createTitleBar(),
|
||||
|
||||
_createGestureHandler(),
|
||||
|
||||
if(_focused && isWin11)
|
||||
const WindowBorder()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
PaneItem _createPane(String label, IconData icon) {
|
||||
return PaneItem(icon: Icon(icon), title: Text(label));
|
||||
Align _createTitleBar() {
|
||||
return Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: WindowTitleBar(focused: _focused),
|
||||
);
|
||||
}
|
||||
|
||||
// Hacky way to get it to work while having maximum performance and no modifications to external libs
|
||||
Padding _createGestureHandler() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: _sectionSize * _headerButtonCount,
|
||||
right: _headerSize * _sectionButtonCount,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: _headerSize,
|
||||
child: GestureDetector(
|
||||
onDoubleTap: () {
|
||||
if(!_shouldMaximize){
|
||||
return;
|
||||
}
|
||||
|
||||
appWindow.maximizeOrRestore();
|
||||
_shouldMaximize = false;
|
||||
},
|
||||
onDoubleTapDown: (details) => _shouldMaximize = true,
|
||||
onHorizontalDragStart: (event) => appWindow.startDragging(),
|
||||
onVerticalDragStart: (event) => appWindow.startDragging()
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user