mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Ready to build conversation windows
This commit is contained in:
parent
68b4c79960
commit
109ba3f04b
@ -15,7 +15,9 @@ class TabletRoute extends StatefulWidget implements MainRoute {
|
||||
_TabletRouteState createState() => _TabletRouteState();
|
||||
}
|
||||
|
||||
class _TabletRouteState extends State<TabletRoute> {
|
||||
class _TabletRouteState extends State<MainRoute> implements MainController {
|
||||
final _conversationsKey = GlobalKey<ConversationsAreaWidgetState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -29,7 +31,11 @@ class _TabletRouteState extends State<TabletRoute> {
|
||||
Widget _buildBody() => Stack(
|
||||
children: [
|
||||
Row(children: <Widget>[_buildLeftPane(), _buildRightPane()]),
|
||||
Positioned(right: 0, bottom: 0, child: ConversationsAreaWidget())
|
||||
Positioned(
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: ConversationsAreaWidget(key: _conversationsKey),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
@ -54,4 +60,44 @@ class _TabletRouteState extends State<TabletRoute> {
|
||||
);
|
||||
|
||||
Widget _buildRightPane() => Container();
|
||||
|
||||
@override
|
||||
void openConversation(int convID, {fullScreen = false}) {
|
||||
_conversationsKey.currentState.openConversations(convID);
|
||||
}
|
||||
|
||||
@override
|
||||
void openGroup(int groupID) {
|
||||
// TODO: implement openGroup
|
||||
}
|
||||
|
||||
@override
|
||||
void openUserAccessDeniedPage(int userID) {
|
||||
// TODO: implement openUserAccessDeniedPage
|
||||
}
|
||||
|
||||
@override
|
||||
void openUserFriendsList(int userID) {
|
||||
// TODO: implement openUserFriendsList
|
||||
}
|
||||
|
||||
@override
|
||||
void openUserPage(int userID) {
|
||||
// TODO: implement openUserPage
|
||||
}
|
||||
|
||||
@override
|
||||
void popPage() {
|
||||
// TODO: implement popPage
|
||||
}
|
||||
|
||||
@override
|
||||
void push(Widget w, {bool hideNavBar}) {
|
||||
// TODO: implement push
|
||||
}
|
||||
|
||||
@override
|
||||
void startCall(int convID) {
|
||||
// TODO: implement startCall
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Single conversation window
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class ConversationWindow extends StatefulWidget {
|
||||
final int convID;
|
||||
|
||||
const ConversationWindow({
|
||||
Key key,
|
||||
@required this.convID,
|
||||
}) : assert(convID != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_ConversationWindowState createState() => _ConversationWindowState();
|
||||
}
|
||||
|
||||
class _ConversationWindowState extends State<ConversationWindow> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card();//TODO : continue here
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import 'package:comunic/ui/widgets/tablet_mode/conversations/conversation_window.dart';
|
||||
import 'package:comunic/ui/widgets/tablet_mode/conversations/open_conversation_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -8,19 +9,30 @@ import 'package:flutter/material.dart';
|
||||
/// @author Pierre
|
||||
|
||||
class ConversationsAreaWidget extends StatefulWidget {
|
||||
const ConversationsAreaWidget({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ConversationsAreaWidgetState createState() =>
|
||||
_ConversationsAreaWidgetState();
|
||||
ConversationsAreaWidgetState createState() => ConversationsAreaWidgetState();
|
||||
}
|
||||
|
||||
class _ConversationsAreaWidgetState extends State<ConversationsAreaWidget> {
|
||||
class ConversationsAreaWidgetState extends State<ConversationsAreaWidget> {
|
||||
final _openConversations = Set<int>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[_buildOpenButton()],
|
||||
children: _openConversations.map(_conversationWindow).toList()
|
||||
..add(_buildOpenButton()),
|
||||
);
|
||||
}
|
||||
|
||||
/// Add a button to open new conversations
|
||||
Widget _buildOpenButton() => OpenConversationButton();
|
||||
|
||||
/// Open a new conversation
|
||||
void openConversations(int convID) {
|
||||
setState(() => _openConversations.add(convID));
|
||||
}
|
||||
|
||||
Widget _conversationWindow(int convID) => ConversationWindow(convID: convID);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'package:comunic/lists/memberships_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/friend.dart';
|
||||
import 'package:comunic/models/membership.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
||||
import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
||||
@ -169,6 +170,7 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
||||
ConversationsHelper.getConversationName(conversation, _usersList)),
|
||||
subtitle: Text(diffTimeFromNowToStr(membership.lastActive) +
|
||||
(conversation.isHavingCall ? "\n" + tr("Ongoing call") : "")),
|
||||
onTap: () => MainController.of(context).openConversation(conversation.id),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user