Skip to content

Instantly share code, notes, and snippets.

@flexboni
Last active November 29, 2023 01:20
Show Gist options
  • Save flexboni/9dfcf34cba1007782f6c47e714c03710 to your computer and use it in GitHub Desktop.
Save flexboni/9dfcf34cba1007782f6c47e714c03710 to your computer and use it in GitHub Desktop.
플러터챌린지 3일차 기본문제 - 김구봉
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarColor: Colors.transparent),
);
return MaterialApp(
title: 'Flutter Challenge',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
return Scaffold(
body: Container(
color: Colors.black,
child: Column(
children: [
Container(
height: height * 0.1,
alignment: Alignment.center,
color: Colors.red,
child: const Text('I can layout this'),
),
Expanded(
child: Column(
children: [
Expanded(
child: Row(
children: [
Expanded(child: Container(color: Colors.grey)),
const SizedBox(width: 5),
Expanded(
child: Column(
children: [
Expanded(
child: Container(
color: Colors.blue,
),
),
Expanded(child: Container(color: Colors.white)),
],
),
),
],
),
),
const SizedBox(height: 5),
Expanded(
child: Row(
children: [
Expanded(
child: Column(
children: [
Expanded(
flex: 5,
child: Container(color: Colors.white),
),
Expanded(
flex: 3,
child: Container(color: Colors.green),
),
],
),
),
const SizedBox(width: 5),
Expanded(
child: Container(
padding: const EdgeInsets.fromLTRB(15, 15, 15, 0),
color: Colors.white,
child: Column(
children: [
Expanded(
child: Container(
color: Colors.yellow,
),
),
const Expanded(child: SizedBox()),
],
),
),
),
],
),
),
],
),
),
Expanded(
child: Column(
children: [
Expanded(
flex: 5,
child: Container(
color: Colors.yellow,
),
),
Expanded(
flex: 2,
child: Container(
color: Colors.brown,
),
),
],
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment