Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MaterialApp(
- home: Home(),
- ));
- class Home extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(
- 'App bar',
- style: TextStyle(color: Colors.white),
- ),
- centerTitle: true,
- backgroundColor: Colors.red,
- ),
- body: Row(
- // mainAxisAlignment : MainAxisAlignment.end,
- // crossAxisAlignment : CrossAxisAlignment.start,
- children : <Widget>[
- //Expanded use case => used to display within given boundary
- Expanded(
- child : Image.network('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT5fekdY7QzAbN4Dvy_xIJHUbiyBNXn3qvUIw&usqp=CAU'),
- flex : 3
- ),
- Expanded( //use to expand so that there is no space left in between Widgets
- flex : 3, //proportion that's needede to be flexed
- child : Container(
- padding : EdgeInsets.all(30.0),
- color : Colors.blue,
- child : Text('1'),
- ),
- ),
- Expanded( //use to expand so that there is no space left in between Widgets
- flex : 2, //proportion that's needede to be flexed
- child : Container(
- padding : EdgeInsets.all(30.0),
- color : Colors.green,
- child : Text('2'),
- ),
- ),
- Expanded( //use to expand so that there is no space left in between Widgets
- flex : 1, //proportion that's needede to be flexed
- child : Container(
- padding : EdgeInsets.all(30.0),
- color : Colors.orange,
- child : Text('3'),
- ),
- ),
- ],
- ),
- floatingActionButton: FloatingActionButton(
- child: Text('click me'),
- onPressed: null,
- backgroundColor: Colors.red,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement