-
-
Save diego1araujo/bfffd9c4c0d4f543aaf5d70c65ec72d7 to your computer and use it in GitHub Desktop.
Using rows and columns to create an asymmetric grid-like layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', | |
| theme: ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: Scaffold( | |
| appBar: AppBar(title: Text('Rows & Columns')), | |
| body: RowsAndColumns(), | |
| ), | |
| ); | |
| } | |
| } | |
| class RowsAndColumns extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Padding( | |
| padding: const EdgeInsets.only(top: 100.0), | |
| child: IntrinsicHeight( | |
| child: Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ | |
| Expanded( | |
| child: Column(children: [ | |
| Container(height: 120.0, color: Colors.yellow), | |
| Container(height: 100.0, color: Colors.cyan), | |
| ]), | |
| ), | |
| Expanded(child: Container(color: Colors.amber)), | |
| ]), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment