feat: New video file picker button
This commit is contained in:
parent
63af3afde4
commit
00d219bae1
3 changed files with 99 additions and 77 deletions
|
|
@ -3201,5 +3201,7 @@
|
||||||
"allDevices": "All devices",
|
"allDevices": "All devices",
|
||||||
"crossVerifiedDevicesIfEnabled": "Cross verified devices if enabled",
|
"crossVerifiedDevicesIfEnabled": "Cross verified devices if enabled",
|
||||||
"crossVerifiedDevices": "Cross verified devices",
|
"crossVerifiedDevices": "Cross verified devices",
|
||||||
"verifiedDevicesOnly": "Verified devices only"
|
"verifiedDevicesOnly": "Verified devices only",
|
||||||
|
"takeAPhoto": "Take a photo",
|
||||||
|
"recordAVideo": "Record a video"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -548,10 +548,9 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendImageAction() async {
|
void sendImageAction() async {
|
||||||
final files = await selectFiles(
|
final files = await ImagePicker().pickMultipleMedia(
|
||||||
context,
|
imageQuality: null,
|
||||||
allowMultiple: true,
|
requestFullMetadata: false,
|
||||||
type: FileSelectorType.images,
|
|
||||||
);
|
);
|
||||||
if (files.isEmpty) return;
|
if (files.isEmpty) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,91 +109,112 @@ class ChatInputRow extends StatelessWidget {
|
||||||
]
|
]
|
||||||
: <Widget>[
|
: <Widget>[
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
AnimatedContainer(
|
AnimatedSize(
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
curve: FluffyThemes.animationCurve,
|
curve: FluffyThemes.animationCurve,
|
||||||
height: height,
|
child: controller.sendController.text.isNotEmpty
|
||||||
width: controller.sendController.text.isEmpty ? height : 0,
|
? null
|
||||||
alignment: Alignment.center,
|
: PopupMenuButton<String>(
|
||||||
clipBehavior: Clip.hardEdge,
|
icon: const Icon(Icons.add_circle_outline),
|
||||||
decoration: const BoxDecoration(),
|
iconColor: theme.colorScheme.onPrimaryContainer,
|
||||||
child: PopupMenuButton<String>(
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
||||||
icon: const Icon(Icons.add_outlined),
|
itemBuilder: (BuildContext context) =>
|
||||||
onSelected: controller.onAddPopupMenuButtonSelected,
|
<PopupMenuEntry<String>>[
|
||||||
itemBuilder: (BuildContext context) =>
|
if (PlatformInfos.isMobile)
|
||||||
<PopupMenuEntry<String>>[
|
PopupMenuItem<String>(
|
||||||
PopupMenuItem<String>(
|
value: 'location',
|
||||||
value: 'file',
|
child: ListTile(
|
||||||
child: ListTile(
|
leading: CircleAvatar(
|
||||||
leading: const CircleAvatar(
|
backgroundColor:
|
||||||
backgroundColor: Colors.green,
|
theme.colorScheme.onPrimaryContainer,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor:
|
||||||
child: Icon(Icons.attachment_outlined),
|
theme.colorScheme.primaryContainer,
|
||||||
),
|
child: const Icon(Icons.gps_fixed_outlined),
|
||||||
title: Text(L10n.of(context).sendFile),
|
),
|
||||||
contentPadding: const EdgeInsets.all(0),
|
title: Text(L10n.of(context).shareLocation),
|
||||||
),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
PopupMenuItem<String>(
|
),
|
||||||
value: 'image',
|
PopupMenuItem<String>(
|
||||||
child: ListTile(
|
value: 'image',
|
||||||
leading: const CircleAvatar(
|
child: ListTile(
|
||||||
backgroundColor: Colors.blue,
|
leading: CircleAvatar(
|
||||||
foregroundColor: Colors.white,
|
backgroundColor:
|
||||||
child: Icon(Icons.image_outlined),
|
theme.colorScheme.onPrimaryContainer,
|
||||||
),
|
foregroundColor:
|
||||||
title: Text(L10n.of(context).sendImage),
|
theme.colorScheme.primaryContainer,
|
||||||
contentPadding: const EdgeInsets.all(0),
|
child: const Icon(Icons.photo_album_outlined),
|
||||||
),
|
),
|
||||||
),
|
title: Text(L10n.of(context).openGallery),
|
||||||
if (PlatformInfos.isMobile)
|
contentPadding: const EdgeInsets.all(0),
|
||||||
PopupMenuItem<String>(
|
),
|
||||||
value: 'camera',
|
|
||||||
child: ListTile(
|
|
||||||
leading: const CircleAvatar(
|
|
||||||
backgroundColor: Colors.purple,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
child: Icon(Icons.camera_alt_outlined),
|
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).openCamera),
|
PopupMenuItem<String>(
|
||||||
contentPadding: const EdgeInsets.all(0),
|
value: 'file',
|
||||||
),
|
child: ListTile(
|
||||||
),
|
leading: CircleAvatar(
|
||||||
if (PlatformInfos.isMobile)
|
backgroundColor:
|
||||||
PopupMenuItem<String>(
|
theme.colorScheme.onPrimaryContainer,
|
||||||
value: 'camera-video',
|
foregroundColor:
|
||||||
child: ListTile(
|
theme.colorScheme.primaryContainer,
|
||||||
leading: const CircleAvatar(
|
child: const Icon(Icons.attachment_outlined),
|
||||||
backgroundColor: Colors.red,
|
),
|
||||||
foregroundColor: Colors.white,
|
title: Text(L10n.of(context).sendFile),
|
||||||
child: Icon(Icons.videocam_outlined),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).openVideoCamera),
|
],
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
if (PlatformInfos.isMobile)
|
||||||
|
AnimatedSize(
|
||||||
|
duration: FluffyThemes.animationDuration,
|
||||||
|
curve: FluffyThemes.animationCurve,
|
||||||
|
child: controller.sendController.text.isNotEmpty
|
||||||
|
? null
|
||||||
|
: PopupMenuButton(
|
||||||
|
icon: const Icon(Icons.camera_alt_outlined),
|
||||||
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
||||||
|
iconColor: theme.colorScheme.onPrimaryContainer,
|
||||||
|
itemBuilder: (context) => [
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'camera-video',
|
||||||
|
child: ListTile(
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.primaryContainer,
|
||||||
|
child: const Icon(Icons.videocam_outlined),
|
||||||
|
),
|
||||||
|
title: Text(L10n.of(context).recordAVideo),
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'camera',
|
||||||
|
child: ListTile(
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.primaryContainer,
|
||||||
|
child: const Icon(Icons.camera_alt_outlined),
|
||||||
|
),
|
||||||
|
title: Text(L10n.of(context).takeAPhoto),
|
||||||
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
height: height,
|
height: height,
|
||||||
width: height,
|
width: height,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
tooltip: L10n.of(context).emojis,
|
tooltip: L10n.of(context).emojis,
|
||||||
|
color: theme.colorScheme.onPrimaryContainer,
|
||||||
icon: PageTransitionSwitcher(
|
icon: PageTransitionSwitcher(
|
||||||
transitionBuilder: (
|
transitionBuilder: (
|
||||||
Widget child,
|
Widget child,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue