From 1ac77040806ae08954b10f5a76b90ff7d0c3f8c5 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 30 Aug 2024 19:53:53 +0800 Subject: [PATCH] :bug: Fix bugs on windows --- lib/main.dart | 6 +++--- lib/shells/system_shell.dart | 29 ++++++++++++++++------------- test/widget_test.dart | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a248d1e..914ed2b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -52,11 +52,11 @@ Future main(List rawArgs) async { await KVStoreService.initialize(); await EncryptedKvStoreService.initialize(); - runApp(const MyApp()); + runApp(const RhythmApp()); } -class MyApp extends StatelessWidget { - const MyApp({super.key}); +class RhythmApp extends StatelessWidget { + const RhythmApp({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/shells/system_shell.dart b/lib/shells/system_shell.dart index 667662e..f58fcd4 100644 --- a/lib/shells/system_shell.dart +++ b/lib/shells/system_shell.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:rhythm_box/platform.dart'; +import 'package:window_manager/window_manager.dart'; class SystemShell extends StatelessWidget { final Widget child; @@ -8,19 +9,21 @@ class SystemShell extends StatelessWidget { @override Widget build(BuildContext context) { - if (PlatformInfo.isMacOS) { - return Column( - children: [ - Container( - height: 28, - color: Theme.of(context).colorScheme.surface, - ), - const Divider( - thickness: 0.3, - height: 0.3, - ), - Expanded(child: child), - ], + if (PlatformInfo.isDesktop) { + return DragToMoveArea( + child: Column( + children: [ + Container( + height: 28, + color: Theme.of(context).colorScheme.surface, + ), + const Divider( + thickness: 0.3, + height: 0.3, + ), + Expanded(child: child), + ], + ), ); } diff --git a/test/widget_test.dart b/test/widget_test.dart index 5d4988a..d8976d2 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:rhythm_box/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); + await tester.pumpWidget(const RhythmApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget);