From e9f4dc63a8eefe1bcd8d456f046c0ef86abd821e Mon Sep 17 00:00:00 2001 From: Pedro Massango Date: Fri, 30 Sep 2022 21:54:51 +0200 Subject: [PATCH 1/3] Update photo_gallery.dart --- .../screens/photo_gallery/photo_gallery.dart | 67 +++++++++---------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/lib/ui/screens/photo_gallery/photo_gallery.dart b/lib/ui/screens/photo_gallery/photo_gallery.dart index f3475fff..28f77593 100644 --- a/lib/ui/screens/photo_gallery/photo_gallery.dart +++ b/lib/ui/screens/photo_gallery/photo_gallery.dart @@ -146,46 +146,41 @@ class _PhotoGalleryState extends State { gridOffset += Offset(0, -context.mq.padding.top / 2); final offsetTweenDuration = _skipNextOffsetTween ? Duration.zero : swipeDuration; final cutoutTweenDuration = _skipNextOffsetTween ? Duration.zero : swipeDuration * .5; - return Stack( - children: [ - // A overlay with a transparent middle sits on top of everything, animating itself each time index changes - _AnimatedCutoutOverlay( - animationKey: ValueKey(_index), - cutoutSize: imgSize, - swipeDir: _lastSwipeDir, - duration: cutoutTweenDuration, - opacity: _scale == 1 ? .7 : .5, - child: SafeArea( - bottom: false, - // Place content in overflow box, to allow it to flow outside the parent - child: OverflowBox( - maxWidth: _gridSize * imgSize.width + padding * (_gridSize - 1), - maxHeight: _gridSize * imgSize.height + padding * (_gridSize - 1), - alignment: Alignment.center, - // Detect swipes in order to change index - child: EightWaySwipeDetector( - onSwipe: _handleSwipe, - threshold: 30, - // A tween animation builder moves from image to image based on current offset - child: TweenAnimationBuilder( - tween: Tween(begin: gridOffset, end: gridOffset), - duration: offsetTweenDuration, - curve: Curves.easeOut, - builder: (_, value, child) => Transform.translate(offset: value, child: child), - child: GridView.count( - physics: NeverScrollableScrollPhysics(), - crossAxisCount: _gridSize, - childAspectRatio: imgSize.aspectRatio, - mainAxisSpacing: padding, - crossAxisSpacing: padding, - children: List.generate(_imgCount, (i) => _buildImage(i, swipeDuration, imgSize)), - ), - ), + return _AnimatedCutoutOverlay( + animationKey: ValueKey(_index), + cutoutSize: imgSize, + swipeDir: _lastSwipeDir, + duration: cutoutTweenDuration, + opacity: _scale == 1 ? .7 : .5, + child: SafeArea( + bottom: false, + // Place content in overflow box, to allow it to flow outside the parent + child: OverflowBox( + maxWidth: _gridSize * imgSize.width + padding * (_gridSize - 1), + maxHeight: _gridSize * imgSize.height + padding * (_gridSize - 1), + alignment: Alignment.center, + // Detect swipes in order to change index + child: EightWaySwipeDetector( + onSwipe: _handleSwipe, + threshold: 30, + // A tween animation builder moves from image to image based on current offset + child: TweenAnimationBuilder( + tween: Tween(begin: gridOffset, end: gridOffset), + duration: offsetTweenDuration, + curve: Curves.easeOut, + builder: (_, value, child) => Transform.translate(offset: value, child: child), + child: GridView.count( + physics: NeverScrollableScrollPhysics(), + crossAxisCount: _gridSize, + childAspectRatio: imgSize.aspectRatio, + mainAxisSpacing: padding, + crossAxisSpacing: padding, + children: List.generate(_imgCount, (i) => _buildImage(i, swipeDuration, imgSize)), ), ), ), ), - ], + ), ); }); } From 2fd363859a2c4e92056bdaf54f654643dd1c8f09 Mon Sep 17 00:00:00 2001 From: Prateek Sharma <39679158+TechieBlossom@users.noreply.github.com> Date: Mon, 3 Oct 2022 23:35:13 +0530 Subject: [PATCH 2/3] Just a spell correction --- lib/styles/colors.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/styles/colors.dart b/lib/styles/colors.dart index 989a1b5f..1409573b 100644 --- a/lib/styles/colors.dart +++ b/lib/styles/colors.dart @@ -24,7 +24,7 @@ class AppColors { TextTheme txtTheme = (isDark ? ThemeData.dark() : ThemeData.light()).textTheme; Color txtColor = white; ColorScheme colorScheme = ColorScheme( - // Decide how you want to apply your own custom them, to the MaterialApp + // Decide how you want to apply your own custom theme, to the MaterialApp brightness: isDark ? Brightness.dark : Brightness.light, primary: accent1, primaryContainer: accent1, From 02fe5c54ed513742b542a53421b89b055884848a Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 9 Nov 2022 09:25:28 -0700 Subject: [PATCH 3/3] Update _animated_arrow_button.dart --- lib/ui/screens/home/widgets/_animated_arrow_button.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ui/screens/home/widgets/_animated_arrow_button.dart b/lib/ui/screens/home/widgets/_animated_arrow_button.dart index 54de2f42..96f07789 100644 --- a/lib/ui/screens/home/widgets/_animated_arrow_button.dart +++ b/lib/ui/screens/home/widgets/_animated_arrow_button.dart @@ -7,11 +7,13 @@ class _AnimatedArrowButton extends StatelessWidget { final String semanticTitle; final VoidCallback onTap; + // Fades to 0 and back to 1 final _fadeOutIn = TweenSequence([ TweenSequenceItem(tween: Tween(begin: 1, end: 0), weight: .5), TweenSequenceItem(tween: Tween(begin: 0, end: 1), weight: .5), ]); + // Holds top alignment for first half, then jumps down and slides back up final _slideDown = TweenSequence([ TweenSequenceItem(tween: Tween(begin: 1, end: 1), weight: .5), TweenSequenceItem(tween: Tween(begin: -1, end: 1), weight: .5)