๐จ What I Designed
https://github.com/suojae/flutter_ui_lab/blob/main/lib/2025/01/29.dart
๐ How I Made It
์ฌ์ฉ๋ ์ฃผ์ ์์ ฏ: Container, BoxDecoration, BoxShadow
What is Container?
A container first surrounds the child with padding and then applies additional constraints to the padded extent
์ปจํ ์ด๋๋ ์์์์ ฏ์ padding์ผ๋ก ๋๋ฌ์ผ๋ค. ํจ๋ฉ์ด ์์ผ๋ฉด ์์์์ ฏ์ ์ปจํ ์ด๋๋ ๋ฑ ๋ถ๊ฒ๋๋ค. ๋จ์ฝ ์ ์ฝ์กฐ๊ฑด(constraint)์ ์ค์ ํ๋ฉด ํจ๋ฉ์ ํฌํจํ ์์ญ์ ์ ์ฝ์ด ๋ค์ด๊ฐ๋ค.
During painting, the container first applies the given transform, then paints the decoration to fill the padded extent, then it paints the child, and finally paints the foregroundDecoration, also filling the padded extent.
์ปจํ ์ดํฐ๋ ํ์ , ํฌ๊ธฐ์กฐ์ , ๊ธฐ์ธ์ด๊ธฐ๋ฑ์ "๋ณํ(Transform)"์ ๋จผ์ ์ ์ฉํ "์ฅ์(decoration)", ์์(child)", "์ ๊ฒฝ(ForegroundDecoration)"์ ๊ทธ๋ฆฌ๋ ์์๋ก ์งํ๋๋ค.
Containers with no children try to be as big as possible unless the incoming constraints are unbounded, in which case they try to be as small as possible.
์ปจํ ์ด๋๋ child๊ฐ ์์ผ๋ฉด ํ๋ฉด์ ๊ฝ์ฑ์ด๋ค.
By default, containers return false for all hit tests
๊ธฐ๋ณธ์ ์ผ๋ก ์ปจํ ์ด๋๋ ํํธํ ์คํธ๋ฅผ ๋ฌด์ํ๋ค. ๋ฐ๋ผ์ ๋ง์ฝ ์์ Color๊ฐ์ ํ์์์ ฏ์ด ์์ผ๋ฉด ํ์์์ ฏ์ด ํฐ์น์ด๋ฒคํธ์ ๋ฐ์ํ์ฌ hittest=true ๋ฅผ ๋ฐํํ๋ค.
What is BoxDecoration?
An immutable description of how to paint a box
๋ฐ์ค๋ฅผ ๊ทธ๋ฆฌ๋ ๋ถ๋ณ๊ฐ์ฒด๋ก ํ ๋ฒ ์์ฑํ๋ฉด ์ดํ ๋ด์ฉ ๋ณ๊ฒฝ ๋ถ๊ฐ
The box has a border, a body, and may cast a boxShadow.
BoxDecoration ์ "๊ฒฝ๊ณ(Border)", "๋ชธํต(Body)", "๊ทธ๋ฆผ์(BoxShadow)" ์ธ๊ฐ์ง ์ฃผ์ ์์๋ก ๊ตฌ์ฑ๋๋ค.
What is BoxShadow?
A shadow cast by a box.
BoxShadow๋ ๋ฐ์ค์์ ฏ์ ๊ทธ๋ฆผ์๋ฅผ ์ถ๊ฐํ๋ฉฐ ๋ฐ์ค๊ฐ ๋ ์๋๋ฏํ 3Dํจ๊ณผ๋ฅผ ์ค ์ ์๋ค.
BoxShadow can cast non-rectangular shadows if the box is non-rectangular.
๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ๊ฐํ ๋ชจ์์ ๊ทธ๋ฆผ์๋ฅผ ๋ณด์ฌ์ฃผ์ง๋ง ๋ฐ์ค์ ๋ชจ์์ด ๋ณ๊ฒฝ๋๋ฉด ๊ทธ๋ฆผ์๋ ๊ทธ ๋ชจ์์ ๋ฐ๋ผ๊ฐ๋ค.
This class is similar to CSS box-shadow.
CSS์ฒ์ ์์, ์์น(offset), ํ๋ฆผ์ ๋(Blur), ํ์ฅ์ ๋(Spread)๋ฅผ ์ค์ ํ ์ ์๋ค.
Why is the boxShadow property an array?
BoxShadow๊ฐ ๋ฐฐ์ด๋ก ์ ์๋์ด ์๋ ์ด์ ๋ Container ์์ ฏ์ ์ฌ๋ฌ๊ฐ์ ๊ทธ๋ฆผ์๋ฅผ ๋์์ ์ฉํ๊ฒ ๋ง๋ค๊ธฐ ์ํจ์ด๋ค. ์ ์ฝ๋์ฒ๋ผ ๋นจ๊ฐ/๊ฒ์ Shadow๊ฐ์ ๋ฐฐ์ด์ ๋ด์์ ์ฌ๋ฌ๊ฐ์ ๊ทธ๋ฆผ์๋ฅผ ํํํ ์ ์๋ค.
What's the difference between Container01 and Container02? - InnerBlur vs OuterBlur
ShadowBox01
- blurStyle: BlurStyle.inner๋ ๋ด๋ถ ํ๋ฆผ(Inner Blur) ํจ๊ณผ๋ฅผ ์ ์ฉํ๋ค.
- ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๊ทธ๋ฆผ์๊ฐ ๋ฐ์ค์ ์์ชฝ์ผ๋ก ํผ์ง๊ฒ ํ๋ค ์ด ๋ฐฉ์์ ๋ฌผ๋ฆฌ์ ์ธ ๊ทธ๋ฆผ์๋ณด๋ค๋ ์กฐ๋ช ์ ์ํ ๋ฐ์ฌ์ฒ๋ผ ๋ด๋ถ์ ์ธ, ๊ฐ์ ์ ์ธ ๊ทธ๋ฆผ์ ๋๋์ ์ค ์ ์๋ค.
ShadowBox02
- blurRadius: 12์ spreadRadius: 4๋ฅผ ์ฌ์ฉํ์ฌ ๊ทธ๋ฆผ์๋ฅผ ๋ฐ์ค ๋ฐ๊นฅ์ชฝ์ผ๋ก ํผ์ง๊ฒ ๋ง๋ ๋ค.
- ๊ทธ๋ฆผ์๊ฐ ๋ฐ์ค ์ธ๋ถ๋ก ํ๋ฆฟํ๊ฒ ํ์ฅ๋์ด ์ ์ฒด๊ฐ๊ณผ ๊น์ด๋ฅผ ๊ฐ์กฐํ๋ค.
- spreadRadius๊ฐ 4๋ก ์ค์ ๋์ด ๊ทธ๋ฆผ์๊ฐ ๋๊ฒ ํผ์ง๋ฉฐ, ๊ทธ๋ผ๋ฐ์ด์ ์ฒ๋ผ ๋ณํ๋ ๊ทธ๋ฆผ์์ ๊ฐ์ฅ์๋ฆฌ๋ฅผ ๋ณผ ์ ์๋ค.
๋์ ์ฐจ์ด๋ ์ธ๋ถ/๋ด๋ถ ํ๋ฆผ ๋ฟ๋ง ์๋๋ผ, ๊ทธ๋ฆผ์๊ฐ ์ด๋ป๊ฒ ์ํธ์์ฉํ๋์ง์ ๋ํ ์ฐจ์ด์ด๋ค. ๋ด๋ถ ํ๋ฆผ์ ๋ฐ์ค๊ฐ ๋ฐํ๋ ๊ณต๊ฐ์ ์๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๊ฒ ๋ง๋ค๊ณ , ์ธ๋ถ ํ๋ฆผ์ ๋ฌผ๋ฆฌ์ ์ธ 3D ๊ณต๊ฐ์์ ๊ทธ๋ฆผ์๊ฐ ์ฃผ๋ณ ํ๊ฒฝ์ ์ํด ์ํฅ์ ๋ฐ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๊ฒ ํ๋ค.
'Daily UI' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Bouncing Button in Flutter (0) | 2025.02.01 |
---|---|
Glassmorphism in Flutter (0) | 2025.01.31 |
Blob Animation in Flutter (0) | 2025.01.30 |