Browse Source

Fix errors in the memory widget

Vishnu Mohandas 5 năm trước cách đây
mục cha
commit
0b640bf322
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      lib/ui/memories_widget.dart

+ 3 - 3
lib/ui/memories_widget.dart

@@ -87,7 +87,7 @@ class MemoryWidget extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    final index = _getUnseenMemoryIndex();
+    final index = _getNextMemoryIndex();
     final title = _getTitle(memories[index]);
     return GestureDetector(
       onTap: () {
@@ -147,7 +147,7 @@ class MemoryWidget extends StatelessWidget {
     );
   }
 
-  int _getUnseenMemoryIndex() {
+  int _getNextMemoryIndex() {
     for (var index = 0; index < memories.length; index++) {
       if (!memories[index].isSeen()) {
         return index;
@@ -261,7 +261,6 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
                 autoPlay: true,
               );
       },
-      index: _index,
       itemCount: widget.memories.length,
       pagination: SwiperPagination(
           alignment: Alignment.bottomCenter,
@@ -279,6 +278,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
         setState(() {
           _index = index;
         });
+        return index;
       },
     );
   }