mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Continue to fix issues
This commit is contained in:
parent
3a997cdc56
commit
299a95ea45
@ -1,5 +1,4 @@
|
|||||||
import 'dart:collection';
|
import 'package:comunic/lists/abstract_list.dart';
|
||||||
|
|
||||||
import 'package:comunic/models/comment.dart';
|
import 'package:comunic/models/comment.dart';
|
||||||
|
|
||||||
/// Comments list
|
/// Comments list
|
||||||
@ -8,19 +7,7 @@ import 'package:comunic/models/comment.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
class CommentsList extends ListBase<Comment> {
|
class CommentsList extends AbstractList<Comment> {
|
||||||
List<Comment> _list = [];
|
|
||||||
|
|
||||||
int get length => _list.length;
|
|
||||||
|
|
||||||
set length(int l) => _list.length = l;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Comment operator [](int index) => _list[index];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void operator []=(int index, Comment value) => _list[index] = value;
|
|
||||||
|
|
||||||
/// Get the list of users in this comments, as a set
|
/// Get the list of users in this comments, as a set
|
||||||
Set<int> get usersID => map((f) => f.userID).toSet();
|
Set<int> get usersID => map((f) => f.userID).toSet();
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
import 'dart:collection';
|
import 'package:comunic/lists/abstract_list.dart';
|
||||||
|
|
||||||
import 'package:comunic/models/friend.dart';
|
import 'package:comunic/models/friend.dart';
|
||||||
|
|
||||||
/// List of friends of the user
|
/// List of friends of the user
|
||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
class FriendsList extends ListBase<Friend> {
|
class FriendsList extends AbstractList<Friend> {
|
||||||
List<Friend> _list = [];
|
|
||||||
|
|
||||||
int get length => _list.length;
|
|
||||||
|
|
||||||
set length(int length) => _list.length = length;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Friend operator [](int index) => _list[index];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void operator []=(int index, Friend value) => _list[index] = value;
|
|
||||||
|
|
||||||
/// Get the ID of all the friends of the current user
|
/// Get the ID of all the friends of the current user
|
||||||
List<int> get usersId => map((f) => f.id).toList();
|
List<int> get usersId => map((f) => f.id).toList();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'dart:collection';
|
import 'package:comunic/lists/abstract_list.dart';
|
||||||
|
|
||||||
import 'package:comunic/models/post.dart';
|
import 'package:comunic/models/post.dart';
|
||||||
|
|
||||||
/// Posts List
|
/// Posts List
|
||||||
@ -8,19 +7,7 @@ import 'package:comunic/models/post.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
class PostsList extends ListBase<Post> {
|
class PostsList extends AbstractList<Post> {
|
||||||
List<Post> _list = [];
|
|
||||||
|
|
||||||
int get length => _list.length;
|
|
||||||
|
|
||||||
set length(int l) => _list.length = l;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Post operator [](int index) => _list[index];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void operator []=(int index, Post value) => _list[index] = value;
|
|
||||||
|
|
||||||
// Get the list of users ID in this set
|
// Get the list of users ID in this set
|
||||||
Set<int?> get usersID {
|
Set<int?> get usersID {
|
||||||
Set<int?> set = Set();
|
Set<int?> set = Set();
|
||||||
@ -49,8 +36,7 @@ class PostsList extends ListBase<Post> {
|
|||||||
|
|
||||||
/// Get the ID of the oldest post of this list. Returns 0 if the list is empty
|
/// Get the ID of the oldest post of this list. Returns 0 if the list is empty
|
||||||
int get oldestID {
|
int get oldestID {
|
||||||
if(isEmpty)
|
if (isEmpty) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
return this.elementAt(length - 1).id;
|
return this.elementAt(length - 1).id;
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,7 @@ class PostsListWidget extends StatefulWidget {
|
|||||||
this.getOlder,
|
this.getOlder,
|
||||||
this.topWidgets,
|
this.topWidgets,
|
||||||
this.disablePullToRefresh = false,
|
this.disablePullToRefresh = false,
|
||||||
}) : assert(getPostsList != null),
|
}) : super(key: key);
|
||||||
assert(showPostsTarget != null),
|
|
||||||
assert(buildListView != null),
|
|
||||||
assert(userNamesClickable != null),
|
|
||||||
assert(disablePullToRefresh != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => PostsListWidgetState();
|
State<StatefulWidget> createState() => PostsListWidgetState();
|
||||||
|
Loading…
Reference in New Issue
Block a user