Skip to content

Instantly share code, notes, and snippets.

@ybakos
Last active February 3, 2020 01:54
Show Gist options
  • Save ybakos/f19c59836e8668f4fcefe07f6989f5c1 to your computer and use it in GitHub Desktop.
Save ybakos/f19c59836e8668f4fcefe07f6989f5c1 to your computer and use it in GitHub Desktop.
CS 492 Week 6 Exploration 1 Exercise
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)),
]
)
);
}
}
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