Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Refactor: remove scaling and make memories widget of same size

AmanRajSinghMourya2bb839e26c05
diff --git a/mobile/lib/ui/home/memories/memories_widget.dart b/mobile/lib/ui/home/memories/memories_widget.dart
index 03625648b7..e3c9f69204 100644
--- a/mobile/lib/ui/home/memories/memories_widget.dart
+++ b/mobile/lib/ui/home/memories/memories_widget.dart
@@ -130,17 +130,11 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
controller: _controller,
itemCount: collatedMemories.length,
itemBuilder: (context, itemIndex) {
- final maxScaleOffsetX =
- _maxWidth + MemoryCoverWidget.horizontalPadding * 2;
- final offsetOfItem =
- (_maxWidth + MemoryCoverWidget.horizontalPadding * 2) * itemIndex;
return MemoryCoverWidget(
memories: collatedMemories[itemIndex].$1,
controller: _controller,
- offsetOfItem: offsetOfItem,
maxHeight: _maxHeight,
maxWidth: _maxWidth,
- maxScaleOffsetX: maxScaleOffsetX,
title: collatedMemories[itemIndex].$2,
);
},
diff --git a/mobile/lib/ui/home/memories/memory_cover_widget.dart b/mobile/lib/ui/home/memories/memory_cover_widget.dart
index 55f8db652c..f2754806df 100644
--- a/mobile/lib/ui/home/memories/memory_cover_widget.dart
+++ b/mobile/lib/ui/home/memories/memory_cover_widget.dart
@@ -11,22 +11,18 @@ import "package:photos/utils/navigation_util.dart";
class MemoryCoverWidget extends StatefulWidget {
final List<Memory> memories;
final ScrollController controller;
- final double offsetOfItem;
final double maxHeight;
final double maxWidth;
static const outerStrokeWidth = 1.0;
static const aspectRatio = 0.68;
static const horizontalPadding = 2.5;
- final double maxScaleOffsetX;
final String title;
const MemoryCoverWidget({
required this.memories,
required this.controller,
- required this.offsetOfItem,
required this.maxHeight,
required this.maxWidth,
- required this.maxScaleOffsetX,
required this.title,
super.key,
});
@@ -44,7 +40,6 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
return const SizedBox.shrink();
}
- final widthOfScreen = MediaQuery.sizeOf(context).width;
final index = _getNextMemoryIndex();
final title = widget.title;
@@ -56,9 +51,6 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
return AnimatedBuilder(
animation: widget.controller,
builder: (context, child) {
- final diff = (widget.controller.offset - widget.offsetOfItem) +
- widget.maxScaleOffsetX;
- final scale = 1 - (diff / widthOfScreen).abs() / 3.7;
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: MemoryCoverWidget.horizontalPadding,
@@ -81,8 +73,8 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
child: Row(
children: [
Container(
- height: widget.maxHeight * scale,
- width: widget.maxWidth * scale,
+ height: widget.maxHeight ,
+ width: widget.maxWidth ,
decoration: BoxDecoration(
boxShadow: brightness == Brightness.dark
? [
@@ -122,29 +114,26 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
),
),
Positioned(
- bottom: 8 * scale,
- child: Transform.scale(
- scale: scale,
- child: SizedBox(
- width: widget.maxWidth,
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0,
- ),
- child: Hero(
- tag: title,
- child: Center(
- child: Text(
- title,
- style: getEnteTextTheme(context)
- .miniBold
- .copyWith(
- color: isSeen
- ? textFaintDark
- : Colors.white,
- ),
- textAlign: TextAlign.left,
- ),
+ bottom: 8 ,
+ child: SizedBox(
+ width: widget.maxWidth,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8.0,
+ ),
+ child: Hero(
+ tag: title,
+ child: Center(
+ child: Text(
+ title,
+ style: getEnteTextTheme(context)
+ .miniBold
+ .copyWith(
+ color: isSeen
+ ? textFaintDark
+ : Colors.white,
+ ),
+ textAlign: TextAlign.left,
),
),
),
@@ -173,27 +162,24 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
),
),
Positioned(
- bottom: 8 * scale,
- child: Transform.scale(
- scale: scale,
- child: SizedBox(
- width: widget.maxWidth,
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0,
- ),
- child: Hero(
- tag: title,
- child: Center(
- child: Text(
- title,
- style: getEnteTextTheme(context)
- .miniBold
- .copyWith(
- color: Colors.white,
- ),
- textAlign: TextAlign.left,
- ),
+ bottom: 8 ,
+ child: SizedBox(
+ width: widget.maxWidth,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8.0,
+ ),
+ child: Hero(
+ tag: title,
+ child: Center(
+ child: Text(
+ title,
+ style: getEnteTextTheme(context)
+ .miniBold
+ .copyWith(
+ color: Colors.white,
+ ),
+ textAlign: TextAlign.left,
),
),
),