diff --git a/lib/components/Home/Shell.dart b/lib/components/Home/Shell.dart index 4c39b6cc..557df6eb 100644 --- a/lib/components/Home/Shell.dart +++ b/lib/components/Home/Shell.dart @@ -62,12 +62,24 @@ class Shell extends HookConsumerWidget { return null; }, [backgroundColor]); - const pageWindowTitleBar = PageWindowTitleBar(); + final allowedPath = _path.values.contains(GoRouter.of(context).location); + final preferredSize = + allowedPath ? PageWindowTitleBar.staticPreferredSize : Size.zero; return Scaffold( primary: true, - appBar: _path.values.contains(GoRouter.of(context).location) - ? pageWindowTitleBar - : null, + appBar: PreferredSize( + preferredSize: preferredSize, + child: AnimatedContainer( + duration: const Duration(milliseconds: 250), + height: + allowedPath ? PageWindowTitleBar.staticPreferredSize.height : 0, + child: AnimatedOpacity( + duration: const Duration(milliseconds: 250), + opacity: allowedPath ? 1 : 0, + child: PageWindowTitleBar(preferredSize: preferredSize), + ), + ), + ), extendBodyBehindAppBar: true, body: Row( children: [ @@ -78,13 +90,7 @@ class Shell extends HookConsumerWidget { GoRouter.of(context).go(_path[selectedIndex]!); }, ), - Expanded( - child: Column( - children: [ - Expanded(child: child), - ], - ), - ), + Expanded(child: child), ], ), extendBody: true, diff --git a/lib/components/Shared/PageWindowTitleBar.dart b/lib/components/Shared/PageWindowTitleBar.dart index 75354204..f9a93334 100644 --- a/lib/components/Shared/PageWindowTitleBar.dart +++ b/lib/components/Shared/PageWindowTitleBar.dart @@ -77,18 +77,24 @@ class PageWindowTitleBar extends StatelessWidget final Widget? center; final Color? backgroundColor; final Color? foregroundColor; + final Size? _preferredSize; const PageWindowTitleBar({ Key? key, + Size? preferredSize, this.leading, this.center, this.backgroundColor, this.foregroundColor, - }) : super(key: key); - @override - Size get preferredSize => Size.fromHeight( + }) : _preferredSize = preferredSize, + super(key: key); + + static Size get staticPreferredSize => Size.fromHeight( (kIsDesktop ? appWindow.titleBarHeight : 35), ); + @override + Size get preferredSize => _preferredSize ?? staticPreferredSize; + @override Widget build(BuildContext context) { if (kIsMobile) {