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