flutter Change Icon which shows while viewing Background running apps - flutter

How to Change below Icon in flutter. it is happening in Nokia 8.1.
App Icon in drawer is correct.
Below is my current res folder

If you are intending to have your application be multi-platform, then there is a dart package you can use which takes care of generating launcher icons for both platforms.
You use it like so:
Add dependency to pubspec.yaml file
flutter_launcher_icons: ^0.7.4
In your pubspec.yaml file include the following attributes (based on your desires)
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
Make sure to get packages (flutter pub get)
You can read more in the documentation.

Right click on the android folder in the project outline. Go to New > Image Asset. (Try right clicking the android/app folder if you don't see Image Asset as an option.) Now you can select an image to create your launcher icon from.
This will replace the current launcher icons. You can find the generated icons in the mipmap folders:

Related

How to change app name and icon on flutter desktop windows with build?

I have written a Flutter Desktop app for windows and I want to change the name and icon of app. I change icon from windows>runner>resources and I change app name from windows>runner>main.cpp. They look changed when I debug. But when I get a build with command flutter build windows, the .exe coming to my Release folder is still with old name and flutter icon. I also want the .exe coming from build with new icon and name. How can I do it?
For APP Icon
esay way too add app icon use flutter plugin flutter_launcher_icons after add that code in pub.yam file.
dev_dependencies:
flutter_launcher_icons: "^0.10.0"
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
min_sdk_android: 21
web:
generate: true
image_path: "path/to/image.png"`
background_color: "#hexcode"
theme_color: "#hexcode"
windows:
generate: true
image_path:"path/to/image.png"
icon_size: 48
if you change window,web ya android application icon just add your icon path on that particular device application.
If you name your configuration file something other than flutter_launcher_icons.yaml or pubspec.yaml you will need to specify the name of the file when running the package.
flutter pub get
flutter pub run flutter_launcher_icons:main -f <your config file name here>
Second Way
go your Project file in that location windows\runner\resources on that resource folder youcan see your window application image change that image with your chossen image.
Change APP Name
You can use plugin rename: ^2.0.1 too change application name
You can change the bundleId and appName in following folders
IOS
Android
MacOS
Linux
Web
Window
you just install that pluging and after you just type command.
that command chage your application name in all device application.
pub global run rename --appname "Network App"
but if you change only particular device app.so you can type that command.
pub global run rename --bundleId com.example.android.app --target
-t, --target Set which platforms to target.
[android, ios, macOS, linux]

How to set custom image icon on Flutter App? Using Appicon

I Tried changing my app's Icon on apk but it's not changing. I generated an icon on https://appicon.co/ and try changing but it's showing flutter's default app icon.
Try this flutter_launcher_icons
In pubsec.yaml
dev_dependencies:
flutter_launcher_icons: "^0.10.0"
flutter_icons:
android: true
ios: true
image_path: "assets/icon/icon.png"
min_sdk_android: 21 # android min sdk min:16, default 21
And then run this on your terminal (from android studio)
flutter pub run flutter_launcher_icons:main
The command will regenerate icons for android and ios. You can check it in the corresponding folders (eg for android : app/src/main/res/drawable-xxx/ic_launcher)
If you are coming from the future and you have difficulty using the flutter_launcher_icons package.
In July 2022, I tried using the flutter_launcher_icons package (version: "^0.9.2") but it did not work when running the
flutter pub run flutter_launcher_icons:main
and got the famous error 255 code.
After a little search on google, I came across this (very short) and followed this article here: https://www.codewithflutter.com/how-to-change-application-launcher-icon-in-flutter/.
This is what I did to get a launcher icon for the devices that my app would run on.
It's a simple 3 step method to change the app launcher icon.
Step 1:
Go to https://appicon.co/ and use select your launcher's image file.
For best results, it should be 1024 x 1024 pixels.
Select the devices for which you would like the app icon to be generated for. Click on the "Generate" button and a zip file would be downloaded.
When you open the downloaded zip file, it would normally contain the "android" and the "Assets.xcassets" folders (assuming you are generating for both android and ios devices).
Step 2:
Changing the icons manually.
This process is just copying and pasting the folders.
For android:
Open the AppIcons\Android folder and copy all the sub folders.
Then go the android\app\src\main\res folder and paste it (replace the existing file to new files).
For ios:
Open the AppIcons folder and copy the Assets.xcassets folder.
Then go the ios/Runner and paste it (replace the existing file to new files).
Step 3:
Run the command flutter run
Thank you!

What is packages in Flutter assets inside pubspec.yaml file?

I'm using flutter gallery sample code, and found following in pubspec.yaml file.
flutter:
assets:
- packages/shrine_images/0-0.jpg
I tried to find out packages and 0-0.jpg file in the project but couldn't find. Can anyone tell me what this package is all about and from where I am seeing images when running the app?
Actually they have added a package
flutter_gallery_assets: 0.1.9+2
Check it in pubspec.yaml dependencies, its a package so that you can use images from this package. So the pictures are from that package and they are just mentioning the image path from that package. Here is the package link they are using click here

How can I make my Flutter app work also as a module app?

I've created a Flutter standalone app and it's all working fine.
But now I want to integrate some of the screens of that Flutter app in an existing Android/iOS app.
Is it possible?
Yes.
I could make it work by adding this at the end of the pubspec.yaml:
module:
androidPackage: com.teste.embeded
iosBundleIdentifier: com.teste.embeded
Add this and then call a packages get. This will create 2 hidden folders in your project structure: .android and .ios.
Becareful with the identation! This settings must be inside the flutter: tag, like this:
flutter:
uses-material-design: true
assets:
- images/a_dot_burr.jpeg
- images/a_dot_ham.jpeg
module:
androidPackage: com.test.embeded
iosBundleIdentifier: com.test.embeded
After doing this, follow the documentation for the Android/iOS sides (skip the module creating parts).
https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
You can do that in tow ways:
1- Convert your project to Flutter module and then put that along side the native project and call your FlutterActivity from native
2- Convert your project to Flutter module and make an AAR from it ant import in the native project
Read this Flutter documentation:
https://flutter.dev/docs/development/add-to-app/android/project-setup

Target of URI doesn't exist 'package:english_words/english_words.dart'

I'm learning to use Flutter using Android Studio. I'm going through step by step doc provided by Flutter. At Step:2 Use an external package I'm getting issue importing the english_words package. I have properly added the package in pubspec.yaml and clicked Packages Get which added the dependency but at the time of importing the package in lib/main.dart it is saying
Target of URI doesn't exist
'package:english_words/english_words.dart'.
I have seen many questions on StackOverflow but none of them helped me. Please help!
For some packages, once you do all the process described by the other answers to this question, you have to close the Android project and open it again. As well as the emulator.
Some packages need the restart, others do not need it.
After adding the package in the pubspec.yaml file, you need to execute the command flutter packages get or click on "Packages Get" in the action ribbon at the top of pubspec.yaml file.
Then the dependency and any transitive dependency will be added to the .packages file.
Check this:
https://flutter.io/using-packages/
Solution (For VSCode):
Run flutter packages get in pubspec.yml
Restart VSCode
I had the same issue and went about it like listed below and it worked.
1. Add the package
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
**english_words: ^3.1.5**
Save the pubspec.yaml file
go to your terminal and run 'flutter packages get'
4.Close your simulator and rebuild your cradle
Run the main.dart again and it should remove the error.
This is what worked for me, all the best.
Make sure that english_words is on the base-line with flutter:
Took me a lot of time, but in summary, just save the file pubspec.yaml will do. The command flutter pub get will be ran once u save it, then u can import the package.
There is no need to restart ur editor etc.
My solution was to add the "english_words: ^3.1.5" the version at the moment that I write this, under the "dependencies:" and before the "Flutter:" argument, without the "+" sign.
Hope that helps
I used this and it worked for me... without + sign and version in double quote ""..
english_words: "^3.1.5"
Make Sure that the alignment of english_words is correct inside your pubspec.yaml as it's "space sensitive" :
dependencies:
english_words: ^3.1.5 //two spaces
also never align it using tabs, I don't know why but it never works, and don't use + sign
There are so many methods to solve this issue, most of them will get solved on the second step,if not please try third method also it will work.
Run flutter packages get in pubsec.yaml file (if you are using VS Code it will be easier).
Restart your IDE.
Check it now, mostly it will work. If not try third step.
you have to repair pub caches
flutter packages pub cache repair
I hope it will work. if all methods are not working try to re install flutter.
my friend solution is so simple only add this code line in file pubspec.yaml
english_words: ^3.1.0
like this
dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
english_words: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
it would work perfectly:)
I faced the same issue but I managed to solve it using the steps below:
add the package as an example english_words: ^3.1.0" in 'pubspec.yaml file.
save file or press ctrl+s
//the Output Console will appear this message
[app name] flutter packages get.
Running "flutter pub get" in first_app..., 2.4s
exit code 0.).
3. check main.dart file, the error will be removed.
For me nothing worked. Things resolved only after
Flutter upgrade
in pubsec.yaml file
For those who are still experiencing this problem, it took me hours to figure out what was wrong. Basically, if all the other answers don't work:
Open the test/.packages file on whatever IDE you are using
Locate the package that is not working and go to that directory on your computer.
Delete the whole package. In my case it was the whole english_words package folder.
In the pubspec.lock and .packages file, delete all instances of that package.
run pub get
In the docs of https://flutter.dev/docs/get-started/codelab there is the following code:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
+ english_words: ^3.1.5
The thing which is causing the error is "+ sign". I just removed it and all worked fine for me.
Delete the plus sign "+" in front of english_words (if you have one)
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
english_words: ^3.1.5
I got the same issue.
It is observed only in version 4.0.0 .For lower versions there is no problem.
So here is what you can do to solve this:
Download code for the dependency from :
https://github.com/filiph/english_words
Unzip it Rename it to
english_words-4.0.0
Copy this folder.
Now go to flutter's SDK folder and navigate to
.pub-cache\hosted\pub.dartlang.org
and paste the folder english_words-4.0.0 here. Add dependency in pubspec.yaml file. Now run flutter pub get command.
You are good to go.
Note : How to find the path of Flutter SDK
All you need to do is to restart IDE(Android studio or VSCode)
Having this error message:
Error: Cannot run with sound null safety, because the following
dependencies don't support null safety:
package:english_words
I had to change this dependency english_words: ^3.1.5 to the latest version english_words: ^4.0.0 and make "pub get":
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
english_words: ^4.0.0
provider: ^6.0.0
in your pubspec.yaml file, instead of:
english_words: ^4.0.0
try:
english_words: '4.0.0'
it worked for me