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> {
|
class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isMaximized = useState(appWindow.isMaximized);
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (platform == TargetPlatform.windows &&
|
if (platform == TargetPlatform.windows &&
|
||||||
widget.hideWhenWindows &&
|
widget.hideWhenWindows &&
|
||||||
@ -77,17 +79,30 @@ class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
|||||||
return null;
|
return null;
|
||||||
}, [platform, widget.hideWhenWindows]);
|
}, [platform, widget.hideWhenWindows]);
|
||||||
|
|
||||||
final appBar = PlatformAppBar(
|
if (platform == TargetPlatform.windows && widget.hideWhenWindows) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlatformAppBar(
|
||||||
actions: [
|
actions: [
|
||||||
...?widget.actions,
|
...?widget.actions,
|
||||||
if (!kIsMacOS && !kIsMobile)
|
if (!kIsMacOS && !kIsMobile)
|
||||||
platform == TargetPlatform.linux
|
PlatformWindowButtons(
|
||||||
? MoveWindow(child: const PlatformWindowButtons())
|
isMaximized: () => isMaximized.value,
|
||||||
: const PlatformWindowButtons(),
|
onMaximize: () {
|
||||||
|
appWindow.maximize();
|
||||||
|
isMaximized.value = true;
|
||||||
|
},
|
||||||
|
onRestore: () {
|
||||||
|
appWindow.restore();
|
||||||
|
isMaximized.value = false;
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
title: platform == TargetPlatform.linux
|
onDrag: () {
|
||||||
? MoveWindow(child: Center(child: widget.center))
|
appWindow.startDragging();
|
||||||
: widget.center,
|
},
|
||||||
|
title: widget.center,
|
||||||
toolbarOpacity: widget.toolbarOpacity,
|
toolbarOpacity: widget.toolbarOpacity,
|
||||||
backgroundColor: widget.backgroundColor,
|
backgroundColor: widget.backgroundColor,
|
||||||
actionsIconTheme: widget.actionsIconTheme,
|
actionsIconTheme: widget.actionsIconTheme,
|
||||||
@ -101,13 +116,5 @@ class _PageWindowTitleBarState extends State<PageWindowTitleBar> {
|
|||||||
titleWidth: widget.titleWidth,
|
titleWidth: widget.titleWidth,
|
||||||
toolbarTextStyle: widget.toolbarTextStyle,
|
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,
|
themeMode: themeMode,
|
||||||
windowButtonConfig: kIsDesktop
|
windowButtonConfig: kIsDesktop
|
||||||
? PlatformWindowButtonConfig(
|
? PlatformWindowButtonConfig(
|
||||||
isMaximized: () => appWindow.isMaximized,
|
isMaximized: () async => Future.value(appWindow.isMaximized),
|
||||||
onClose: appWindow.close,
|
onClose: () async => appWindow.close(),
|
||||||
onRestore: appWindow.restore,
|
onRestore: () async => appWindow.restore(),
|
||||||
onMaximize: appWindow.maximize,
|
onMaximize: () async => appWindow.maximize(),
|
||||||
onMinimize: appWindow.minimize,
|
onMinimize: () async => appWindow.minimize(),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
shortcuts: PlatformProperty.all({
|
shortcuts: PlatformProperty.all({
|
||||||
|
@ -1070,8 +1070,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "7a4cda31e434de7cbee92ac7f418903641a2f023"
|
ref: "073cefb9c419fcb01cbdfd6ca2f9714eec23c83b"
|
||||||
resolved-ref: "7a4cda31e434de7cbee92ac7f418903641a2f023"
|
resolved-ref: "073cefb9c419fcb01cbdfd6ca2f9714eec23c83b"
|
||||||
url: "https://github.com/KRTirtho/platform_ui.git"
|
url: "https://github.com/KRTirtho/platform_ui.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
|
@ -62,7 +62,7 @@ dependencies:
|
|||||||
platform_ui:
|
platform_ui:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/KRTirtho/platform_ui.git
|
url: https://github.com/KRTirtho/platform_ui.git
|
||||||
ref: 7a4cda31e434de7cbee92ac7f418903641a2f023
|
ref: 073cefb9c419fcb01cbdfd6ca2f9714eec23c83b
|
||||||
fluent_ui: ^4.0.3
|
fluent_ui: ^4.0.3
|
||||||
macos_ui: ^1.7.5
|
macos_ui: ^1.7.5
|
||||||
libadwaita: ^1.2.5
|
libadwaita: ^1.2.5
|
||||||
|
Loading…
Reference in New Issue
Block a user