How do I add a logo in Flutter?
Every new flutter app comes with a flutter logo as its default app icon and changing this icon is pretty easy for all flutter-supported platforms. All you have to do is to follow a few simple steps.
Asset bundling
The assets subsection of the flutter section specifies files that should be included with the app. Each asset is identified by an explicit path (relative to the pubspec.yaml file) where the asset file is located. The order in which the assets are declared doesn't matter. The actual directory name used (assets in first example or directory in the above example) doesn't matter.
During a build, Flutter places assets into a special archive called the asset bundle that apps read from at runtime.
✅ 1. Set App Icon (Launcher Icon)
Use the official package: flutter_launcher_icons
🔧 Step-by-step:
a. Add to pubspec.yaml:
dev_dependencies:
flutter_launcher_icons: ^0.13.1flutter_launcher_icons:
android: true
ios: true
image_path: "assets/icon/app_icon.png"Replace
assets/icon/app_icon.pngwith your logo path (512x512 recommended).
b. Run the command:
flutter pub get
flutter pub run flutter_launcher_icons:mainThis will automatically update icons for Android and iOS.
✅ 2. Set Splash Screen (Remove Flutter Logo)
Use: flutter_native_splash
🔧 Step-by-step:
a. Add to pubspec.yaml:
dev_dependencies:
flutter_native_splash: ^2.3.3flutter_native_splash:
color: "#ffffff"
image: assets/icon/splash.png
android: true
ios: trueCustomize the
colorandimagepath as per your splash design.
b. Run the command:
flutter pub get
flutter pub run flutter_native_splash:createThis generates native splash screens and removes the Flutter logo.
✅ 3. Add Image to pubspec.yaml
Ensure your image is declared:
flutter:
assets:
- assets/icon/app_icon.png
- assets/icon/splash.png✅ 4. Clean and Rebuild
After changing icons and splash screens:
flutter clean
flutter pub get
flutter run
Flutter apps can include both code and assets (sometimes called resources). An asset is a file that is bundled and deployed with your app, and is accessible at runtime. Common types of assets include static data (for example, JSON files), configuration files, icons, and images (JPEG, WebP, GIF, animated WebP/GIF, PNG, BMP, and WBMP).


Post a Comment
0Comments