Comments (13)
I just tested this and it seems that the file promise metadata outlook uses is different than what standard NSFilePromiseProvider
produces. I'll post update soon.
from super_native_extensions.
Can you try this with super_drag_and_drop
0.2.3+1
?
Formats.pdf
should work for PDF file.
from super_native_extensions.
In this case you will need to check if the format is FileFormat
and then cast it to FileFormat
.
if (format is FileFormat) {
final fileFormat = format as FileFormat;
}
from super_native_extensions.
Right. We're likely missing a FileFormat
for public.html
. The value format is meant for copying and pasting rich text, which is treated as value (and needs additional conversion of some platforms).
As for generic access - you should be able to use DataReader.platformFormats
to get all available formats and then construct SimpleFileFormat(fallbackFormats:[firstPlatformFormat]
).
This might be a common enough use case to just support it out of box. You can try something like this (I haven't tested the code):
extension on DataReader {
raw.ReadProgress? getAnyFile(
AsyncValueChanged<DataReaderFile> onFile, {
ValueChanged<Object>? onError,
}) {
final formats = platformFormats;
if (formats.isNotEmpty) {
final format = formats.first;
return getFile(
SimpleFileFormat(fallbackFormats: [format]),
onFile,
onError: onError,
);
} else {
return null;
}
}
}
from super_native_extensions.
It is possible that outlook uses file promises (aka virtual files) in which case there is no URL and you will need to read file content instead through getFile(format)
.
from super_native_extensions.
How to know the correct format? I tried using a pdf and hardcode Formats.pdf
but getFile
returns null
If no file for given format is available, null progress is returned and the [onFile] block will not be called.
from super_native_extensions.
I think it works now. I am not done testing yet. Tanks allot for your fast Support.
One more thing not sure if is an issue or I am doing it wrong. But I have to pass the FileFormat
to the getFile
method. But for that I would need to know the format from reader. This is what I tried:
It gets the correct format but the return type is not supported by getFile
from super_native_extensions.
Okay got it know the issue was also that I had to import FileFormat from super_clipboard
from super_native_extensions.
Okay got it know the issue was also that I had to import FileFormat from super_clipboard
That seems like a oversight. FileFormat
should be reexported by super_drag_and_drop
. I'll look into that.
from super_native_extensions.
It seams that not all formats can be handled using getFormats
null is returned if I want to drag an .yaml
file from outlook.
For my use case I only need the file path is there a way to get the file path whitout having to call getFile
? Or would I need to implement all types that are not yet implemented?
For example:
const yaml = SimpleFileFormat(
uniformTypeIdentifiers: ['public.yaml'],
mimeTypes: ['application/yaml'],
);
onPerformDrop: (event) async {
final item = event.session.items.first;
// data reader is available now
final reader = item.dataReader!;
if (reader.canProvide(Formats.fileUri)) {
reader.getValue<Uri>(
Formats.fileUri,
(value) async {
if (value != null) {
await showUploadDialog(
context: context,
filePath: value.toFilePath(),
);
}
},
onError: (error) {
print('Error reading value $error');
},
);
return;
}
final format = reader.getFormats([yaml, ...Formats.standardFormats]).firstOrNull;
print("MD. $format");
if (format is FileFormat) {
reader.getFile(
format,
(value) async {
if (value is DataReaderVirtualFileAdapter) {
final file = value.file as VirtualFileFromFile;
print("MD. value ${file.file.path} ");
await showUploadDialog(
context: context,
filePath: file.file.path,
);
}
},
onError: (error) {
print("MD. error $error");
},
);
return;
}
}
from super_native_extensions.
You can create the Format
definitions that you're missing. If you give me a list of formats that you are missing I can add them to super_native_extensions
. I'd like the default list to be as comprehensive as possible.
Btw. yaml on other platforms will be reported as text/x-yaml
(even though that's a deprecated definition).
from super_native_extensions.
Btw. yaml on other platforms will be reported as text/x-yaml (even though that's a deprecated definition).
Strange I don't get anything from yaml files. But it works fine if I add my own definition;
If you give me a list of formats that you are missing I can add them to super_native_extensions.
You could add Types for all types of code files: .dart, .ts, .js, .dart, ...
But If possible I would need a more generic approach. I have to support all types of files no matter what. :(
I also had issue whit .html files it was not returning FileFormat
but ValueFormat
so I tried using getValue
, but the value returned from callback was null
from super_native_extensions.
Yes it works thanks allot!
from super_native_extensions.
Related Issues (20)
- [Android][deprecation] view.startDrag(ClipData,DragShadowBuilder,Object,int) is deprecation in sdk 24 use view.startDragAndDrop instead HOT 2
- [super_context_menu] On Linux, when having a `image` in a MenuAction, it results in a black screen. HOT 1
- Build failed with an exception: Execution failed for task ':app:checkDebugDuplicateClasses'. HOT 2
- super_drag_drop not working on Android HOT 1
- flutter macos release build error HOT 2
- [super_context_menu] On macos, How to get the notification of onmenushow HOT 2
- [ super_drag_and_drop ] macOS ONLY bug, seems like MouseRegion is broken if dragconfig completes after onPointerUp triggered HOT 13
- [super_clipboard] Can't build as a flutter module HOT 6
- could not compile `time` (lib) due to 1 previous error HOT 6
- I hope to provide a function to get the absolute path of the file in DataReaderFile(reader.dart) HOT 1
- ContextMenuWidget child appears when scrolling HOT 3
- Remove context menu shadow HOT 4
- Starting the app stalls on "Installing NDK 23.1.7779620" after installing rustup on windows HOT 2
- can't compile ios build in github actions HOT 6
- Issue when using super_context_menu with flutter_markdown as a child HOT 6
- CustomValueFormat not supported on web? HOT 1
- Wasm compilation fails because of `html` package usage HOT 2
- Drag text to Windows remote desktop window?
- Super Drag and Drop Crash when dragging audio file from another app into flutter app HOT 3
- Motorola phone - cannot read clipboard, throws `JNI: JNI call failed` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from super_native_extensions.