Play Flutter Quiz. Click here .

How to add a Background Images to the Screen?

This Article is posted by at 25-12-2018 21:09:20

You can do this by using DecoratedBox Widget. The example code below.

Note: You can observe that Child of DecoratedBox doesn't have any code. If you are trying this example, you need to add image to your project and also add some widgets to Child within DecoaratedBox.

import 'package:flutter/material.dart';

void main() => runApp(BackgroundScreen());

class BackgroundScreen extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Backgroun Image',
home: Scaffold(
body: DecoratedBox(
position: DecorationPosition.background,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('Images/Landscape.jpg'),
fit: BoxFit.cover),
//Rest of the widgets go here..


Tags: How to add a Background Images to the Screen?

Login to comment.

Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.

© 2018 - Fluttercentral | Email to me -

Terms | Privacy