Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native linux support #178

Closed
wants to merge 15 commits into from
Closed

Conversation

EchoEllet
Copy link
Contributor

@EchoEllet EchoEllet commented Dec 3, 2023

No description provided.

@EchoEllet EchoEllet closed this Dec 3, 2023
@natsuk4ze
Copy link
Owner

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,

@EchoEllet EchoEllet reopened this Dec 4, 2023
@EchoEllet
Copy link
Contributor Author

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
Copy link
Owner

discord

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

@EchoEllet
Copy link
Contributor Author

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

@natsuk4ze
Copy link
Owner

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?

@EchoEllet
Copy link
Contributor Author

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
Copy link
Owner

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

@EchoEllet
Copy link
Contributor Author

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

@EchoEllet
Copy link
Contributor Author

All plugins have two folders for all platforms

One for the example
The other for the plugin itself

@natsuk4ze
Copy link
Owner

Then the linux_gal folder should be under linux.

@EchoEllet
Copy link
Contributor Author

EchoEllet commented Dec 4, 2023

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
Copy link
Owner

We only have a Linux folder under the example

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

@EchoEllet
Copy link
Contributor Author

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
Copy link
Owner

natsuk4ze commented Dec 4, 2023

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
Copy link
Owner

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.

@EchoEllet
Copy link
Contributor Author

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

@natsuk4ze
Copy link
Owner

natsuk4ze. is my username

@natsuk4ze
Copy link
Owner

natsuk4ze. is my username

Sent you a message there

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

@EchoEllet EchoEllet marked this pull request as ready for review December 4, 2023 09:06
@natsuk4ze
Copy link
Owner

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

@@ -0,0 +1,43 @@
# Miscellaneous
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file is generated by flutter create . --platforms=linux

Comment on lines +1 to +10
# example

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be updated soon

@@ -68,7 +68,7 @@ class _AppState extends State<App> {
'https://github.com/natsuk4ze/gal/raw/main/example/assets/done.jpg',
path,
);
await Gal.putImage(path);
await Gal.putImage(path, album: album);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fix in the example

@@ -80,7 +80,7 @@ class _AppState extends State<App> {
'https://github.com/natsuk4ze/gal/raw/main/example/assets/done.mp4',
path,
);
await Gal.putVideo(path);
await Gal.putVideo(path, album: album);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -0,0 +1 @@
/home/freshtechtips/Desktop/gal/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be deleted

@@ -25,6 +33,7 @@ environment:
dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in all offical flutter plugins

pubspec.yaml Outdated
Comment on lines 11 to 16
platforms:
android:
ios:
linux:
macos:
windows:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid pubspec.yaml from showing Linux as unsupported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants