Home > Software design >  How to create `IconData` from text in flutter
How to create `IconData` from text in flutter

Time:10-01

I want to create a icon from a text like currency symbol. Currency symbols are not available in material icons and i don't want to use any third party library. I want to convert the text string like '$' to Icons and use them.

CodePudding user response:

As per your requirement try below code hope its help to you:

Using \ character

      Text(
        '\$ Search',
      ),

Your Output Screen like-> Image

Using Flutter Unicode character. You found Unicode character enter image description here

You can add any Symbol in between text

  Wrap(
      crossAxisAlignment: WrapCrossAlignment.center,
      children: [
        Text('Your'),
        Icon(Icons.add),
        Text('Icon'),
      ],
    ),

Your result screen like-> enter image description here

Or in VS Code you can used Windows . keys and add any symbol on your need

CodePudding user response:

Please try this one. 0024 is Unicode for $

Icon( IconData(0x0024, fontFamily: 'MaterialIcons'),size: 50, ))
  • Related