forked from Nexus/nexus
parent
1c2ba2971b
commit
0ad85f24d5
15 changed files with 285 additions and 24 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:m3e_buttons/m3e_buttons.dart";
|
||||
import "package:nexus/helpers/extensions/save_attachment.dart";
|
||||
import "package:nexus/helpers/mxc_image.dart";
|
||||
import "package:nexus/models/requests/download_media.dart";
|
||||
import "package:nexus/widgets/error_dialog.dart";
|
||||
|
|
@ -8,6 +9,9 @@ import "package:nexus/widgets/error_dialog.dart";
|
|||
final class const ExpandableImage(
|
||||
final DownloadMediaRequest? request, {
|
||||
required final Widget child,
|
||||
|
||||
/// If set, a download button is shown, suggesting this filename
|
||||
final String? downloadFilename,
|
||||
super.key,
|
||||
}) extends ConsumerWidget {
|
||||
@override
|
||||
|
|
@ -38,9 +42,25 @@ final class const ExpandableImage(
|
|||
alignment: .topRight,
|
||||
child: Padding(
|
||||
padding: .all(32),
|
||||
child: M3EButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: Icon(Icons.close),
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (downloadFilename != null)
|
||||
M3EButton(
|
||||
onPressed: () => context.saveAttachment(
|
||||
ref,
|
||||
request!.mxc,
|
||||
encrypted: request!.encrypted,
|
||||
filename: downloadFilename,
|
||||
),
|
||||
child: Icon(Icons.download),
|
||||
),
|
||||
M3EButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue