1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 06:53:23 +00:00
comunicmobile/lib/ui/widgets/tablet_mode/conversations/conversation_window_container.dart
2021-02-07 17:09:08 +01:00

66 lines
1.8 KiB
Dart

import 'package:comunic/ui/widgets/custom_app_bar_size.dart';
import 'package:flutter/material.dart';
/// Conversation window
///
/// Simple container for a conversation
///
/// @author Pierre Hubert
class ConversationWindowContainer extends StatelessWidget {
final Color appBarBgColor;
final Widget icon;
final Widget title;
final void Function() onClose;
final void Function() onToggleCollapse;
final bool isCollapsed;
final Widget body;
final List<Widget> action;
const ConversationWindowContainer({
Key key,
this.appBarBgColor,
this.icon,
@required this.title,
@required this.onClose,
@required this.body,
@required this.onToggleCollapse,
@required this.isCollapsed,
this.action,
}) : assert(title != null),
assert(onClose != null),
assert(body != null),
assert(onToggleCollapse != null),
assert(isCollapsed != null),
super(key: key);
@override
Widget build(BuildContext context) {
return Card(
child: Container(
width: 300,
height: !isCollapsed ? 400 : 40,
child: Scaffold(
appBar: AppBarWrapper(
height: 40,
appBar: AppBar(
textTheme: TextTheme(headline6: TextStyle(fontSize: 15)),
backgroundColor: appBarBgColor,
leading: icon,
title: GestureDetector(child: title, onTap: onToggleCollapse),
actions: (action == null ? [] : action)
..add(
IconButton(icon: Icon(Icons.close), onPressed: onClose),
),
)),
body: Visibility(
child: body,
visible: !isCollapsed,
maintainState: true,
),
),
),
);
}
}