How to remove or change flutter_native_splash? - flutter

I use flutter_native_splash: ^2.1.2+1.
I wanted to set white background color, but I set a different color.
I called flutter pub run flutter_native_splash:create twice.
First time, with the other color. Second time with white.
So, splash pops up two times.
Has flutter_native_splash deleted or changed commands?

I had the same problem, it seems it is caused by Springboard caching LaunchStoryboard.storyboard's images.
My problem was solved by doing this:
Delete your app from the device
Restart the device, re-install and launch the app.

Try with remove and clean ;)
flutter clean
flutter pub get
flutter pub run flutter_native_splash:remove
flutter clean
flutter pub get
flutter pub run flutter_native_splash:create

Related

Flutter File_picker MissingPluginException

I'm trying to install file picker except that when my button is clicked or the file picker function is assigned, I have this error that appears: "MissingPluginException (MissingPluginException(No implementation found for method any on channel miguelruivo.flutter.plugins.filepicker))"
I couldn't find anything about it
image_picker and file_picker don't work well with the ios simulator. You have to use a real device instead.
in your project path use this command
flutter clean

I tried updating dart and now wall the lines are red

I can't seem to post an image yet but my entire main.dart is red including the 'package:flutter/material.dart' and other widgets.
Try flutter clean and then flutter pub get.
If that doesn't work, you can try upgrading your Flutter SDK (again?) like so: flutter upgrade.
You can also run flutter doctor to see a list of possible issues with your code.

What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'

How to use custom icon in flutter, using android studio! I need to know what we want to do in pubspec.yaml. Because I got an error in pubspec.yaml, cant view a icon in our program.
It can help if you specify what sort of icon you are trying to add, and if you share some of your pubspec file. Are we talking about an app icon (using a package like flutter_launcher_icons) or icons to use within the app (like the ones created via fluttericon.com).
I'll assume you're talking about launcher icons.
First make sure you have the package:
https://pub.dev/packages/flutter_launcher_icons
In the root of your pubspec.yaml file, you can add lines like:
flutter_icons:
android: true
ios: true
image_path: "assets/myIcon.png"
adaptive_icon_background: "#ffffff"
adaptive_icon_foreground: "assets/myIconForeground.png"
This will use myIcon.png for the iOS app, and apply the foreground image on a white background for Android (where depending on your phone, a circular or square icon can be used).
Now you may notice the asset paths, you can also add the icons as assets to your app such that you can use them elsewhere.
flutter:
...
assets:
- assets/myIcon.png
- assets/myIconForeground.png
After which you should be able to run the plugin and generate your native icons:
flutter pub run flutter_launcher_icons:main

Flutter (2.5) - A splash screen was provided to Flutter, but this is deprecated

I am new to flutter and recently tried to develop a test app for learning sake with latest version Flutter 2.5. By looking at some tutorial online, I have added flutter_native_splash: ^1.2.3 package for splash screen. And works fine.
However, when I launch app for the first time, it shows following debug message
W/FlutterActivityAndFragmentDelegate(18569): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
After visiting the above link, I am not able to understand much what is supposed to be done.
Code in pubspec.yaml
flutter_native_splash:
color: "#FFFFFF"
color_dark: "#000000"
image: assets/images/splash_720.png
android: true
ios: true
android12: true
Also, compileSdkVersion and targetSdkVersion is set to 31 in build.gradle
Please help. Thanks in advance.
To avoid that warning you just need to remove that API usage from your project.
Remove these lines of code from the AndroidManifest.xml file.
Previously, Android Flutter apps would either set io.flutter.embedding.android.SplashScreenDrawable in their application manifest, or implement provideSplashScreen within their Flutter Activity. This would be shown momentarily in between the time after the Android launch screen is shown and when Flutter has drawn the first frame. This is no longer needed and is deprecated – Flutter now automatically keeps the Android launch screen displayed until Flutter has drawn the first frame. Developers should instead remove the usage of these APIs. - source
UPDATE (FLUTTER 2.8.0)
As per the flutter 2.8.0 update, The newly created project doesn't have this warning.
They removed unused API from Androidmanifest.yml but still have belove mentioned code.
Remove the below lines from the android manifest file. It's no longer used
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"/>

How to restart app with button in flutter

I have a setting screen, when I change FontFamily it needs to restart the app to change all app fonts, And it restarts after the app closed, but I want to restart the app with a button instead of closing the app. does there any way to do this ?
The best solution... using "Restart App" module
Instal from your teminal:
flutter pub add restart_app
Import from your dart file:
import 'package:restart_app/restart_app.dart';
Call "Restart App" from your Button:
onPressed: () {
Restart.restartApp();}
Have a nice day...
Use this package https://pub.dev/packages/flutter_phoenix and call Phoenix.rebirth(context); when you want to reload the app
I have implemented the https://pub.dev/packages/flutter_phoenix package in my app, to restart the app wrap widget with Phoenix on the line of code:
runApp(Phoenix(child: MyApp()))
wherever you want to restart the app just implement this line of code
Phoenix.rebirth(context);
hope this help