[英]Why doesn't my flutter_native_splash work?
當我啟動該應用程序時,背景顏色有效,但圖像不顯示。 我的根目錄下有我的assets文件夾,目錄地址匹配正確,但錯誤依舊。
我遵循了這些步驟並將其作為我的 pubspec.yaml:
flutter_native_splash:
color: "#000000"
image: assets/icon_500.png
這是我運行的代碼
void main() {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
WidgetsFlutterBinding.ensureInitialized();
runApp(const Main());
FlutterNativeSplash.remove();
}
我運行了這些終端命令:
flutter clean
flutter pub get
flutter pub run flutter_native_splash:remove
flutter clean
flutter pub get
flutter pub run flutter_native_splash:create
你必須這樣做。 也許你錯過了什么。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.