How to put SVG icons in flutter?
5,678
The Icon parameter accept any kind of widget not only Icon So you can use any widget like below
IconButton(icon: SvgPicture.asset(
assetName,
color: Colors.red,
semanticsLabel: 'Label'
),onPressed: () {},
Author by
Anar
Updated on December 29, 2022Comments
-
Anar over 1 year
Put this code in pubspec.yaml
flutter_svg: ^0.19.3
Even I put in assets these
assets: - assets\icons\logo.jpg - assets\icons\menuicon.svg - assets\icons\searchIcon.svg
In code it looks like this
IconButton( icon: Icon(Icons.searchicon.svg), onPressed: () {},
-
ibhavikmakwana about 3 yearsDoes this answer your question? Flutter SVG rendering
-
-
Hamdam Muqimov over 2 yearsThe problem is we have to manually control theming on each icon. It does not inherit IconTheme class.