Reputation: 121
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: () {},
Upvotes: 11
Views: 35363
Reputation: 5472
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: () {},
Upvotes: 19