feat: main window custom bar & drag

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous
2022-08-18 11:07:53 +08:00
parent 58b471e26b
commit b8f7e85c0b
4 changed files with 223 additions and 59 deletions

View File

@@ -77,7 +77,14 @@ Future<void> initEnv(String appType) async {
}
void runMainApp(bool startService) async {
await initEnv(kAppTypeMain);
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(Size(1280, 720));
await Future.wait([
initEnv(kAppTypeMain),
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
})
]);
if (startService) {
// await windowManager.ensureInitialized();
// disable tray
@@ -118,13 +125,7 @@ void runFileTransferScreen(Map<String, dynamic> argument) async {
void runConnectionManagerScreen() async {
// initialize window
WindowOptions windowOptions = WindowOptions(
size: Size(300, 400),
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.normal,
);
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(Size(300, 400));
await Future.wait([
initEnv(kAppTypeConnectionManager),
windowManager.waitUntilReadyToShow(windowOptions, () async {
@@ -134,7 +135,20 @@ void runConnectionManagerScreen() async {
})
]);
;
runApp(GetMaterialApp(theme: getCurrentTheme(), home: DesktopServerPage()));
runApp(GetMaterialApp(
debugShowCheckedModeBanner: false,
theme: getCurrentTheme(),
home: DesktopServerPage()));
}
WindowOptions getHiddenTitleBarWindowOptions(Size size) {
return WindowOptions(
size: size,
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
);
}
class App extends StatelessWidget {