natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
83 stars 12 forks source link

Native linux support #178

Closed ellet0 closed 7 months ago

ellet0 commented 7 months ago

Overview

I know this sounds disappointing and actually I'm but I really don't have the time and it will take from me 6-12 months before I can touch the project so I decided that I at least should enable running the Linux example

So we can run and test it

I didn't do anything else Just connected the Linux plugin to pubspec.yaml

This doesn't affect the other platforms and the only change that we can run the example on Linux

that's all

but the method channels will throw an Exception just like when using the library in a project that supports Linux

You can reject the PR as it doesn't change much, Linux is still unsupported, this is why I suggested to stick to the dart impl as I already implemented it before a few months ago

natsuk4ze commented 7 months ago

Hi @freshtechtips

I wanted to take a moment to express my gratitude for your contribution to the project. Your efforts in adding native Linux support are deeply appreciated.

I've noticed that you've been putting in a lot of hard work. Remember, there's no need to overdo it. Adding support for a new platform is inherently challenging and time-consuming.

Most importantly, as this is an open-source project, the best approach is to contribute whenever you feel passionate and inspired to do so. Your well-being and enthusiasm for the project are what truly matter.

Thanks again for your valuable contribution!

Best regards,

ellet0 commented 7 months ago

Let's save the compliments when we are done with Linux support in peace :)

Is there a way where I can contact with you in private? maybe discord or slack channel? anything

natsuk4ze commented 7 months ago

discord

@natsuk4ze. you can find me in pub channel on flutter

ellet0 commented 7 months ago

I added the plugin interface for gal without new package or doing a breaking change

natsuk4ze commented 7 months ago

I added the plugin interface for gal without new package or doing a breaking change

OK. I haven't done a thorough investigation of dart-only-platform-implementations yet, but wouldn't this allow us to remove the gal_linux folder and put all your Linux implementations in a linux folder?

ellet0 commented 7 months ago

I added the plugin interface for gal without new package or doing a breaking change

OK. I haven't done a thorough investigation of dart-only-platform-implementations yet, but wouldn't this allow us to remove the gal_linux folder and put all your Linux implementations in a linux folder?

gal_linux is just a dart implementation package for Linux

We can rename it to linux, but it's really not a big deal

I named it like this to follow conversations of official flutter plugins

Besides, the package will be used only in the Linux platform unlike the previous PR

It's much easier and faster as we don't have to build the whole app again every time we make a change

natsuk4ze commented 7 months ago

Two folders for linux is weird, so let's make it one.

ellet0 commented 7 months ago

Two folders for linux is weird, so let's make it one.

Actually, it's one

But if you mean two folders

The other one for the example and this can't be deleted. Otherwise, we can't run the example on Linux

It is just for the example

It won't affect the end developer who will use the library for linux

ellet0 commented 7 months ago

All plugins have two folders for all platforms

One for the example The other for the plugin itself

natsuk4ze commented 7 months ago

Then the linux_gal folder should be under linux.

ellet0 commented 7 months ago

Then the linux_gal folder should be under linux.

We only have a Linux folder under the example

We can't put the platform specific code in the example

Even if we did, the end developer won't get the changes in his own project

natsuk4ze commented 7 months ago

We only have a Linux folder under the example

When you add a platform, doesn't it generate a linux folder in the root?

ellet0 commented 7 months ago

We only have a Linux folder under the example

When you add a platform, doesn't it generate a linux folder in the root?

We did that previously, but now, since you wanted dart implementation and actual, I want that too

I depleted the linux native code and created a new package and made some changes in the lib so we have an interface for the plugin without breaking changes

In the gal_linux package, we override the impl of the interface

And we used the package in the main gal package for linux only

Simple as that

The docs are not very clear about dart platform specific code, so I had to take a look at the path provider plugin from the flutter team

natsuk4ze commented 7 months ago

There are several ways to add a linux platform, and there are many to choose from. The choice should be made carefully and after thorough discussion, because we will be using it permanently.

My preference is as stated in the issue,

  1. do not add new dependencies to pubspec.yaml.
  2. putting the all linux-related code in linux folder at the top level, like darwin and android.

We do not have to write the code right away. We should discuss the best way these can be accomplished.

Basically, We need to write native code like others, but if we can achieve this with Dart, Dart is easier.

Anyway, there is no need to rush and don't feel you have to do it alone. To begin with, the demand for linux apps is low compared to other platforms.

natsuk4ze commented 7 months ago

One idea is to publish the linux support as your extension package and introduce it in the gal readme. This way you are free to write your code.

ellet0 commented 7 months ago

We only have a Linux folder under the example

When you add a platform, doesn't it generate a linux folder in the root?

We did that previously, but now, since you wanted dart implementation and actual, I want that too

I depleted the linux native code and created a new package and made some changes in the lib so we have an interface for the plugin without breaking changes

In the gal_linux package, we override the impl of the interface

And we used the package in the main gal package for linux only

Simple as that

The docs are not very clear about dart platform specific code, so I had to take a look at the path provider plugin from the flutter team

Don't worry. Even after this PR gets merged, I will still provide extra patches for a while

I added new dependency in pubspec.yaml of gal_linux only

ellet0 commented 7 months ago

Can you send me your Discord account username? Or maybe link?? I'm unable to find you

natsuk4ze commented 7 months ago

natsuk4ze. is my username

ellet0 commented 7 months ago

natsuk4ze. is my username

Sent you a message there

natsuk4ze commented 7 months ago

natsuk4ze. is my username

Sent you a message there

Was that the same profile icon? I don't seem to have received it.

ellet0 commented 7 months ago

natsuk4ze. is my username

Sent you a message there

Was that the same profile icon? I don't seem to have received it.

The name is Ellet

And it's not the same profile picture

natsuk4ze commented 7 months ago

I’m not receiving that. my username is “natsuk4ze.”