From fcb5c8f8dabd0d4e3033f80ea3e5d006243cdfb5 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 7 Apr 2023 11:30:26 +0600 Subject: [PATCH] fix: memoize child of animated widget and make player bg animation faster --- lib/components/shared/animated_gradient.dart | 2 +- lib/pages/player/player.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/components/shared/animated_gradient.dart b/lib/components/shared/animated_gradient.dart index 2da15b60..b6485f6b 100644 --- a/lib/components/shared/animated_gradient.dart +++ b/lib/components/shared/animated_gradient.dart @@ -105,7 +105,7 @@ class AnimateGradient extends HookWidget { return AnimatedBuilder( animation: animation, - child: child, + child: useMemoized(() => child, [child]), builder: (BuildContext context, Widget? child) { return Container( decoration: BoxDecoration( diff --git a/lib/pages/player/player.dart b/lib/pages/player/player.dart index fc52decb..4ec39527 100644 --- a/lib/pages/player/player.dart +++ b/lib/pages/player/player.dart @@ -82,7 +82,7 @@ class PlayerView extends HookConsumerWidget { primaryEnd: Alignment.bottomLeft, secondaryBegin: Alignment.bottomRight, secondaryEnd: Alignment.topRight, - duration: const Duration(seconds: 25), + duration: const Duration(seconds: 15), primaryColors: [ palette.dominantColor?.color ?? theme.colorScheme.primary, palette.mutedColor?.color ?? theme.colorScheme.secondary,