Last active
February 3, 2020 01:54
-
-
Save ybakos/f19c59836e8668f4fcefe07f6989f5c1 to your computer and use it in GitHub Desktop.
CS 492 Week 6 Exploration 1 Exercise
This file contains 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( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold(body: Exercise()) | |
); | |
} | |
} | |
class Exercise extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Align( | |
heightFactor: 0.8, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Container( | |
color: Colors.pink, | |
width: MediaQuery.of(context).size.width * 0.25 | |
), | |
Expanded(flex: 4, child: Container()), | |
Expanded(child: Container(color: Colors.blue)), | |
] | |
) | |
); | |
} | |
} |
This file contains 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( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold(body: Exercise()) | |
); | |
} | |
} | |
class Exercise extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Center( | |
child: FractionallySizedBox( | |
heightFactor: 0.6, | |
child: Padding( | |
padding: EdgeInsets.symmetric(horizontal: padding(context)), | |
child:Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Expanded(child: Container(color: Colors.red)), | |
Expanded(child: Container()), | |
Expanded(child: Container(color: Colors.green)), | |
] | |
) | |
) | |
) | |
); | |
} | |
double padding(BuildContext context) { | |
return MediaQuery.of(context).size.width * 0.1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment