Skip to main content

Open Source: colors_parser

While working on a Flutter project, I was surprised to find that I could not parse a string representation of a Material Colors value. I am not sure why this is not supported directly by Google, but I really wanted to be able to do something like...

    var color = Colors.parse("blue");

I assumed there must be something already floating around on the Web to take care of this, but was disappointed to find that...I could not find it. My mother (sadly passed a few years ago) would no doubt have said this is due to my poor Internet search skills. So, I created and published a Dart/Flutter package (colors_parser) that you can use until Google realizes their oversight and adds this directly to Colors. With the package added to your Flutter project, you can...

    var color = cp.parse("blue");

Yay! Sure, you can specify all the named Colors including both MaterialColor and MaterialAccentColor values. Naturally, you can also specify indexed color shades like "blue[300]" as well as black and white variants with different opacities like "black54" and hex color values like "#FF42A5F5".

And, you can even convert back to a String...

    print("color: ${cp.toColorsString(cp.parse("blue"))}");

Not too bad for just a bit of code. Now if I just knew why Google does not support it and my mother was around to help with my Internet searches.

Comments

  1. Hard Rock Hotel & Casino - MapYRO
    Find Harrah's Hotel & 익산 출장마사지 Casino, Las 대구광역 출장마사지 Vegas, NV, United 안성 출장샵 States, real-time prices, photos and detailed 평택 출장샵 data on 10638 visitors and 의정부 출장마사지 987

    ReplyDelete
  2. The key is selecting an internet on line casino with a strong popularity, so 카지노 사이트 we solely included trusted firms on our listing. Jackpot slots and other games regularly reach six-figure numbers, making this one of the best on-line on line casino sites for jackpots. Mansion presents many in style progressive jackpot slots, together with many Kingdoms Rise and Age of the Gods games. The present welcome bonus at this UK on-line on line casino presents new gamers a primary deposit bonus of fifty bonus spins. First deposits should meet the €10 minimal, however PlayOJO doesn’t require minimal wagering for welcome bonuses.

    ReplyDelete
  3. Research on the well being and safety considerations of 3D printing is new and in growth because of the of} latest proliferation of 3D printing gadgets. In the United States, the FAA has anticipated a want to make use of Direct CNC additive manufacturing techniques and has been contemplating how greatest to control this course of. The FAA has jurisdiction over such fabrication as a result of|as a result of} all aircraft parts have to be made underneath FAA production approval or underneath different FAA regulatory classes. In December 2016, the FAA approved the production of a 3D printed gas nozzle for the GE LEAP engine. Aviation lawyer Jason Dickstein has instructed that additive manufacturing is merely a production method, and ought to be regulated like any other production method.

    ReplyDelete

Post a Comment