|
|
@ -1,7 +1,9 @@
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:animations/animations.dart';
|
|
|
|
import 'package:animations/animations.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
|
|
|
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
@ -72,126 +74,143 @@ class ChatInputRow extends StatelessWidget {
|
|
|
|
: Container(),
|
|
|
|
: Container(),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
: <Widget>[
|
|
|
|
: <Widget>[
|
|
|
|
AnimatedContainer(
|
|
|
|
KeyBoardShortcuts(
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
child: AnimatedContainer(
|
|
|
|
height: 56,
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
width: controller.inputText.isEmpty ? 56 : 0,
|
|
|
|
height: 56,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: controller.inputText.isEmpty ? 56 : 0,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: const BoxDecoration(),
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
child: PopupMenuButton<String>(
|
|
|
|
decoration: const BoxDecoration(),
|
|
|
|
icon: const Icon(Icons.add_outlined),
|
|
|
|
child: PopupMenuButton<String>(
|
|
|
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
|
|
|
icon: const Icon(Icons.add_outlined),
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
|
|
|
<PopupMenuEntry<String>>[
|
|
|
|
itemBuilder: (BuildContext context) =>
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
<PopupMenuEntry<String>>[
|
|
|
|
value: 'file',
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Icon(Icons.attachment_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.sendFile),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
|
|
|
value: 'image',
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: Colors.blue,
|
|
|
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Icon(Icons.image_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.sendImage),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
value: 'camera',
|
|
|
|
value: 'file',
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
backgroundColor: Colors.purple,
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
child: Icon(Icons.camera_alt_outlined),
|
|
|
|
child: Icon(Icons.attachment_outlined),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context)!.openCamera),
|
|
|
|
title: Text(L10n.of(context)!.sendFile),
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
value: 'camera-video',
|
|
|
|
value: 'image',
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
backgroundColor: Colors.blue,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
child: Icon(Icons.videocam_outlined),
|
|
|
|
child: Icon(Icons.image_outlined),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context)!.openVideoCamera),
|
|
|
|
title: Text(L10n.of(context)!.sendImage),
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (controller.room!
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
.getImagePacks(ImagePackUsage.sticker)
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
.isNotEmpty)
|
|
|
|
value: 'camera',
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
child: ListTile(
|
|
|
|
value: 'sticker',
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
child: ListTile(
|
|
|
|
backgroundColor: Colors.purple,
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
backgroundColor: Colors.orange,
|
|
|
|
child: Icon(Icons.camera_alt_outlined),
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
),
|
|
|
|
child: Icon(Icons.emoji_emotions_outlined),
|
|
|
|
title: Text(L10n.of(context)!.openCamera),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context)!.sendSticker),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
value: 'camera-video',
|
|
|
|
value: 'location',
|
|
|
|
child: ListTile(
|
|
|
|
child: ListTile(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
backgroundColor: Colors.brown,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
child: Icon(Icons.videocam_outlined),
|
|
|
|
child: Icon(Icons.gps_fixed_outlined),
|
|
|
|
),
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.openVideoCamera),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context)!.shareLocation),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (controller.room!
|
|
|
|
],
|
|
|
|
.getImagePacks(ImagePackUsage.sticker)
|
|
|
|
|
|
|
|
.isNotEmpty)
|
|
|
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
|
|
|
value: 'sticker',
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: Colors.orange,
|
|
|
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Icon(Icons.emoji_emotions_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.sendSticker),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
|
|
|
value: 'location',
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
leading: const CircleAvatar(
|
|
|
|
|
|
|
|
backgroundColor: Colors.brown,
|
|
|
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
|
|
|
child: Icon(Icons.gps_fixed_outlined),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
title: Text(L10n.of(context)!.shareLocation),
|
|
|
|
|
|
|
|
contentPadding: const EdgeInsets.all(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
keysToPress: {
|
|
|
|
|
|
|
|
LogicalKeyboardKey.altLeft,
|
|
|
|
|
|
|
|
LogicalKeyboardKey.keyA
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onKeysPressed: () =>
|
|
|
|
|
|
|
|
controller.onAddPopupMenuButtonSelected('file'),
|
|
|
|
|
|
|
|
helpLabel: L10n.of(context)!.sendFile,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
height: 56,
|
|
|
|
height: 56,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: IconButton(
|
|
|
|
child: KeyBoardShortcuts(
|
|
|
|
tooltip: L10n.of(context)!.emojis,
|
|
|
|
child: IconButton(
|
|
|
|
icon: PageTransitionSwitcher(
|
|
|
|
tooltip: L10n.of(context)!.emojis,
|
|
|
|
transitionBuilder: (
|
|
|
|
icon: PageTransitionSwitcher(
|
|
|
|
Widget child,
|
|
|
|
transitionBuilder: (
|
|
|
|
Animation<double> primaryAnimation,
|
|
|
|
Widget child,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Animation<double> primaryAnimation,
|
|
|
|
) {
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
return SharedAxisTransition(
|
|
|
|
) {
|
|
|
|
animation: primaryAnimation,
|
|
|
|
return SharedAxisTransition(
|
|
|
|
secondaryAnimation: secondaryAnimation,
|
|
|
|
animation: primaryAnimation,
|
|
|
|
transitionType: SharedAxisTransitionType.scaled,
|
|
|
|
secondaryAnimation: secondaryAnimation,
|
|
|
|
child: child,
|
|
|
|
transitionType: SharedAxisTransitionType.scaled,
|
|
|
|
fillColor: Colors.transparent,
|
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
fillColor: Colors.transparent,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
child: Icon(
|
|
|
|
},
|
|
|
|
controller.showEmojiPicker
|
|
|
|
child: Icon(
|
|
|
|
? Icons.keyboard
|
|
|
|
controller.showEmojiPicker
|
|
|
|
: Icons.emoji_emotions_outlined,
|
|
|
|
? Icons.keyboard
|
|
|
|
key: ValueKey(controller.showEmojiPicker),
|
|
|
|
: Icons.emoji_emotions_outlined,
|
|
|
|
|
|
|
|
key: ValueKey(controller.showEmojiPicker),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: controller.emojiPickerAction,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: controller.emojiPickerAction,
|
|
|
|
keysToPress: {
|
|
|
|
|
|
|
|
LogicalKeyboardKey.altLeft,
|
|
|
|
|
|
|
|
LogicalKeyboardKey.keyE
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onKeysPressed: controller.emojiPickerAction,
|
|
|
|
|
|
|
|
helpLabel: L10n.of(context)!.emojis,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (controller.matrix!.isMultiAccount &&
|
|
|
|
if (controller.matrix!.isMultiAccount &&
|
|
|
|