mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-07-15 02:46:03 +08:00
implemented load_local_image example
This commit is contained in:
29
load_local_image/lib/main.dart
Normal file
29
load_local_image/lib/main.dart
Normal file
@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
home: new MyApp(),
|
||||
));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text("Load local image"),
|
||||
),
|
||||
body: new Container(
|
||||
child: new Center(
|
||||
child: new Text("Hellow World!"),
|
||||
),
|
||||
// Set the image as the background of the Container
|
||||
decoration: new BoxDecoration(
|
||||
image: new DecorationImage(
|
||||
// Load image from assets
|
||||
image: new AssetImage('data_repo/img/bg1.jpg'),
|
||||
// Make the image cover the whole area
|
||||
fit: BoxFit.cover)),
|
||||
));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user