2020-05-09 18:11:54 +00:00
|
|
|
import 'package:comunic/ui/widgets/custom_app_bar_size.dart';
|
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 {
|
2020-05-09 08:39:37 +00:00
|
|
|
final Color appBarBgColor;
|
2020-05-09 08:26:15 +00:00
|
|
|
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;
|
2020-05-09 10:16:55 +00:00
|
|
|
final List<Widget> action;
|
2020-05-09 07:30:46 +00:00
|
|
|
|
|
|
|
const ConversationWindowContainer({
|
|
|
|
Key key,
|
2020-05-09 08:39:37 +00:00
|
|
|
this.appBarBgColor,
|
2020-05-09 08:26:15 +00:00
|
|
|
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 10:16:55 +00:00
|
|
|
this.action,
|
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(
|
2020-05-09 18:11:54 +00:00
|
|
|
appBar: AppBarWrapper(
|
|
|
|
height: 40,
|
|
|
|
appBar: AppBar(
|
2021-02-07 16:09:08 +00:00
|
|
|
textTheme: TextTheme(headline6: TextStyle(fontSize: 15)),
|
2020-05-09 18:11:54 +00:00
|
|
|
backgroundColor: appBarBgColor,
|
|
|
|
leading: icon,
|
|
|
|
title: GestureDetector(child: title, onTap: onToggleCollapse),
|
|
|
|
actions: (action == null ? [] : action)
|
|
|
|
..add(
|
|
|
|
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
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|