-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: qualityA truly polished experienceA truly polished experienceengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 1.22Found to occur in 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
Hi,
I'm trying to make a simple splash screen with a background Image. The image is a 1024x1024 png file inside assets. I already changed LaunchScreen.storyboard and LaunchImage to the same image and same fit. Everything works fine except for the first frame of flutter app (corresponding to the time that the image was not loaded).
I could try to preload the image but I did not find a way to preload the image before having a builder context.
Steps to Reproduce
- Create new project, change launch image and launchscreen.storyboard in Xcode to show a background image.
- run the code:
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
ImageProvider backgroundImage = AssetImage('assets/Background/login.png');
backgroundImage.resolve(createLocalImageConfiguration(context));
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData.light(),
home: Scaffold(
backgroundColor: Colors.red,
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: backgroundImage,
fit: BoxFit.fill,
),
),
child: Center(child: CircularProgressIndicator()),
),
),
);
}
}In this example the screen flashes red for at least a frame before showing the image correctly. Is there a documented way to preload images from assets before running any builder?
I only tested this on iOS.
Thanks
Logs
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.14.2 18C54, locale en-US)
• Flutter version 1.0.0 at /Users/filipi/Dropbox/flutter
• Framework revision 5391447fae (5 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /Users/filipi/Library/Android/sdk
• Android NDK at /Users/filipi/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.30.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.21.1
[✓] Connected device (2 available)
• Android SDK built for x86 • emulator-5554 •
android-x86 • Android 8.0.0 (API 26) (emulator)
• iPhone 6s • 0C24A047-645B-4E59-85A7-E3EE17EADF52 • ios
• iOS 12.1 (simulator)
• No issues found!
szotp, rumaan, toureholder, duzenko, gmaggio and 46 morevahabghadiri, Shirley0207, oantajames, NiknewJS and cofirazak
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: qualityA truly polished experienceA truly polished experienceengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 1.22Found to occur in 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team