chore: defaultly save files on Android
- defaultly save files on Android instead of share - add dedicated share button for files and images on Android - use ListTile instead of row to display file event - update file_picker_cross Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
14a6047fef
commit
49caad00c0
9 changed files with 137 additions and 68 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/event_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
||||
class MessageDownloadContent extends StatelessWidget {
|
||||
final Event event;
|
||||
|
|
@ -28,24 +30,26 @@ class MessageDownloadContent extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.file_download_outlined,
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.file_download_outlined,
|
||||
color: textColor,
|
||||
),
|
||||
title: Text(
|
||||
filename,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
filename,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: PlatformInfos.isAndroid
|
||||
? IconButton(
|
||||
onPressed: () => event.shareFile(context),
|
||||
tooltip: L10n.of(context)!.share,
|
||||
icon: const Icon(Icons.share),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const Divider(),
|
||||
Row(
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ class ImageViewerController extends State<ImageViewer> {
|
|||
/// Save this file with a system call.
|
||||
void saveFileAction() => widget.event.saveFile(context);
|
||||
|
||||
/// Save this file with a system call.
|
||||
void shareFileAction() => widget.event.shareFile(context);
|
||||
|
||||
static const maxScaleFactor = 1.5;
|
||||
|
||||
/// Go back if user swiped it away
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'image_viewer.dart';
|
||||
|
||||
class ImageViewerView extends StatelessWidget {
|
||||
|
|
@ -37,6 +38,13 @@ class ImageViewerView extends StatelessWidget {
|
|||
color: Colors.white,
|
||||
tooltip: L10n.of(context)!.downloadFile,
|
||||
),
|
||||
if (PlatformInfos.isAndroid)
|
||||
IconButton(
|
||||
onPressed: controller.shareFileAction,
|
||||
tooltip: L10n.of(context)!.share,
|
||||
color: Colors.white,
|
||||
icon: const Icon(Icons.share),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: InteractiveViewer(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue