fix(desktop): titlebar drag to move not working

This commit is contained in:
Kingkor Roy Tirtho 2024-06-06 13:41:02 +06:00
parent 6591ec0e1b
commit 5f280a19f4
2 changed files with 27 additions and 18 deletions

View File

@ -26,6 +26,7 @@ import 'package:spotube/provider/user_preferences/user_preferences_provider.dart
import 'package:spotube/provider/user_preferences/user_preferences_state.dart'; import 'package:spotube/provider/user_preferences/user_preferences_state.dart';
import 'package:spotube/utils/platform.dart'; import 'package:spotube/utils/platform.dart';
import 'package:spotube/utils/service_utils.dart'; import 'package:spotube/utils/service_utils.dart';
import 'package:window_manager/window_manager.dart';
class Sidebar extends HookConsumerWidget { class Sidebar extends HookConsumerWidget {
final Widget child; final Widget child;
@ -207,22 +208,24 @@ class SidebarHeader extends HookWidget {
); );
} }
return Padding( return DragToMoveArea(
padding: const EdgeInsets.all(8.0), child: Padding(
child: Column( padding: const EdgeInsets.all(8.0),
children: [ child: Column(
if (kIsMacOS) const SizedBox(height: 25), children: [
Row( if (kIsMacOS) const SizedBox(height: 25),
children: [ Row(
Sidebar.brandLogo(), children: [
const SizedBox(width: 10), Sidebar.brandLogo(),
Text( const SizedBox(width: 10),
"Spotube", Text(
style: theme.textTheme.titleLarge, "Spotube",
), style: theme.textTheme.titleLarge,
], ),
), ],
], ),
],
),
), ),
); );
} }

View File

@ -125,7 +125,10 @@ class _PageWindowTitleBarState extends ConsumerState<PageWindowTitleBar> {
leadingWidth: widget.leadingWidth, leadingWidth: widget.leadingWidth,
toolbarTextStyle: widget.toolbarTextStyle, toolbarTextStyle: widget.toolbarTextStyle,
titleTextStyle: widget.titleTextStyle, titleTextStyle: widget.titleTextStyle,
title: widget.title, title: SizedBox(
width: double.infinity, // workaround to force dragging
child: widget.title ?? const Text(""),
),
pinned: widget.pinned, pinned: widget.pinned,
floating: widget.floating, floating: widget.floating,
snap: widget.snap, snap: widget.snap,
@ -164,7 +167,10 @@ class _PageWindowTitleBarState extends ConsumerState<PageWindowTitleBar> {
leadingWidth: widget.leadingWidth, leadingWidth: widget.leadingWidth,
toolbarTextStyle: widget.toolbarTextStyle, toolbarTextStyle: widget.toolbarTextStyle,
titleTextStyle: widget.titleTextStyle, titleTextStyle: widget.titleTextStyle,
title: widget.title, title: SizedBox(
width: double.infinity, // workaround to force dragging
child: widget.title ?? const Text(""),
),
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
forceMaterialTransparency: true, forceMaterialTransparency: true,