quick_look
v0.2.0Package for opening files in iOS QuickLook. You will first need to save the files to the ApplicationDocumentsDirectory().
Package archive: https://pubdev.letsnova.ru/api/archives/quick_look/0.2.0.tar.gz
Install
dart pub add quick_lookReadme
quick_look
This plugin lets us use Apple QuickLook (QLPreviewController).
Getting Started
In order to open the file, do the following
import 'package:flutter/services.dart' show rootBundle;
import 'package:path_provider/path_provider.dart';
import 'package:quick_look/quick_look.dart';
...
final byteData = await rootBundle.load('assets/$path');
final directory = await getApplicationDocumentsDirectory();
final String directoryPath = directory.path;
final tempFile = await File('$directory/$directoryPath').writeAsBytes(
byteData.buffer.asUint8List(
byteData.offsetInBytes,
byteData.lengthInBytes,
),
);
final bool canOpenUrl = await QuickLook.canOpenURL(tempFile.path);
if (canOpenUrl) {
await QuickLook.openURL(tempFile.path, isDismissable: true);
}
Features
- Open a single file using QuickLook
- Open multiple files in a carousel using QuickLook
- Check if a file can be opened before passing it to the QLPreviewController
- Control whether QuickLook preview can be closed with a swipe
To see, which kind of files you can open, see Apple Documentation
Changelog
Changelog
0.0.1
- Ability to open a single file in
QLPreviewController.
0.0.2
- Ability to open muitiple assets with
openURLs(List<String> _)method
0.0.3
README.mdtypos fix
0.0.4
- Add documentation
0.0.5
- Update Android versions, so that it builds
- Update dependencies
0.0.6
- remove android support (was redundant) (#6)
- openURL futures now resolve after native modal closes (#5)
0.1.0
- move to pigeon for communication
0.2.0
- add isDismissable (#10)
- up flutter and pigeon version (#11)
- add canOpenUrl (#12)
