Skip to content

Conversation

@lslv1243
Copy link

@lslv1243 lslv1243 commented Jan 2, 2021

I made the required changes for the package to be sound null safe.
Since it depended on Pigment which the last update was 2 years ago, to not cause any breaking change, I inlined the function that is being used. The function only parses a string as Color.

@georgeherby georgeherby mentioned this pull request Feb 25, 2021
@Curvel
Copy link

Curvel commented Mar 24, 2021

@mendieta any plans on merging and publishing the null safety version?

@mendieta
Copy link
Member

Sorry, I'll merge during this week.

Cheers

@cyberpwnn
Copy link

Cool. Need this.

@Curvel
Copy link

Curvel commented Apr 6, 2021

@mendieta any updates here? Would be great to get the null safety release :D

@paulinventome
Copy link

Sorry - another request - can we merge the changes for null safety - this is the last package i need for me! thank you!!!

@beevelop
Copy link

Looking forward to this 👍

@JamesMcIntosh
Copy link

@mendieta Guessing you're busy but any chance of merging and releasing?

@AhmedNourJamalElDin
Copy link

Merge please.

@mx1up
Copy link

mx1up commented May 1, 2021

lgtm. use of late could have been prevented, i guess..

@TNorbury
Copy link

TNorbury commented May 4, 2021

Looks like Pigment has been updated to null-safety: bregydoc/pigment@eb95e5e

@lslv1243
Copy link
Author

lslv1243 commented May 4, 2021

@mx1up removed unnecessary late
@TNorbury using Pigment again instead of copying colorFromString function

}
TinyColor(Color color)
: this.originalColor = color,
_color = color.copy();
Copy link

Choose a reason for hiding this comment

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

I was actually thinking just

TinyColor(Color color)
      : this.originalColor = color,
      _color = Color.fromARGB(alpha, red, green, blue);

or is that bad practice somehow? :) the extension seems overkill, just for the internals of a constructor. Or do you believe it is generally useful? Personally I haven't had the need yet.

Copy link
Author

Choose a reason for hiding this comment

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

It would actually be (reference color):

TinyColor(Color color)
      : this.originalColor = color,
      _color = Color.fromARGB(color.alpha, color.red, color.green, color.blue);

I don't think it is overkill, since the extension is private.
I am used to creating extensions for these cases to simplify the constructor and improve formatting, but it is just a matter of taste.
Both ways will produce the same end result, as of before, it was allowing the variable to not be initialized if somebody was to change the constructor and probably adding a tiny runtime penalty.

Copy link

Choose a reason for hiding this comment

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

yes, I forgot the color ref.
sorry, I did not realize it was a private extension. thanks for explaining

@savadodesigns
Copy link

Please merge, thanks 😃

@yc-codes
Copy link

Merge, Please

@savadodesigns
Copy link

Sorry, I'll merge during this week.

Cheers

Hi @mendieta, could you please merge :)

@nfriend
Copy link

nfriend commented May 29, 2021

Would love to see this merged as well! 🙏

In the meantime, I'm going to try migrating my codebase to null safety by depending on @lslv1243's latest commit in my pubspec.yaml like this:

dependencies:
  tinycolor:
    git:
      url: git@github.com:lslv1243/tinycolor.git
      ref: 87f654ce7b79daddfbe7cdf7b7d9bb27574a8b89

I haven't actually migrated yet, but running flutter pub outdated --mode=null-safety seems to indicated that this works:

❯ flutter pub outdated --mode=null-safety
Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.

All your dependencies declare support for null-safety.

@calvintam236
Copy link

Hey @lslv1243, can you make a PR to community-forked repo? Thanks!

dsyrstad and others added 25 commits June 24, 2021 17:13
Update underlying color with setting alpha and opacity, and re-structure as library.
* Add .equals()

* Fix value to be checked

* Add @deprecated for .equals()
Xcode, JetBrains, VSCode
@calvintam236
Copy link

Hey @lslv1243, can you make a PR to community-forked repo? Thanks!

Hey @lslv1243, please let us know if you are too busy to make the PR. We can work on it if that’s the case.

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.