mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 12:58:51 +00:00
Create window container
This commit is contained in:
parent
109ba3f04b
commit
af8e558d9f
@ -1,3 +1,8 @@
|
||||
import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/ui/widgets/tablet_mode/conversations/conversation_window_container.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Single conversation window
|
||||
@ -6,20 +11,30 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class ConversationWindow extends StatefulWidget {
|
||||
final int convID;
|
||||
final Function() onClose;
|
||||
|
||||
const ConversationWindow({
|
||||
Key key,
|
||||
@required this.convID,
|
||||
@required this.onClose,
|
||||
}) : assert(convID != null),
|
||||
assert(onClose != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_ConversationWindowState createState() => _ConversationWindowState();
|
||||
}
|
||||
|
||||
class _ConversationWindowState extends State<ConversationWindow> {
|
||||
class _ConversationWindowState extends SafeState<ConversationWindow> {
|
||||
Conversation _conversation;
|
||||
String _convTitle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card();//TODO : continue here
|
||||
return ConversationWindowContainer(
|
||||
title: Text(tr("Loading...")),
|
||||
onClose: widget.onClose,
|
||||
body: buildCenteredProgressBar(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Conversation window
|
||||
///
|
||||
/// Simple container for a conversation
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class ConversationWindowContainer extends StatelessWidget {
|
||||
final Widget title;
|
||||
final void Function() onClose;
|
||||
final Widget body;
|
||||
|
||||
const ConversationWindowContainer({
|
||||
Key key,
|
||||
@required this.title,
|
||||
@required this.onClose,
|
||||
@required this.body,
|
||||
}) : assert(title != null),
|
||||
assert(onClose != null),
|
||||
assert(body != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Container(
|
||||
width: 300,
|
||||
height: 400,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: title,
|
||||
actions: <Widget>[
|
||||
IconButton(icon: Icon(Icons.close), onPressed: onClose),
|
||||
],
|
||||
),
|
||||
body: body,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -34,5 +34,8 @@ class ConversationsAreaWidgetState extends State<ConversationsAreaWidget> {
|
||||
setState(() => _openConversations.add(convID));
|
||||
}
|
||||
|
||||
Widget _conversationWindow(int convID) => ConversationWindow(convID: convID);
|
||||
Widget _conversationWindow(int convID) => ConversationWindow(
|
||||
convID: convID,
|
||||
onClose: () => setState(() => _openConversations.remove(convID)),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user