فهرست منبع

Show loading state on search tab init (#1617)

Vishnu Mohandas 1 سال پیش
والد
کامیت
84aa9b88d2
1فایلهای تغییر یافته به همراه16 افزوده شده و 2 حذف شده
  1. 16 2
      lib/ui/search_tab.dart

+ 16 - 2
lib/ui/search_tab.dart

@@ -1,5 +1,6 @@
 import "package:fade_indexed_stack/fade_indexed_stack.dart";
 import "package:flutter/material.dart";
+import "package:flutter_animate/flutter_animate.dart";
 import "package:photos/core/constants.dart";
 import "package:photos/models/search/search_result.dart";
 import "package:photos/models/search/search_types.dart";
@@ -76,7 +77,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
             future: InheritedAllSectionsExamples.of(context)
                 .allSectionsExamplesFuture,
             builder: (context, snapshot) {
-              if (snapshot.hasData) {
+              if (snapshot.hasData && snapshot.data!.isNotEmpty) {
                 if (snapshot.data!.every((element) => element.isEmpty)) {
                   return const Padding(
                     padding: EdgeInsets.only(bottom: 72),
@@ -94,7 +95,20 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
                       limit: searchSectionLimit,
                     );
                   },
-                );
+                )
+                    .animate(
+                      delay: const Duration(milliseconds: 150),
+                    )
+                    .slide(
+                      begin: const Offset(0, -0.015),
+                      end: const Offset(0, 0),
+                      duration: const Duration(milliseconds: 300),
+                      curve: Curves.easeOut,
+                    )
+                    .fadeIn(
+                      duration: const Duration(milliseconds: 150),
+                      curve: Curves.easeOut,
+                    );
               } else if (snapshot.hasError) {
                 //Errors are handled and this else if condition will be false always
                 //is the understanding.