Skip to content

Instantly share code, notes, and snippets.

@flexboni
Last active November 29, 2023 01:58
Show Gist options
  • Save flexboni/3f8dd659c13361be46c1a8e7f5082dc3 to your computer and use it in GitHub Desktop.
Save flexboni/3f8dd659c13361be46c1a8e7f5082dc3 to your computer and use it in GitHub Desktop.
플러터챌린지 3일차 심화문제 - 김구봉
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
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> {
double headScale = 1.1;
double bodyScale = 1.1;
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size.width;
return Scaffold(
body: Container(
color: Colors.black,
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: size * 0.4,
height: size * 0.4,
clipBehavior: Clip.hardEdge,
padding: const EdgeInsets.fromLTRB(10, 20, 10, 0),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Transform.scale(
scale: headScale,
child: Container(
width: size * 0.2,
height: size * 0.2,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(90),
),
),
),
const SizedBox(height: 20),
Expanded(
child: Transform.scale(
scale: bodyScale,
child: Container(
width: size * 0.3,
height: size * 0.2,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
),
),
),
],
),
),
const SizedBox(height: 20),
Slider(
value: headScale,
min: 1.0,
max: 1.2,
onChanged: (value) {
setState(() {
headScale = value;
});
},
),
const SizedBox(height: 20),
Slider(
value: bodyScale,
min: 1.0,
max: 1.2,
onChanged: (value) {
setState(() {
bodyScale = value;
});
},
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment