Pārlūkot izejas kodu

Memories final fixes (#1662)

Vishnu Mohandas 1 gadu atpakaļ
vecāks
revīzija
c982ddd347

+ 5 - 9
lib/ui/home/header_widget.dart

@@ -1,12 +1,9 @@
 import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
-import 'package:photos/ui/home/memories/memories_widget.dart';
+import "package:photos/ui/home/memories/memories_widget.dart";
 import 'package:photos/ui/home/status_bar_widget.dart';
 
 class HeaderWidget extends StatelessWidget {
-  static const _memoriesWidget = MemoriesWidget();
-  static const _statusBarWidget = StatusBarWidget();
-
   const HeaderWidget({
     Key? key,
   }) : super(key: key);
@@ -14,13 +11,12 @@ class HeaderWidget extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     Logger("Header").info("Building header widget");
-    const list = [
-      _statusBarWidget,
-      _memoriesWidget,
-    ];
     return const Column(
       crossAxisAlignment: CrossAxisAlignment.start,
-      children: list,
+      children: [
+        StatusBarWidget(),
+        MemoriesWidget(),
+      ],
     );
   }
 }

+ 8 - 8
lib/ui/home/memories/full_screen_memory.dart

@@ -154,13 +154,13 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
         automaticallyImplyLeading: false,
         title: ValueListenableBuilder(
           valueListenable: inheritedData.indexNotifier,
-          child: Padding(
-            padding: const EdgeInsets.only(right: 16),
-            child: InkWell(
-              onTap: () {
-                Navigator.pop(context);
-              },
-              child: const Icon(
+          child: InkWell(
+            onTap: () {
+              Navigator.pop(context);
+            },
+            child: const Padding(
+              padding: EdgeInsets.fromLTRB(4, 8, 8, 8),
+              child: Icon(
                 Icons.close,
                 color: Colors.white, //same for both themes
               ),
@@ -180,7 +180,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
                       )
                     : const SizedBox.shrink(),
                 const SizedBox(
-                  height: 18,
+                  height: 10,
                 ),
                 Row(
                   children: [

+ 9 - 11
lib/ui/home/memories/memories_widget.dart

@@ -6,7 +6,6 @@ import "package:photos/core/event_bus.dart";
 import "package:photos/events/memories_setting_changed.dart";
 import 'package:photos/models/memory.dart';
 import 'package:photos/services/memories_service.dart';
-import "package:photos/ui/common/loading_widget.dart";
 import 'package:photos/ui/home/memories/memory_cover_widget.dart';
 
 class MemoriesWidget extends StatefulWidget {
@@ -58,10 +57,12 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
     return FutureBuilder<List<Memory>>(
       future: MemoriesService.instance.getMemories(),
       builder: (context, snapshot) {
-        if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) {
+        if (snapshot.hasData && snapshot.data!.isEmpty) {
+          return const SizedBox.shrink();
+        }
+        if (snapshot.hasError || !snapshot.hasData) {
           return SizedBox(
             height: _maxHeight + 12 + 10,
-            child: const EnteLoadingWidget(),
           );
         } else {
           return Column(
@@ -73,7 +74,10 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
               _buildMemories(snapshot.data!),
               const SizedBox(height: 10),
             ],
-          );
+          ).animate().fadeIn(
+                duration: const Duration(milliseconds: 250),
+                curve: Curves.easeInOutCirc,
+              );
         }
       },
     );
@@ -97,13 +101,7 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
             offsetOfItem: offsetOfItem,
             maxHeight: _maxHeight,
             maxWidth: _maxWidth,
-          )
-              .animate(delay: Duration(milliseconds: 75 * itemIndex))
-              .fadeIn(
-                duration: const Duration(milliseconds: 250),
-                curve: Curves.easeInOutCubic,
-              )
-              .slideX(begin: 0.04, end: 0);
+          );
         },
       ),
     );

+ 8 - 10
lib/ui/huge_listview/draggable_scrollbar.dart

@@ -103,16 +103,14 @@ class DraggableScrollbarState extends State<DraggableScrollbar>
 
   @override
   Widget build(BuildContext context) {
-    if (widget.isEnabled) {
-      return Stack(
-        children: [
-          RepaintBoundary(child: widget.child),
-          RepaintBoundary(child: buildThumb()),
-        ],
-      );
-    } else {
-      return widget.child;
-    }
+    return Stack(
+      children: [
+        RepaintBoundary(child: widget.child),
+        widget.isEnabled
+            ? RepaintBoundary(child: buildThumb())
+            : const SizedBox.shrink(),
+      ],
+    );
   }
 
   Widget buildThumb() => Padding(

+ 1 - 1
pubspec.yaml

@@ -12,7 +12,7 @@ description: ente photos application
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 
-version: 0.8.42+562
+version: 0.8.43+563
 
 environment:
   sdk: ">=3.0.0 <4.0.0"