简体   繁体   English

为什么我的 flutter_native_splash 不起作用?

[英]Why doesn't my flutter_native_splash work?

When I launch the app, the background color works, but the image doesn't show.当我启动该应用程序时,背景颜色有效,但图像不显示。 I have my assets folder in my root directory, and the directory address is matched correctly, but the error persists.我的根目录下有我的assets文件夹,目录地址匹配正确,但错误依旧。

I followed these steps and have this as my pubspec.yaml:我遵循了这些步骤并将其作为我的 pubspec.yaml:

flutter_native_splash:
  color: "#000000"
  image: assets/icon_500.png   

here is my code that runs这是我运行的代码

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const Main());
  FlutterNativeSplash.remove();
}

I ran these terminal commands:我运行了这些终端命令:

flutter clean
flutter pub get
flutter pub run flutter_native_splash:remove

flutter clean
flutter pub get
flutter pub run flutter_native_splash:create

picture of my issue我的问题的图片

You have to do like this .你必须这样 Maybe you have missed something.也许你错过了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何删除或更改flutter_native_splash? - How to remove or change flutter_native_splash? flutter_native_splash package:图像在 Android 上没有按比例缩小 - flutter_native_splash package: image does not scale down on Android 你可以在 flutter_native_splash 中调整图像的大小吗? - Can you resize an image in a flutter_native_splash? "根据flutter_native_splash的初始化阶段决定路由" - decide the route based on the initialization phase of flutter_native_splash 如何从应用程序中删除flutter_native_splash? - How to remove flutter_native_splash from app? 任务“:flutter_native_splash:extractDebugAnnotations”执行失败 - Execution failed for task ':flutter_native_splash:extractDebugAnnotations' 如何在 flutter 中使用 flutter_native_splash package 更改启动画面的时间? - How to change time for splash screen using flutter_native_splash package in flutter? android 设备 flutter 中的闪屏不是全屏。 尝试了一切。 使用 flutter_native_splash - Splash Screen not full screen in android device flutter. Tried everyting. Using flutter_native_splash 用户登录时使用flutter_native_splash时如何跳过启动画面 - How to skip the splash screen when use flutter_native_splash while user is logged In 如何使用 Flutter_native_splash 在初始屏幕底部添加文本 - How to add text at bottom in splash screen using Flutter_native_splash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM