fix: Sharing on iPad

This commit is contained in:
Christian Pauly 2022-08-21 08:42:02 +02:00
commit ef763846d0
8 changed files with 30 additions and 19 deletions

View file

@ -25,10 +25,10 @@ class ImageViewerController extends State<ImageViewer> {
}
/// Save this file with a system call.
void saveFileAction() => widget.event.saveFile(context);
void saveFileAction(BuildContext context) => widget.event.saveFile(context);
/// Save this file with a system call.
void shareFileAction() => widget.event.shareFile(context);
void shareFileAction(BuildContext context) => widget.event.shareFile(context);
static const maxScaleFactor = 1.5;

View file

@ -35,17 +35,19 @@ class ImageViewerView extends StatelessWidget {
if (!PlatformInfos.isIOS)
IconButton(
icon: const Icon(Icons.download_outlined),
onPressed: controller.saveFileAction,
onPressed: () => controller.saveFileAction(context),
color: Colors.white,
tooltip: L10n.of(context)!.downloadFile,
),
if (PlatformInfos.isMobile)
IconButton(
onPressed: controller.shareFileAction,
tooltip: L10n.of(context)!.share,
color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined),
)
// Use builder context to correctly position the share dialog on iPad
Builder(
builder: (context) => IconButton(
onPressed: () => controller.shareFileAction(context),
tooltip: L10n.of(context)!.share,
color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined),
))
],
),
body: InteractiveViewer(