Forráskód Böngészése

Added better animation for 'Reset ignore files' container

ashilkn 2 éve
szülő
commit
2ff3232de0
1 módosított fájl, 40 hozzáadás és 34 törlés
  1. 40 34
      lib/ui/viewer/gallery/device_folder_page.dart

+ 40 - 34
lib/ui/viewer/gallery/device_folder_page.dart

@@ -148,48 +148,26 @@ class _BackupHeaderWidgetState extends State<BackupHeaderWidget> {
               FutureBuilder(
                 future: _hasIgnoredFiles(filesInDeviceCollection),
                 builder: (context, snapshot) {
-                  Widget child;
+                  bool shouldShowReset = false;
                   if (snapshot.hasData &&
                       snapshot.data as bool &&
                       shouldBackup.value) {
-                    child = Column(
-                      children: [
-                        const SizedBox(height: 24),
-                        MenuItemWidget(
-                          captionedTextWidget: const CaptionedTextWidget(
-                            title: "Reset ignored files",
-                          ),
-                          borderRadius: 8.0,
-                          menuItemColor: colorScheme.fillFaint,
-                          leadingIcon: Icons.cloud_off_outlined,
-                          onTap: () async {
-                            await _removeFilesFromIgnoredFiles(
-                              filesInDeviceCollection,
-                            );
-                            RemoteSyncService.instance
-                                .sync(silently: true)
-                                .then((value) {
-                              setState(() {});
-                            });
-                          },
-                        ),
-                        const MenuSectionDescriptionWidget(
-                          content:
-                              "Some files in this album are ignored from upload because they had previously been deleted from ente.",
-                        ),
-                      ],
-                    );
+                    shouldShowReset = true;
                   } else if (snapshot.hasError) {
                     Logger("BackupHeaderWidget").severe(
                       "Could not check if collection has ignored files",
                     );
-                    child = const SizedBox.shrink();
-                  } else {
-                    child = const SizedBox.shrink();
                   }
-                  return AnimatedSwitcher(
-                    duration: const Duration(milliseconds: 48),
-                    child: child,
+                  return AnimatedCrossFade(
+                    firstCurve: Curves.easeInOutExpo,
+                    secondCurve: Curves.easeInOutExpo,
+                    sizeCurve: Curves.easeInOutExpo,
+                    firstChild: firstChild(),
+                    secondChild: const SizedBox(width: double.infinity),
+                    crossFadeState: shouldShowReset
+                        ? CrossFadeState.showFirst
+                        : CrossFadeState.showSecond,
+                    duration: const Duration(milliseconds: 1000),
                   );
                 },
               )
@@ -200,6 +178,34 @@ class _BackupHeaderWidgetState extends State<BackupHeaderWidget> {
     );
   }
 
+  Widget firstChild() {
+    return Column(
+      children: [
+        const SizedBox(height: 24),
+        MenuItemWidget(
+          captionedTextWidget: const CaptionedTextWidget(
+            title: "Reset ignored files",
+          ),
+          borderRadius: 8.0,
+          menuItemColor: getEnteColorScheme(context).fillFaint,
+          leadingIcon: Icons.cloud_off_outlined,
+          onTap: () async {
+            await _removeFilesFromIgnoredFiles(
+              filesInDeviceCollection,
+            );
+            RemoteSyncService.instance.sync(silently: true).then((value) {
+              setState(() {});
+            });
+          },
+        ),
+        const MenuSectionDescriptionWidget(
+          content:
+              "Some files in this album are ignored from upload because they had previously been deleted from ente.",
+        ),
+      ],
+    );
+  }
+
   Future<List<File>> _filesInDeviceCollection() async {
     return (await FilesDB.instance.getFilesInDeviceCollection(
       widget.deviceCollection,