text
stringlengths
1
372
in your flutter project’s root directory,
navigate to .../ios/runner. the
Assets.xcassets/AppIcon.appiconset directory already contains
placeholder images. replace them with the appropriately
sized images as indicated by their filename as dictated by the
apple human interface guidelines.
keep the original file names.
<topic_end>
<topic_start>
updating the launch screen
flutter also uses native platform mechanisms to draw
transitional launch screens to your flutter app while the
flutter framework loads. this launch screen persists until
flutter renders the first frame of your application.
info note
this implies that if you don’t call runApp() in the
main() function of your app (or more specifically,
if you don’t call FlutterView.render() in response to
PlatformDispatcher.onDrawFrame),
the launch screen persists forever.
<topic_end>
<topic_start>
android
to add a launch screen (also known as “splash screen”) to your
flutter application, navigate to .../android/app/src/main.
in res/drawable/launch_background.xml,
use this layer list drawable XML to customize
the look of your launch screen. the existing template provides
an example of adding an image to the middle of a white splash
screen in commented code. you can uncomment it or use other
drawables to achieve the intended effect.
for more details, see
adding a splash screen to your android app.
<topic_end>
<topic_start>
iOS
to add an image to the center of your “splash screen”,
navigate to .../ios/runner.
in Assets.xcassets/LaunchImage.imageset,
drop in images named LaunchImage.png,
LaunchImage@2x.png, LaunchImage@3x.png.
if you use different filenames,
update the contents.json file in the same directory.
you can also fully customize your launch screen storyboard
in xcode by opening .../ios/runner.xcworkspace.
navigate to Runner/Runner in the project navigator and
drop in images by opening assets.xcassets or do any
customization using the interface builder in
LaunchScreen.storyboard.
for more details, see
adding a splash screen to your iOS app.
<topic_end>
<topic_start>
display images from the internet
displaying images is fundamental for most mobile apps.
flutter provides the image widget to
display different types of images.
to work with images from a URL, use the
image.network() constructor.
<code_start>
image.network('https://picsum.photos/250?image=9'),
<code_end>
<topic_end>
<topic_start>
bonus: animated gifs
one useful thing about the image widget:
it supports animated gifs.
<code_start>
image.network(
'https://docs.flutter.dev/assets/images/dash/dash-fainting.gif');
<code_end>
<topic_end>
<topic_start>
image fade in with placeholders
the default image.network constructor doesn’t handle more advanced
functionality, such as fading images in after loading.
to accomplish this task,
check out fade in images with a placeholder.
<topic_end>
<topic_start>
interactive example
<code_start>
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
widget build(BuildContext context) {
var title = 'web images';
return MaterialApp(
title: title,
home: scaffold(
appBar: AppBar(
title: text(title),
),
body: image.network('https://picsum.photos/250?image=9'),
),
);
}
}