mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Get and show the name of conversation members
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import 'package:comunic/enums/load_error_level.dart';
 | 
			
		||||
import 'package:comunic/helpers/conversations_helper.dart';
 | 
			
		||||
import 'package:comunic/models/conversation.dart';
 | 
			
		||||
import 'package:comunic/helpers/users_helper.dart';
 | 
			
		||||
import 'package:comunic/lists/conversations_list.dart';
 | 
			
		||||
import 'package:comunic/ui/tiles/conversation_tile.dart';
 | 
			
		||||
import 'package:comunic/utils/intl_utils.dart';
 | 
			
		||||
import 'package:comunic/utils/ui_utils.dart';
 | 
			
		||||
@@ -17,7 +18,8 @@ class ConversationsScreen extends StatefulWidget {
 | 
			
		||||
 | 
			
		||||
class _ConversationScreenState extends State<ConversationsScreen> {
 | 
			
		||||
  final ConversationsHelper _conversationsHelper = ConversationsHelper();
 | 
			
		||||
  List<Conversation> _list;
 | 
			
		||||
  final UsersHelper _usersHelper = UsersHelper();
 | 
			
		||||
  ConversationsList _list;
 | 
			
		||||
  LoadErrorLevel _error = LoadErrorLevel.NONE;
 | 
			
		||||
  bool _loading = true;
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +33,7 @@ class _ConversationScreenState extends State<ConversationsScreen> {
 | 
			
		||||
 | 
			
		||||
  void setLoading(bool loading) => setState(() => _loading = loading);
 | 
			
		||||
 | 
			
		||||
  void gotLoadingError() {
 | 
			
		||||
  void _gotLoadingError() {
 | 
			
		||||
    setLoading(false);
 | 
			
		||||
    setError(_list == null ? LoadErrorLevel.MAJOR : LoadErrorLevel.MINOR);
 | 
			
		||||
  }
 | 
			
		||||
@@ -41,12 +43,18 @@ class _ConversationScreenState extends State<ConversationsScreen> {
 | 
			
		||||
    setError(LoadErrorLevel.NONE);
 | 
			
		||||
    setLoading(true);
 | 
			
		||||
 | 
			
		||||
    //Process the list of conversations
 | 
			
		||||
    final list = await _conversationsHelper.downloadList();
 | 
			
		||||
    if (list == null) return _gotLoadingError();
 | 
			
		||||
 | 
			
		||||
    if (list == null) return gotLoadingError();
 | 
			
		||||
    //Get information about the members of the conversations
 | 
			
		||||
    list.users = await _usersHelper.downloadInfo(list.allUsersID);
 | 
			
		||||
    if(list.users == null) return _gotLoadingError();
 | 
			
		||||
 | 
			
		||||
    //Save list
 | 
			
		||||
    _list = list;
 | 
			
		||||
    setState(() {
 | 
			
		||||
      _list = list;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    setLoading(false);
 | 
			
		||||
  }
 | 
			
		||||
@@ -79,6 +87,7 @@ class _ConversationScreenState extends State<ConversationsScreen> {
 | 
			
		||||
      itemBuilder: (context, index) {
 | 
			
		||||
        return ConversationTile(
 | 
			
		||||
          conversation: _list.elementAt(index),
 | 
			
		||||
          usersList: _list.users,
 | 
			
		||||
        );
 | 
			
		||||
      },
 | 
			
		||||
      itemCount: _list.length,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user