| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -29,6 +29,7 @@ class ConversationList extends StatefulWidget { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					class _ConversationListState extends State<ConversationList> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  late ScrollController _scrollController; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  List<Conversation> conversations = []; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  List<Friend> friends = []; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -148,6 +149,8 @@ class _ConversationListState extends State<ConversationList> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  @override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  void initState() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    _scrollController = ScrollController(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    _scrollController.addListener(_scrollListener); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    super.initState(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    conversations.addAll(widget.conversations); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    friends.addAll(widget.friends); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -162,6 +165,7 @@ class _ConversationListState extends State<ConversationList> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return ListView.builder( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      controller: _scrollController, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      itemCount: conversations.length, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      shrinkWrap: false, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      physics: const AlwaysScrollableScrollPhysics(), | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -184,6 +188,21 @@ class _ConversationListState extends State<ConversationList> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    setState(() {}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  Future<void> _scrollListener() async { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if (!(_scrollController.offset >= _scrollController.position.maxScrollExtent)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    int page = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if (conversations.length > 19) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      page = conversations.length ~/ 20; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    await ConversationsService.updateConversations(page: page); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    onGoBack(null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  onGoBack(dynamic value) async { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    conversations = await ConversationsRepository.getConversations(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    friends = await FriendsRepository.getFriends(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |