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;
|
return null;
|
||||||
}, [backgroundColor]);
|
}, [backgroundColor]);
|
||||||
|
|
||||||
const pageWindowTitleBar = PageWindowTitleBar();
|
final allowedPath = _path.values.contains(GoRouter.of(context).location);
|
||||||
|
final preferredSize =
|
||||||
|
allowedPath ? PageWindowTitleBar.staticPreferredSize : Size.zero;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
primary: true,
|
primary: true,
|
||||||
appBar: _path.values.contains(GoRouter.of(context).location)
|
appBar: PreferredSize(
|
||||||
? pageWindowTitleBar
|
preferredSize: preferredSize,
|
||||||
: null,
|
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,
|
extendBodyBehindAppBar: true,
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -78,13 +90,7 @@ class Shell extends HookConsumerWidget {
|
|||||||
GoRouter.of(context).go(_path[selectedIndex]!);
|
GoRouter.of(context).go(_path[selectedIndex]!);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(child: child),
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(child: child),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
|
@ -77,18 +77,24 @@ class PageWindowTitleBar extends StatelessWidget
|
|||||||
final Widget? center;
|
final Widget? center;
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
final Color? foregroundColor;
|
final Color? foregroundColor;
|
||||||
|
final Size? _preferredSize;
|
||||||
const PageWindowTitleBar({
|
const PageWindowTitleBar({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
Size? preferredSize,
|
||||||
this.leading,
|
this.leading,
|
||||||
this.center,
|
this.center,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
this.foregroundColor,
|
this.foregroundColor,
|
||||||
}) : super(key: key);
|
}) : _preferredSize = preferredSize,
|
||||||
@override
|
super(key: key);
|
||||||
Size get preferredSize => Size.fromHeight(
|
|
||||||
|
static Size get staticPreferredSize => Size.fromHeight(
|
||||||
(kIsDesktop ? appWindow.titleBarHeight : 35),
|
(kIsDesktop ? appWindow.titleBarHeight : 35),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => _preferredSize ?? staticPreferredSize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (kIsMobile) {
|
if (kIsMobile) {
|
||||||
|
Loading…
Reference in New Issue
Block a user