mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
feat: animated transition of root PageWindowTitleBar
This commit is contained in:
parent
4df917e65e
commit
ff35e06a66
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user