Added "open with" option after Download

This commit is contained in:
Elias Müller 2023-03-11 21:46:21 +01:00
parent f13d47a9e9
commit cbcae3a7a1

View File

@ -1,6 +1,7 @@
import 'dart:developer'; import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:better_open_file/better_open_file.dart';
import 'package:flowder/flowder.dart'; import 'package:flowder/flowder.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -35,15 +36,22 @@ class _FileDownloadState extends State<FileDownload> {
progress: ProgressImplementation(), progress: ProgressImplementation(),
deleteOnCancel: true, deleteOnCancel: true,
onDone: () { onDone: () {
// OpenFile.open(local).then((value) => () {
// log("Result: ${value.toString()}");
// });
Navigator.of(context).pop(); Navigator.of(context).pop();
showDialog(context: context, builder: (context) { showDialog(context: context, builder: (context) {
return AlertDialog( return AlertDialog(
icon: const Icon(Icons.link), icon: const Icon(Icons.link),
title: const Text("Dateipfad"), title: const Text("Dateipfad"),
content: Text(local), content: Text(local),
actions: [
TextButton(
child: Text("Öffnen mit"),
onPressed: () {
OpenFile.open(local).then((value) => () {
log("Result: ${value.toString()}");
});
},
)
],
); );
}); });
}, },