How to find flower and animal icons for flutter - flutter

I need flower and animal icons for an application. When I looked at Pub.dev, I couldn't find a package containing flower and animal icons. Can you give an idea about what I can do?
I looked at these packages but there are no flower and animal icons.
font_awesome_flutter: ^9.2.0
unicons: ^2.0.2

Material icons have some flower icons, but if you need something really specific you should use a SvgPicture, and download any SVG file.
Here is an example
SvgPicture.asset(
"assets/img/your-icon.svg",
height: 32,
width: 32,
color: Colors.black54,
),
To use this way you have to declare the assets folder in the pubspec.yaml and run a flutter pub get after that, an exampleenter code here:
flutter:
assets:
- assets/img/

Try using Flutter_Icons.
Add this in your Flutter page:
import 'package:flutter_icons/flutter_icons.dart';
IconButton(
icon: const Icon(FontAwesome5.cat), //Example
onPressed: () {},
)
And remember to add the package to your dependencies in your pubspec.yaml:
dependencies:
flutter_icons: ^1.1.0

Related

How can I change this default Icon in "BottomNavigationBarItem" flutter

[I want to change this default icon. How can I change this?]
BottomNavigationBarItem(
icon: Icon(
Icons.home,
size: 32,
),
label: "Tweets",
)
If you just want to change the icon with another one, you have to change the code here:
BottomNavigationBarItem(
icon: Icon(
Icons.anotherIconNameHere, // after the dot you change your icon
size: 32,
),
label: "Tweets", // here you can change the icon's label
)
Where I added anotherIconNameHere is where you will change your icon: after Icons. you can specify the icon you want to show. If you are using an IDE like Android Studio or Visual Studio Code, after typing the dot all the available icons will show up in a popover list.
You can check all the available icons of the Icons class here: Icons class - Material library - Dart API
In the material Icons class you can find pretty much all the icons you need.
Edited: In case you want to add custom icons or your icons, I strongly suggest you to read this article from Freecodecamp.org: FreeCodeCamp.Org - How to add custom icons to your flutter application
(If this was the answer you were looking for, remember to select it.)
#ashikur just use Image.asset to load local images. that you have to add in the asset folder and in pubspec.
BottomNavigationBarItem(
icon: Image.asset(
"assets/images/google.png"
),
label: "Tweets",
)

Flutter - Some icons are not found

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

How to use SVG in Flutter

I'm currently in the process of integrating a map into my app, which should highlight individual components in color. I use this map (https://simplemaps.com/resources/svg-de), which is already available in a well-designed SVG file. I am now trying to color the individual SVG paths using Flutter Code. I am building on the svg_path_parser package (https://pub.dev/packages/svg_path_parser) and have used the corresponding example. But I am unable to replace the paths from the example with those from my SVG file. This may be due to the fact that my SVG paths are significantly longer than the ones given in the example.
I would be very grateful if you would give me a little help or a suggestion for a better approach.
step 1.add dependency in your pubspec.yaml
dependencies:
flutter_svg: any
step 2.import the flutter svg package in your app
import 'package:flutter_svg/flutter_svg.dart';
step 3. just use like below
SvgPicture.asset(
'assets/images/bm-icon1.svg',
width: 18.0,
height: 18.0,
),

unable to add fonts in flutter

I am trying to add custom fonts in my flutter app. I have added fonts in pubspec.yaml
flutter:
fonts:
- family: Quicksand
fonts:
- asset: assets/fonts/Quicksand-Regular.ttf
Aslo I have added this in my Text widget
style: TextStyle(
color: Colors.white,
fontSize: 80.0,
fontFamily: 'Quicksand',
),
I am not getting any error, but my font is not getting applied.
Make sure you Re-Build the Project Again - Hot-Restart Won't work & do run flutter packages get
when you add the font to youre project. first, you must restart your app after that its work normally .its important not using Hot Reload in this case! for the first time

Flutter icons do not show

I am trying to complete this Flutter Code Lab, but the icons do not appear in my application. But they appears in Android Studio code:
I have been included the lib in my file pubspec.yaml
name: startup_namer
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
english_words: ^3.1.0
But result is this:
My main.dart file looks like this:
// Add the heart icons to the ListView.
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
.....
Widget _buildRow(WordPair pair) {
final bool alreadySaved = _saved.contains(pair);
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
),
trailing: new Icon(
alreadySaved ? Icons.favorite : Icons.favorite_border,
color: alreadySaved ? Colors.red : null,
size: 22.0,
),
onTap: () {
setState(() {
if (alreadySaved) {
_saved.remove(pair);
} else {
_saved.add(pair);
}
});
},
);
}
}
I thought that is because I use iOS emulator, but when I tried with Android emulator the result was the same.
(Copied from the comments)
You need to set uses-material-design: true in pubspec.yaml for the icons to be included in the app.
In my case, I have written uses-material-design: true in pubspec.yaml file. I am able to solve this problem by restarting the Android emulator. You can also try by uninstalling old build from your emulator and then installing the new one.
This is little weird behavior, but it works for me.
Hot reloading does not show changes in resources. Press the stop button square red color in the top action menu bar of android studio and run the app again.
It works.
Please try:
Stopping the app
Running flutter clean in your app directory
Deleting the app from your simulator / emulator / device
Rebuild & Deploy the app.
If you are using the FlutterIcons library, make sure that your font-family in your pubspec.yaml matches the one declared in the my_flutter_app_icons.dart file.
I assume we're talking about the flutter_icons package?
I had to kill the app entirely and reinstall it and they started working for me. Not sure why a hot reload didn't do the trick.
Just delete the App from emulator/physical device on which you are working and again build the app.
It works for me and will surely works for you.
Add the following to your pubspec.yaml:
flutter:
uses-material-design: true
Took me a while to figure out based on the answers above that uses-material-design is a property of flutter, not of the root.
Icon changing to Chinese character was resolved by adding the correct path to the fonts folder. Specify, the correct path to your fonts folder by providing proper indentations:
Flutter Clean
Remove Build From your testing device/Emulator
Run the app
You need to set uses-material-design: true in pubspec.yaml for the icons to be included in the app.
Be sure to have a uses-material-design: true entry in the flutter section of your pubspec. yaml file. It allows you to use the predefined set of Material icons. Many Material Design widgets need to be inside of a MaterialApp to display properly, in order to inherit theme data.
this was issue for me
Make sure in pubspec.yaml file all the images and fonts have correct path and if you have added new image recently try to remove that and then rebuild
The icons were loading normally on all devices except android for me. To fix it I simply:
Before
Icon(
Icons.chevron_left,
size: 40.0,
color: Colors.white,
),
After
Icon(
MdiIcons.chevronLeft,
size: 40.0,
color: Colors.white,
),
Steps
Add to pubspec yahml
dependencies:
material_design_icons_flutter: ^4.0.5955
Add this to the file you want the icon
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
Instead of Icons.NameHere use MdiIcon.NameHere
if all the above not worked then run
flutter pub run flutter_launcher_icons:main
The problem started in my project when I included my app within GetMaterialApp instead of MaterialApp Widget. All Material icons started to look like [X].