|
|
|
@ -2,6 +2,7 @@ import 'dart:math';
|
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
|
|
|
|
|
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
|
|
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
|
import 'package:fluffychat/views/chat.dart';
|
|
|
|
|
import 'package:fluffychat/views/widgets/avatar.dart';
|
|
|
|
@ -415,6 +416,7 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (!controller.showEmojiPicker)
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
height: (controller.editEvent == null &&
|
|
|
|
@ -432,7 +434,8 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
return Container();
|
|
|
|
|
}
|
|
|
|
|
final emojis = List<String>.from(AppEmojis.emojis);
|
|
|
|
|
final allReactionEvents = controller.selectedEvents.first
|
|
|
|
|
final allReactionEvents = controller
|
|
|
|
|
.selectedEvents.first
|
|
|
|
|
.aggregatedEvents(
|
|
|
|
|
controller.timeline, RelationshipTypes.reaction)
|
|
|
|
|
?.where((event) =>
|
|
|
|
@ -507,9 +510,10 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
height: 1,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
),
|
|
|
|
|
controller.room.canSendDefaultMessages &&
|
|
|
|
|
controller.room.membership == Membership.join
|
|
|
|
|
? Container(
|
|
|
|
|
if (controller.room.canSendDefaultMessages &&
|
|
|
|
|
controller.room.membership == Membership.join &&
|
|
|
|
|
!controller.showEmojiPicker)
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
),
|
|
|
|
@ -524,8 +528,7 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
onPressed: controller.forwardEventsAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(Icons
|
|
|
|
|
.keyboard_arrow_left_outlined),
|
|
|
|
|
Icon(Icons.keyboard_arrow_left_outlined),
|
|
|
|
|
Text(L10n.of(context).forward),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -540,14 +543,12 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
? Container(
|
|
|
|
|
height: 56,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed:
|
|
|
|
|
controller.replyAction,
|
|
|
|
|
onPressed: controller.replyAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
L10n.of(context).reply),
|
|
|
|
|
Icon(Icons
|
|
|
|
|
.keyboard_arrow_right),
|
|
|
|
|
Text(L10n.of(context).reply),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.keyboard_arrow_right),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -574,15 +575,14 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
duration: Duration(milliseconds: 200),
|
|
|
|
|
height: 56,
|
|
|
|
|
width:
|
|
|
|
|
controller.inputText.isEmpty ? 56 : 0,
|
|
|
|
|
width: controller.inputText.isEmpty ? 56 : 0,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
child: PopupMenuButton<String>(
|
|
|
|
|
icon: Icon(Icons.add_outlined),
|
|
|
|
|
onSelected: controller
|
|
|
|
|
.onAddPopupMenuButtonSelected,
|
|
|
|
|
onSelected:
|
|
|
|
|
controller.onAddPopupMenuButtonSelected,
|
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
|
<PopupMenuEntry<String>>[
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
@ -591,11 +591,10 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.attachment_outlined),
|
|
|
|
|
child:
|
|
|
|
|
Icon(Icons.attachment_outlined),
|
|
|
|
|
),
|
|
|
|
|
title:
|
|
|
|
|
Text(L10n.of(context).sendFile),
|
|
|
|
|
title: Text(L10n.of(context).sendFile),
|
|
|
|
|
contentPadding: EdgeInsets.all(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -607,8 +606,7 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
child: Icon(Icons.image_outlined),
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
L10n.of(context).sendImage),
|
|
|
|
|
title: Text(L10n.of(context).sendImage),
|
|
|
|
|
contentPadding: EdgeInsets.all(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -619,11 +617,11 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: Colors.purple,
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.camera_alt_outlined),
|
|
|
|
|
child:
|
|
|
|
|
Icon(Icons.camera_alt_outlined),
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
L10n.of(context).openCamera),
|
|
|
|
|
title:
|
|
|
|
|
Text(L10n.of(context).openCamera),
|
|
|
|
|
contentPadding: EdgeInsets.all(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -634,11 +632,11 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.mic_none_outlined),
|
|
|
|
|
child:
|
|
|
|
|
Icon(Icons.mic_none_outlined),
|
|
|
|
|
),
|
|
|
|
|
title: Text(L10n.of(context)
|
|
|
|
|
.voiceMessage),
|
|
|
|
|
title: Text(
|
|
|
|
|
L10n.of(context).voiceMessage),
|
|
|
|
|
contentPadding: EdgeInsets.all(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -652,8 +650,8 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 4.0),
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.symmetric(vertical: 4.0),
|
|
|
|
|
child: InputBar(
|
|
|
|
|
room: controller.room,
|
|
|
|
|
minLines: 1,
|
|
|
|
@ -662,13 +660,11 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
keyboardType: !PlatformInfos.isMobile
|
|
|
|
|
? TextInputType.text
|
|
|
|
|
: TextInputType.multiline,
|
|
|
|
|
onSubmitted:
|
|
|
|
|
controller.onInputBarSubmitted,
|
|
|
|
|
onSubmitted: controller.onInputBarSubmitted,
|
|
|
|
|
focusNode: controller.inputFocus,
|
|
|
|
|
controller: controller.sendController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
hintText:
|
|
|
|
|
L10n.of(context).writeAMessage,
|
|
|
|
|
hintText: L10n.of(context).writeAMessage,
|
|
|
|
|
hintMaxLines: 1,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
@ -686,8 +682,7 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
child: IconButton(
|
|
|
|
|
tooltip: L10n.of(context).voiceMessage,
|
|
|
|
|
icon: Icon(Icons.mic_none_outlined),
|
|
|
|
|
onPressed:
|
|
|
|
|
controller.voiceMessageAction,
|
|
|
|
|
onPressed: controller.voiceMessageAction,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (!PlatformInfos.isMobile ||
|
|
|
|
@ -703,8 +698,19 @@ class ChatUI extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
height: controller.showEmojiPicker
|
|
|
|
|
? MediaQuery.of(context).size.height / 2
|
|
|
|
|
: 0,
|
|
|
|
|
child: controller.showEmojiPicker
|
|
|
|
|
? EmojiPicker(
|
|
|
|
|
onEmojiSelected: controller.onEmojiSelected,
|
|
|
|
|
onBackspacePressed: controller.cancelEmojiPicker,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|