1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 15:03:22 +00:00
comunicmobile/lib/ui/widgets/tablet_mode/conversations/conversation_window_container.dart

56 lines
1.3 KiB
Dart
Raw Normal View History

2020-05-09 07:30:46 +00:00
import 'package:flutter/material.dart';
/// Conversation window
///
/// Simple container for a conversation
///
/// @author Pierre Hubert
class ConversationWindowContainer extends StatelessWidget {
final Widget icon;
2020-05-09 07:30:46 +00:00
final Widget title;
final void Function() onClose;
2020-05-09 08:20:44 +00:00
final void Function() onToggleCollapse;
2020-05-09 08:20:06 +00:00
final bool isCollapsed;
2020-05-09 07:30:46 +00:00
final Widget body;
const ConversationWindowContainer({
Key key,
this.icon,
2020-05-09 07:30:46 +00:00
@required this.title,
@required this.onClose,
@required this.body,
2020-05-09 08:20:44 +00:00
@required this.onToggleCollapse,
2020-05-09 08:20:06 +00:00
@required this.isCollapsed,
2020-05-09 07:30:46 +00:00
}) : assert(title != null),
assert(onClose != null),
assert(body != null),
2020-05-09 08:20:44 +00:00
assert(onToggleCollapse != null),
2020-05-09 08:20:06 +00:00
assert(isCollapsed != null),
2020-05-09 07:30:46 +00:00
super(key: key);
@override
Widget build(BuildContext context) {
return Card(
child: Container(
width: 300,
2020-05-09 08:20:06 +00:00
height: !isCollapsed ? 400 : 40,
2020-05-09 07:30:46 +00:00
child: Scaffold(
appBar: AppBar(
leading: icon,
2020-05-09 08:20:44 +00:00
title: GestureDetector(child: title, onTap: onToggleCollapse),
2020-05-09 07:30:46 +00:00
actions: <Widget>[
IconButton(icon: Icon(Icons.close), onPressed: onClose),
],
),
2020-05-09 08:20:06 +00:00
body: Visibility(
child: body,
visible: !isCollapsed,
maintainState: true,
),
2020-05-09 07:30:46 +00:00
),
),
);
}
}