mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 10:52:34 +01:00
feat: Add button to record a video on Android
This commit is contained in:
parent
72fa85831a
commit
6e224cf11c
@ -1596,6 +1596,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"openVideoCamera": "Open camera for a video",
|
||||||
|
"@openVideoCamera": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"oneClientLoggedOut": "One of your clients has been logged out",
|
"oneClientLoggedOut": "One of your clients has been logged out",
|
||||||
"@oneClientLoggedOut": {},
|
"@oneClientLoggedOut": {},
|
||||||
"addAccount": "Add account",
|
"addAccount": "Add account",
|
||||||
|
@ -347,6 +347,25 @@ class ChatController extends State<Chat> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void openVideoCameraAction() async {
|
||||||
|
// Make sure the textfield is unfocused before opening the camera
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
final file = await ImagePicker().pickVideo(source: ImageSource.camera);
|
||||||
|
if (file == null) return;
|
||||||
|
final bytes = await file.readAsBytes();
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: false,
|
||||||
|
builder: (c) => SendFileDialog(
|
||||||
|
file: MatrixVideoFile(
|
||||||
|
bytes: bytes,
|
||||||
|
name: file.path,
|
||||||
|
),
|
||||||
|
room: room,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void sendStickerAction() async {
|
void sendStickerAction() async {
|
||||||
final sticker = await showModalBottomSheet<ImagePackImageContent>(
|
final sticker = await showModalBottomSheet<ImagePackImageContent>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -764,6 +783,9 @@ class ChatController extends State<Chat> {
|
|||||||
if (choice == 'camera') {
|
if (choice == 'camera') {
|
||||||
openCameraAction();
|
openCameraAction();
|
||||||
}
|
}
|
||||||
|
if (choice == 'camera-video') {
|
||||||
|
openVideoCameraAction();
|
||||||
|
}
|
||||||
if (choice == 'sticker') {
|
if (choice == 'sticker') {
|
||||||
sendStickerAction();
|
sendStickerAction();
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,19 @@ class ChatInputRow extends StatelessWidget {
|
|||||||
contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (PlatformInfos.isMobile)
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'camera-video',
|
||||||
|
child: ListTile(
|
||||||
|
leading: const CircleAvatar(
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
child: Icon(Icons.videocam_outlined),
|
||||||
|
),
|
||||||
|
title: Text(L10n.of(context).openVideoCamera),
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
),
|
||||||
|
),
|
||||||
if (controller.room
|
if (controller.room
|
||||||
.getImagePacks(ImagePackUsage.sticker)
|
.getImagePacks(ImagePackUsage.sticker)
|
||||||
.isNotEmpty)
|
.isNotEmpty)
|
||||||
|
Loading…
Reference in New Issue
Block a user