feat: Cute animation for hiding the + button in inputbar

This commit is contained in:
Christian Pauly 2021-05-20 13:33:06 +02:00
parent 301eecb53c
commit 37c40a2cb5
2 changed files with 56 additions and 59 deletions

View File

@ -652,11 +652,8 @@ class ChatController extends State<Chat> {
room.sendTypingNotification(true,
timeout: Duration(seconds: 30).inMilliseconds);
}
// Workaround for a current desktop bug
if (!PlatformInfos.isBetaDesktop) {
setState(() => inputText = text);
}
}
void cancelReplyEventAction() => setState(() {
if (editEvent != null) {

View File

@ -571,10 +571,14 @@ class ChatUI extends StatelessWidget {
: Container(),
]
: <Widget>[
if (controller.inputText.isEmpty)
Container(
AnimatedContainer(
duration: Duration(milliseconds: 200),
height: 56,
width:
controller.inputText.isEmpty ? 56 : 0,
alignment: Alignment.center,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(),
child: PopupMenuButton<String>(
icon: Icon(Icons.add_outlined),
onSelected: controller
@ -590,8 +594,8 @@ class ChatUI extends StatelessWidget {
child: Icon(
Icons.attachment_outlined),
),
title: Text(
L10n.of(context).sendFile),
title:
Text(L10n.of(context).sendFile),
contentPadding: EdgeInsets.all(0),
),
),
@ -601,8 +605,7 @@ class ChatUI extends StatelessWidget {
leading: CircleAvatar(
backgroundColor: Colors.blue,
foregroundColor: Colors.white,
child:
Icon(Icons.image_outlined),
child: Icon(Icons.image_outlined),
),
title: Text(
L10n.of(context).sendImage),
@ -614,16 +617,14 @@ class ChatUI extends StatelessWidget {
value: 'camera',
child: ListTile(
leading: CircleAvatar(
backgroundColor:
Colors.purple,
backgroundColor: Colors.purple,
foregroundColor: Colors.white,
child: Icon(Icons
.camera_alt_outlined),
child: Icon(
Icons.camera_alt_outlined),
),
title: Text(L10n.of(context)
.openCamera),
contentPadding:
EdgeInsets.all(0),
title: Text(
L10n.of(context).openCamera),
contentPadding: EdgeInsets.all(0),
),
),
if (PlatformInfos.isMobile)
@ -638,8 +639,7 @@ class ChatUI extends StatelessWidget {
),
title: Text(L10n.of(context)
.voiceMessage),
contentPadding:
EdgeInsets.all(0),
contentPadding: EdgeInsets.all(0),
),
),
],