Show loading state on search tab init (#1617)

This commit is contained in:
Vishnu Mohandas 2023-12-20 22:43:11 +05:30 committed by GitHub
commit 84aa9b88d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.