Comments (12)
Hi,
I tried to reproduce your issue on my manjaro/kde machine using your provided snippet, however it worked as expected:
Picker | Picked image |
---|---|
![]() |
![]() |
from flutter.
Based on what you found above, I will label this issue for further insights from others.
from flutter.
Therefore, the problem is in Dolphin and KDE file chooser
I would suggest filing this upstream; if a distro's implementation of the file chooser doesn't follow the spec, there's not much the plugin can do in the general case.
If we could detect this case we could fall back to the worse approach used in the Windows version, where we hard-code a list of image types, but we wouldn't want to do that in general, and it's not clear to me that there would be any way to detect this at runtime.
As a workaround, clients who need to support this particular environment could do that themselves, using file_selector
, instead of using the image_picker
wrapper.
from flutter.
Hi @HarshNarayanJha, I'm not sure if this is a distro-specific issue on your Garuda Linux
or not but I don't see this issue on my Ubuntu distro using plugin's example app. Please take a look at my demo screenshots below:
opening picker | picked image |
---|---|
![]() |
![]() |
Could you try this on a GTK program on your OS to dig into the issue? (You can adjust my program for this case if it's useful)
from flutter.
Thanks for sharing the program. I changed it to use the *.png
filtered files, and I was able to see and select those. However GTK only allows one filter AFAIK (using something like image/*
is not possible)
To test it out, I just to install a GTK image viewer Image Roll
and did ctrl+o
in it to open a file. The GTK file picker launched with filter set to Image
and all image file types were shown correctly.
If it shows up correctly on ubuntu/gnome gtk, it might be a distro specific issue for KDE/dolphin, or it might even be an issue with the depending package file_picker
. Whatever it may be, we might want reports from other KDE users. I will also try to run the example app.
from flutter.
How can I run the example app?
from flutter.
You can clone the https://github.com/flutter/packages/ repository and navigate to
flutter/packages/packages/image_picker/image_picker/example
and run that project. Or just use a small snippet like this:
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
super.key,
});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String? _picked;
void _openImagePicker() async {
final ImagePicker picker = ImagePicker();
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
setState(() {
_picked = image?.path;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Selected:',
),
if (_picked != null)
Image.file(
File(_picked!),
width: 200,
height: 200,
)
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _openImagePicker,
tooltip: 'Pick',
child: const Icon(Icons.browse_gallery),
),
);
}
}
from flutter.
Can confirm it works as expected on
[✓] Flutter (Channel master, 3.22.0-36.0.pre.59, on KDE neon 6.0 6.5.0-35-generic, locale fr_FR.UTF-8)
Using the snippet @christophsj provided.
from flutter.
@HarshNarayanJha Could you confirm with image_picker example or @christophsj's code snippet above?
from flutter.
Ran the example... same issue. Image files don't show up, but I can manually type and select.
Though if I open the file /packages/image_picker/image_picker_linux/lib/image_picker_linux.dart
, and change the mimetype at line 102 from image/*
to image/png
, all png files are visible (same for jpg)
EDIT:
Interesting discovery! If I use the variable GTK_USE_PORTAL
to launch flutter run
like this
GTK_USE_PORTAL=0 flutter run
It would force the said application to use the gtk file chooser, and in that, all image files are visible with the image/*
mimetype. Therefore, the problem is in Dolphin and KDE file chooser
from flutter.
Sure, I will file this upstream.
in the Windows version, where we hard-code a list of image types
Even Windows explorer doesn't respect image mime types?
from flutter.
I'm not sure what you are asking exactly, but IFileDialog
isn't based on MIME types at all. If you are asking about the Windows Explorer application implementation, you'd need to ask Microsoft.
from flutter.
Related Issues (20)
- Compatibility Issue with Flutter Apps on LineageOS 21 HOT 2
- -
- - HOT 2
- Flutter Mac App Crashes on Intel CPU Macs When Using Impeller HOT 3
- - HOT 1
- Add easy way to change app-wide font family for `CupertinoApp`
- [tool_crash] ProcessException: Failed to find "D:\Flutter\flutter\bin\cache\dart-sdk\bin\dartaotruntime.exe" in the search path. Command: D:\Flutter\flutter\bin\cache\dart-sdk\bin\dartaotruntime.exe, OS error code: 0 HOT 1
- [tool_crash] ProcessException: Failed to find "D:\Flutter\flutter\bin\cache\dart-sdk\bin\dartaotruntime.exe" in the search path. Command: D:\Flutter\flutter\bin\cache\dart-sdk\bin\dartaotruntime.exe, OS error code: 0 HOT 2
- Throwing OutOfMemoryError HOT 1
- -
- build is called on IOS when app goes to background HOT 2
- VideoPlayer failed to auto-rotate the video after upgrade flutter to version 3.22.0. HOT 9
- Please add an event handler (callback) TextField for _TextFieldState._handleFocusChanged to allow easy access to focus changes HOT 2
- GLFW examples are not functional on macOS. HOT 1
- [tool_crash] FileSystemException: Cannot create link, OS Error: File exists, errno = 17 HOT 2
- -
- {WEB (CanvasKit)} CanvasKit renderer never starts application. HOT 5
- pub get complaining about dependecnies that cannoty be upgrtaded due to SDK pinned dependencies HOT 4
- Cannot Trigger SliverAppBar Stretch in NestedScrollView HOT 2
- Error C3646 when building Flutter app for Windows,D:\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(524,20): error C3646: “lpStartupInfo”: 未知重写说明符 HOT 2
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 flutter.