- νΉμ μ’
ν‘λΉλ‘ μμ ν¬κΈ°λ₯Ό μ‘°μ νλ μμ ―
- μ΄λ―Έμ§λ₯Ό νλ©΄μ νμν λλ λΉμ¨λ‘ νμνλ κ²μ΄ μ’λ€
- λ¨Όμ λ μ΄μμ μ μ½μμ νμ©λλ κ°μ₯ ν° λλΉ μλ
- μμ ―μ λμ΄λ λλΉμ μ§μ λ κ°λ‘ μΈλ‘ λΉμ¨μ μ μ©νμ¬ κ²°μ λλ©° λλΉμ λν λμ΄ λΉμ¨λ‘ νν
- ex) νλ©΄ λμ΄ 450, λμ΄ 1000μμ λΉμ¨μ 3/2 μΌλ μ΄λ―Έμ§μ ν¬κΈ°λ
- κ°μ₯ ν° λλΉ -> μ΄λ―Έμ§ λμ΄ 450
- 3/2 λΉμ¨ -> 450* 2/3 = 300 λμ΄κ° λ¨
>> Implementaion
const AspectRatio({
Key? key,
required this.aspectRatio,
Widget? child,
}) : assert(aspectRatio != null),
assert(aspectRatio > 0.0),
// can't test isFinite because that's not a constant expression
super(key: key, child: child);
>> AspectRatio μ£Όμ μμ±
- aspectRatio : κ°λ‘ μΈλ‘ νλ©΄ λΉμ¨ => final double aspectRatio;(required)
- child : μμ νκ°λ§ κ°λ₯ => final Widget? child;
- λ₯κ·Ό μ¬κ°νμ μ¬μ©νμ¬ μμμ μλ₯΄λ μμ ―
- μμ ―μ shapeμ΄λ decoration μμ±μ΄ μλ€λ©΄ ClipRRectλ₯Ό μ΄μ©νμ¬ λͺ¨μ리μ 곑μ μ μ€ μ μλ€.
- Container μμ ― κ°μ κ²½μ° μ¬μ©ν νμ x
- ClipOval, ClipPath λ± ν
λ리λ₯Ό κ΄λ¦¬νλ λ€λ₯Έ μμ ―λ€λ μμ
>> Implementation
const ClipRRect({
Key? key,
this.borderRadius = BorderRadius.zero,
this.clipper,
this.clipBehavior = Clip.antiAlias,
Widget? child,
}) : assert(borderRadius != null || clipper != null),
assert(clipBehavior != null),
super(key: key, child: child);
>> ClipRRect μ£Όμ μμ±
- borderRadius : λ₯κ·Ό λͺ¨μ리μ ν
λ리 λ°μ§λ¦λ₯Ό μ€μ νλ μμ± => final BorderRadius? borderRadius;
- child : μμ νκ°λ§ κ°λ₯ => final Widget? child;