Wednesday, April 4, 2018

Add images to flutter app- Row, Flex, Expanded, Container, Image Widgets



Code:

//this is the example code used in SL Coder - ego coding tutorial videos.
import 'package:flutter/material.dart';
void main() => runApp(new AssetExample());
class AssetExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Assets',
home: new Scaffold(
body: new Row(
children: <Widget>[
new Expanded(
flex: 2,
child: new Image.asset(
'images/egocoding.png',
fit: BoxFit.cover,
),
),
new Expanded(
child: new Image.asset(
'images/egocoding.png',
fit: BoxFit.cover,
),
),
new Expanded(
child: new Image.asset(
'images/egocoding.png',
fit: BoxFit.cover,
),
),
],
),
),
);
}
}

Resources(Images):



No comments:

Post a Comment