Coder Social home page Coder Social logo

Implement dual tone about flutter HOT 5 CLOSED

phosphor-icons avatar phosphor-icons commented on May 5, 2024
Implement dual tone

from flutter.

Comments (5)

rektdeckard avatar rektdeckard commented on May 5, 2024 2

Flutter's Icon class is a wrapper around a font glyph, and fonts don't support multiple colors or intrinsic opacity, making it impossible to render anything with multiple colors or tones (in the general sense) as an Icon.

While there are other possible approaches, using using flutter_svg package or Skia directly to render vector images like our duotone icons, they simply aren't idiomatic Flutter, and would break the ability to use them in places where an Icon is expected, e.g. IconButton.

We definitely want to bring duotone to the Flutter package eventually, but it simply requires a bit more thinking and effort. If you need duotone icons in a context that doesn't require a Flutter Icon, I would recommend sourcing the assets you need from our website and relying on flutter_svg to render them in your app.

Disclaimer: I'm not really a Flutter guy, so if anyone with experience or ideas on a better approach wants to jump in with a PR, I'm all ears!

cc @rurickdev

from flutter.

johnnyasantoss avatar johnnyasantoss commented on May 5, 2024 1

I've created a PoC for this idea. Check it out: https://github.com/johnnyasantoss/flutter_duotone_icon_poc

Worked pretty well

image

from flutter.

CodeDoctorDE avatar CodeDoctorDE commented on May 5, 2024

Thanks, IconButton supports normal Widgets so SVG can work https://api.flutter.dev/flutter/material/IconButton/icon.html

from flutter.

johnnyasantoss avatar johnnyasantoss commented on May 5, 2024

@rektdeckard what if you had the icon split in two fonts (eg. address-book-duotone-bg & address-book-duotone-fg)? and then with a special DuoTone class it could have both icons stacked on top of each other looking just like layers on photoshop, rendering it perfectly (and with the benefit of being tree-shakable)

from flutter.

rektdeckard avatar rektdeckard commented on May 5, 2024

Duotone support is added in v2.0.0.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.