I can see the "face_2" right here in the flutter MaterialIcon listing: https://api.flutter.dev/flutter/material/Icons/face_2-constant.html and https://api.flutter.dev/flutter/material/Icons-class.html, but when I try Icons.face_2, flutter can't find it.
I tried to use this code provided in the docs to get the corresponding IconData directly:
IconData(0xf085f, fontFamily: 'MaterialIcons')
It gave me an emoji.
Related
Abstract :
I would like to use dynamic icons with custom widget. Inorder to use dynamic icons I need Icon data number. Is there there any each way to get the icon data ?
Example :
Icon Name - Icon(Icons.abc)
Needed :
IconData(0xf04b6, fontFamily: 'MaterialIcons')
Not using a name but You can extract icon data directly from the icon you mentioned.
Icons.abc.codePoint
Icons.abc.fontFamily
When i try to convert CharCode to string its shows value like below attach
I think the problem is from Flutter not from Dart.
As you can see from the attached photo, the console could show it properly "⅕".
However, when I feed it to Text Widget, it will show as same as you tested.
I've posted this question on Flutter GitHub.
I am using the pdf package in flutter for generating pdf from the app. I need to add a clickable kind of thing(hyperlink, button) in pdf but the package doesn't provide any widget for that purpose. Also, the basic flutter widgets couldn't be used for generating the pdf files(restricted by the package). Is there any way to solve it?
Use the Stack widget to put any widget above the pdf ?
The problem is solved now, the pdf package provides the UrlLink for the purpose of opening a link when tapped on the page.
This is the short documentation for the same.
I did it like this-
pw.UrlLink(destination: imageUrl, child: pw.Text('LINK', style: pw.TextStyle(fontSize: size)))
I'm trying to use Icon(Icons.factory) but it not displayed: in VSCode and even in my app.
Do you know why? (I saw I need to add font_awesome_flutter or material_design_icons_flutter but is it mandatory?)
I'm using cupertino_icons: ^1.0.4 & uses-material-design: true in my pubspec.yaml
I haven't seen any icon with name factory in the cupertino documentation but if you want to add any icon which is not yet present in your ide's options, simply visit flutters cupetino docs and click on the icon you want. For example the paperlane icon which is not yet available in the options
static const IconData paperplane = IconData(0xf733, fontFamily: iconFont, fontPackage: iconFontPackage);
change above code to
static const IconData paperplane = IconData(0xf733, fontFamily: CupertinoIcons.iconFont, fontPackage: CupertinoIcons.iconFontPackage);
then you can use the font in your code as
Icon(paperplane)
Remember to update your cupertino package and import the file for some icons to work
I want to use flutter inbuilt icons as assets. So I want default location where all of flutter icons are located in flutter folder of flutter installation.
This would seem to imply that there's a fontFamily named 'MaterialIcons'. Not sure you can get it easily from any part of the Flutter distro, but https://material.io/resources/icons/ will show how to download or reference the font for your material designs.
static const IconData ac_unit_outlined = IconData(0xe005, fontFamily: 'MaterialIcons')
I don't think they are. If you look at the IconData class (https://api.flutter.dev/flutter/widgets/IconData-class.html). You will see that the description says 'A description of an icon fulfilled by a font glyph.'
Taking an example of one of the Icon values:
static const IconData list_alt = IconData(0xe81b, fontFamily: 'MaterialIcons');
I believe what that is telling us is that the Icon is being defined by the position 0xe81b in the Unicode font family called MaterialIcons
Not an answer to the original question, but likely tangentially helpful...
To visually identify & search/filter icons, both from the included MaterialIcons from Google and those created by the Community, check out:
https://materialdesignicons.com/
And to use them, the related pub.dev package for material_design_icons_flutter.