Skip to content

Instantly share code, notes, and snippets.

@snakesonaguy
Created February 16, 2020 18:26
Show Gist options
  • Save snakesonaguy/a174c7e3a2a6131c55dc939d2625f6a3 to your computer and use it in GitHub Desktop.
Save snakesonaguy/a174c7e3a2a6131c55dc939d2625f6a3 to your computer and use it in GitHub Desktop.
Layout Challenge
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Layout Challenge',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MainPage(title: 'Layout Challenge'),
);
}
}
class MainPage extends StatelessWidget {
final String title;
MainPage({this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget> [
Padding(
padding: EdgeInsets.only(top: 100),
child: Center(
child: Container(
color: Colors.blue[100],
height: 200.0,
child: Padding(
padding: EdgeInsets.only(top: 35),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
],
),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 20, bottom: 50),
child: Center(
child: Container(
color: Colors.blue[100],
height: 200.0,
child: Padding(
padding: EdgeInsets.only(top: 35),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
Container(
width: 100.0,
height: 100.0,
color: Colors.purple[100],
),
],
),
),
),
),
)
]
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment