|
|
|
@ -21,6 +21,7 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
|
|
|
|
|
const height = 48.0;
|
|
|
|
|
|
|
|
|
|
if (!controller.room.otherPartyCanReceiveMessages) {
|
|
|
|
@ -39,7 +40,71 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: controller.selectMode
|
|
|
|
|
? <Widget>[
|
|
|
|
|
if (controller.selectedEvents
|
|
|
|
|
.every((event) => event.status == EventStatus.error))
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: height,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
foregroundColor: theme.colorScheme.error,
|
|
|
|
|
),
|
|
|
|
|
onPressed: controller.deleteErrorEventsAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
const Icon(Icons.delete),
|
|
|
|
|
Text(L10n.of(context).delete),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: height,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: controller.forwardEventsAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
const Icon(Icons.keyboard_arrow_left_outlined),
|
|
|
|
|
Text(L10n.of(context).forward),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
controller.selectedEvents.length == 1
|
|
|
|
|
? controller.selectedEvents.first
|
|
|
|
|
.getDisplayEvent(controller.timeline!)
|
|
|
|
|
.status
|
|
|
|
|
.isSent
|
|
|
|
|
? SizedBox(
|
|
|
|
|
height: height,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: controller.replyAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(L10n.of(context).reply),
|
|
|
|
|
const Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
height: height,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: controller.sendAgainAction,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(L10n.of(context).tryToSendAgain),
|
|
|
|
|
const SizedBox(width: 4),
|
|
|
|
|
const Icon(Icons.send_outlined, size: 16),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
]
|
|
|
|
|
: <Widget>[
|
|
|
|
|
const SizedBox(width: 4),
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
duration: FluffyThemes.animationDuration,
|
|
|
|
@ -51,17 +116,18 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
child: PopupMenuButton<String>(
|
|
|
|
|
useRootNavigator: true,
|
|
|
|
|
enabled: !controller.selectMode,
|
|
|
|
|
icon: const Icon(Icons.add_circle_outline),
|
|
|
|
|
iconColor: theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
|
|
|
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
|
<PopupMenuEntry<String>>[
|
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: 'location',
|
|
|
|
|
child: ListTile(
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
backgroundColor:
|
|
|
|
|
theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
foregroundColor: theme.colorScheme.primaryContainer,
|
|
|
|
|
child: const Icon(Icons.gps_fixed_outlined),
|
|
|
|
|
),
|
|
|
|
@ -118,7 +184,6 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
decoration: const BoxDecoration(),
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
child: PopupMenuButton(
|
|
|
|
|
enabled: !controller.selectMode,
|
|
|
|
|
useRootNavigator: true,
|
|
|
|
|
icon: const Icon(Icons.camera_alt_outlined),
|
|
|
|
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
|
|
|
@ -128,7 +193,8 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
value: 'camera-video',
|
|
|
|
|
child: ListTile(
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
backgroundColor:
|
|
|
|
|
theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
foregroundColor: theme.colorScheme.primaryContainer,
|
|
|
|
|
child: const Icon(Icons.videocam_outlined),
|
|
|
|
|
),
|
|
|
|
@ -140,7 +206,8 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
value: 'camera',
|
|
|
|
|
child: ListTile(
|
|
|
|
|
leading: CircleAvatar(
|
|
|
|
|
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
backgroundColor:
|
|
|
|
|
theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
foregroundColor: theme.colorScheme.primaryContainer,
|
|
|
|
|
child: const Icon(Icons.camera_alt_outlined),
|
|
|
|
|
),
|
|
|
|
@ -179,8 +246,7 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
key: ValueKey(controller.showEmojiPicker),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onPressed:
|
|
|
|
|
controller.selectMode ? null : controller.emojiPickerAction,
|
|
|
|
|
onPressed: controller.emojiPickerAction,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (Matrix.of(context).isMultiAccount &&
|
|
|
|
@ -198,7 +264,6 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
child: InputBar(
|
|
|
|
|
room: controller.room,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
readOnly: controller.selectMode,
|
|
|
|
|
maxLines: 8,
|
|
|
|
|
autofocus: !PlatformInfos.isMobile,
|
|
|
|
|
keyboardType: TextInputType.multiline,
|
|
|
|
@ -227,9 +292,7 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Opacity(
|
|
|
|
|
opacity: controller.selectMode ? 0.66 : 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
Container(
|
|
|
|
|
height: height,
|
|
|
|
|
width: height,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
@ -237,9 +300,7 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
controller.sendController.text.isEmpty
|
|
|
|
|
? FloatingActionButton.small(
|
|
|
|
|
tooltip: L10n.of(context).voiceMessage,
|
|
|
|
|
onPressed: controller.selectMode
|
|
|
|
|
? null
|
|
|
|
|
: controller.voiceMessageAction,
|
|
|
|
|
onPressed: controller.voiceMessageAction,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
heroTag: null,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
@ -251,7 +312,7 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
)
|
|
|
|
|
: FloatingActionButton.small(
|
|
|
|
|
tooltip: L10n.of(context).send,
|
|
|
|
|
onPressed: controller.selectMode ? null : controller.send,
|
|
|
|
|
onPressed: controller.send,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
heroTag: null,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
@ -262,7 +323,6 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
|
child: const Icon(Icons.send_outlined),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|