mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Created conversation route
This commit is contained in:
@ -2,6 +2,7 @@ import 'package:comunic/enums/load_error_level.dart';
|
||||
import 'package:comunic/helpers/conversations_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/conversations_list.dart';
|
||||
import 'package:comunic/ui/routes/conversation_route.dart';
|
||||
import 'package:comunic/ui/tiles/conversation_tile.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
@ -11,12 +12,12 @@ import 'package:flutter/material.dart';
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class ConversationsScreen extends StatefulWidget {
|
||||
class ConversationsListScreen extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ConversationScreenState();
|
||||
}
|
||||
|
||||
class _ConversationScreenState extends State<ConversationsScreen> {
|
||||
class _ConversationScreenState extends State<ConversationsListScreen> {
|
||||
final ConversationsHelper _conversationsHelper = ConversationsHelper();
|
||||
final UsersHelper _usersHelper = UsersHelper();
|
||||
ConversationsList _list;
|
||||
@ -88,6 +89,13 @@ class _ConversationScreenState extends State<ConversationsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Open a conversation
|
||||
void _openConversation(BuildContext context, int conversationId){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (c){
|
||||
return ConversationRoute(conversationID: conversationId,);
|
||||
}));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_error == LoadErrorLevel.MAJOR) return _buildErrorCard();
|
||||
@ -103,10 +111,12 @@ class _ConversationScreenState extends State<ConversationsScreen> {
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
controller: ScrollController(),
|
||||
itemBuilder: (context, index) {
|
||||
return ConversationTile(
|
||||
conversation: _list.elementAt(index),
|
||||
usersList: _list.users,
|
||||
onOpen: (c){_openConversation(context, c.id);},
|
||||
);
|
||||
},
|
||||
itemCount: _list.length,
|
Reference in New Issue
Block a user