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, room.sendTypingNotification(true,
timeout: Duration(seconds: 30).inMilliseconds); timeout: Duration(seconds: 30).inMilliseconds);
} }
// Workaround for a current desktop bug
if (!PlatformInfos.isBetaDesktop) {
setState(() => inputText = text); setState(() => inputText = text);
} }
}
void cancelReplyEventAction() => setState(() { void cancelReplyEventAction() => setState(() {
if (editEvent != null) { if (editEvent != null) {

View File

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