mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-30 00:36:28 +00:00
66 lines
1.8 KiB
Dart
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(title: 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,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|