mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
fix: titlebar maximize+restore button not working and less responsive title bar buttons
This commit is contained in:
parent
0b58155d43
commit
8a6ba3b35f
@ -54,6 +54,8 @@ class PageWindowTitleBar extends StatefulHookWidget with PreferredSizeWidget {
|
||||
class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isMaximized = useState(appWindow.isMaximized);
|
||||
|
||||
useEffect(() {
|
||||
if (platform == TargetPlatform.windows &&
|
||||
widget.hideWhenWindows &&
|
||||
@ -77,17 +79,30 @@ class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
||||
return null;
|
||||
}, [platform, widget.hideWhenWindows]);
|
||||
|
||||
final appBar = PlatformAppBar(
|
||||
if (platform == TargetPlatform.windows && widget.hideWhenWindows) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return PlatformAppBar(
|
||||
actions: [
|
||||
...?widget.actions,
|
||||
if (!kIsMacOS && !kIsMobile)
|
||||
platform == TargetPlatform.linux
|
||||
? MoveWindow(child: const PlatformWindowButtons())
|
||||
: const PlatformWindowButtons(),
|
||||
PlatformWindowButtons(
|
||||
isMaximized: () => isMaximized.value,
|
||||
onMaximize: () {
|
||||
appWindow.maximize();
|
||||
isMaximized.value = true;
|
||||
},
|
||||
onRestore: () {
|
||||
appWindow.restore();
|
||||
isMaximized.value = false;
|
||||
},
|
||||
),
|
||||
],
|
||||
title: platform == TargetPlatform.linux
|
||||
? MoveWindow(child: Center(child: widget.center))
|
||||
: widget.center,
|
||||
onDrag: () {
|
||||
appWindow.startDragging();
|
||||
},
|
||||
title: widget.center,
|
||||
toolbarOpacity: widget.toolbarOpacity,
|
||||
backgroundColor: widget.backgroundColor,
|
||||
actionsIconTheme: widget.actionsIconTheme,
|
||||
@ -101,13 +116,5 @@ class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
||||
titleWidth: widget.titleWidth,
|
||||
toolbarTextStyle: widget.toolbarTextStyle,
|
||||
);
|
||||
|
||||
if (platform == TargetPlatform.windows && widget.hideWhenWindows) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return MoveWindow(
|
||||
child: appBar,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -238,11 +238,11 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
|
||||
themeMode: themeMode,
|
||||
windowButtonConfig: kIsDesktop
|
||||
? PlatformWindowButtonConfig(
|
||||
isMaximized: () => appWindow.isMaximized,
|
||||
onClose: appWindow.close,
|
||||
onRestore: appWindow.restore,
|
||||
onMaximize: appWindow.maximize,
|
||||
onMinimize: appWindow.minimize,
|
||||
isMaximized: () async => Future.value(appWindow.isMaximized),
|
||||
onClose: () async => appWindow.close(),
|
||||
onRestore: () async => appWindow.restore(),
|
||||
onMaximize: () async => appWindow.maximize(),
|
||||
onMinimize: () async => appWindow.minimize(),
|
||||
)
|
||||
: null,
|
||||
shortcuts: PlatformProperty.all({
|
||||
|
@ -1070,8 +1070,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "7a4cda31e434de7cbee92ac7f418903641a2f023"
|
||||
resolved-ref: "7a4cda31e434de7cbee92ac7f418903641a2f023"
|
||||
ref: "073cefb9c419fcb01cbdfd6ca2f9714eec23c83b"
|
||||
resolved-ref: "073cefb9c419fcb01cbdfd6ca2f9714eec23c83b"
|
||||
url: "https://github.com/KRTirtho/platform_ui.git"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
|
@ -62,7 +62,7 @@ dependencies:
|
||||
platform_ui:
|
||||
git:
|
||||
url: https://github.com/KRTirtho/platform_ui.git
|
||||
ref: 7a4cda31e434de7cbee92ac7f418903641a2f023
|
||||
ref: 073cefb9c419fcb01cbdfd6ca2f9714eec23c83b
|
||||
fluent_ui: ^4.0.3
|
||||
macos_ui: ^1.7.5
|
||||
libadwaita: ^1.2.5
|
||||
|
Loading…
Reference in New Issue
Block a user