I am developing my own app in Flutter and I want to use some icons that I've made from my own.
I have used some of the icons provided by font_awesome_flutter but at this point of my code I would like to add some other icons ( svgs or pngs) which are not included in this package to make it more personal.
This is how my app organization it is:
Code organization
And that is the part of the code where I want to implement my own picture upct.png:
class _Encabezado extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
IconHeader(
icon: FontAwesomeIcons.glasses,
//icon2: FontAwesomeIcons.university,
icon2: SvgPicture.asset('assets/svgs/upct.svg'),
titulo: 'UPCT VR 360 EXPERIENCE',
subtitulo: 'Universidad Politécnica de Cartagena',
color1: Color(0xff536CF6),
color2: Color(0xff66A9F2),
),
Thank you very much!
CodePudding user response:
If you want to use local asset folder images need to add the base path in pubspec.yaml
Example:
flutter:
assets:
- assets/svgs/
Note: add base path under flutter
CodePudding user response:
For SVGs
Use https://www.fluttericon.com to convert your SVGs into a font file, download the result folder and import the font in your pubspec.yaml
flutter:
fonts:
- family: MyFlutterApp
fonts:
- asset: fonts/MyFlutterApp.ttf