Skip to content

Instantly share code, notes, and snippets.

@Blasanka
Last active September 16, 2020 10:25
Show Gist options
  • Save Blasanka/74923852d070c4a0c6eb07953ca9ddd5 to your computer and use it in GitHub Desktop.
Save Blasanka/74923852d070c4a0c6eb07953ca9ddd5 to your computer and use it in GitHub Desktop.
Lear more in slcoderlk.blogspot.com This code demonstrate how to add background image to your flutter app. Also you have to add assets section and specify images in flutter section. https://gist.github.com/Blasanka/3dece37b5b28f5bbf099581ae4cbe8aa
import 'package:flutter/material.dart';
void main() => runApp(new QuoteApp());
class QuoteApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Motivational Quote App',
home: new Scaffold(
body: new Stack(
children: <Widget>[
new Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage('assets/images/bill-gates.jpg'),
fit: BoxFit.cover,
),
),
),
new Center(
child: new Text('Never give up'),
)
],
)),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment