enhanced send video functionality by adding toggle send original

This commit is contained in:
Mubeen Rizvi 2024-02-18 21:50:20 +05:00
parent a6b5acb451
commit 49caebcaa8

View file

@ -37,7 +37,7 @@ class SendFileDialogState extends State<SendFileDialog> {
await showFutureLoadingDialog(
context: context,
future: () async {
file = await file.resizeVideo();
file = origImage ? file : await file.resizeVideo();
thumbnail = await file.getVideoThumbnail();
},
);
@ -126,6 +126,38 @@ class SendFileDialogState extends State<SendFileDialog> {
),
],
);
} else if (widget.files.every((file) => file is MatrixVideoFile)) {
contentWidget = Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(fileName),
const SizedBox(height: 16),
// Workaround for SwitchListTile.adaptive crashes in CupertinoDialog
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CupertinoSwitch(
value: origImage,
onChanged: (v) => setState(() => origImage = v),
),
const SizedBox(width: 16),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
L10n.of(context)!.sendOriginal,
style: const TextStyle(fontWeight: FontWeight.bold),
),
Text(sizeString),
],
),
),
],
),
],
);
} else {
contentWidget = Text('$fileName ($sizeString)');
}