- ๋น ๋ฐ์ค ์์ ฏ
- BUT SizedBox์ ์ฐจ์ด์ ์ ๋ด๋ถ์ decoration ์์ฑ์ด ์์ด ๋ฐ์ค๋ฅผ ๊พธ๋ฐ ์ ์๋ค.cf)SizedBox๋ ๋ณดํต ๋ง์ง์ ์ค ๋ ์ฌ์ฉ
- ์์์ด ์๋ Container๋ ๊ฐ๋ฅํ ํ ๋ฐ์ค๋ฅผ ํฌ๊ฒ ๋ง๋ค๋ ค๊ณ ํจ
- but ์์์ด ์๋ COntainer๋ ์์์ ํฌ๊ธฐ์ ๋ง๊ฒ ์กฐ์ ๋จ
Container({ Key? key, this.alignment, this.padding, this.color, this.decoration, this.foregroundDecoration, double? width, double? height, BoxConstraints? constraints, this.margin, this.transform, this.transformAlignment, this.child, this.clipBehavior = Clip.none, }) : assert(margin == null || margin.isNonNegative), assert(padding == null || padding.isNonNegative), assert(decoration == null || decoration.debugAssertIsValid()), assert(constraints == null || constraints.debugAssertIsValid()), assert(clipBehavior != null), assert(decoration != null || clipBehavior == Clip.none), assert(color == null || decoration == null, 'Cannot provide both a color and a decoration\n' 'To provide both, use "decoration: BoxDecoration(color: color)".', ), constraints = (width != null || height != null) ? constraints?.tighten(width: width, height: height) ?? BoxConstraints.tightFor(width: width, height: height) : constraints, super(key: key);
- padding : ์ฅ์ ๋ด๋ถ์ ์๊ธธ ๋น ๊ณต๊ฐ, child๋ padding ์์ ๋ฐฐ์น ๋จ => final EdgeInsetsGeometry? padding;
- color : child ๋ท ๋ฐฐ๊ฒฝ์ , ๊ทธ๋ผ๋ฐ์ด์ ์ด๋ฏธ์ง ๊ฐ์ ๊ฒ์ decoration์์ ํ์ฉ => final Color? color;
- decoration : child๋ฅผ ์ฅ์ํ๋ ์์ฑ => final BoxDecoration? decoratino;(์ฃผ๋ก ์ฌ์ฉ)
- width, height : container ๊ฐ๋ก ์ธ๋ก ํฌ๊ธฐ
- constraints : ํ์ ํญ๋ชฉ์ ์ ์ฉํ ์ถ๊ฐ ์ ์ฝ ์กฐ๊ฑด => final BoxConstraints? constraints;
- ์์ฑ์ ํญ ๋ฐ ๋์ด ์ธ์ ๋ฑ๋ฑ
- ํจ๋ฉ์ ๊ตฌ์์กฐ๊ฑด ์์ผ๋ก ๋ค์ด๊ฐ
- child : ํ ๊ฐ์ ์์ ฏ๋ง ๊ฐ๋ฅ => final Widget? child;
- alignment : child ๋ด๋ถ๋ฅผ ์ ๋ ฌ => final AlignmentGeometry? alignment;
- ์์๋ฅผ ๊ทธ๋ฆฌ๋ ๋ค์ํ ๋ฐฉ๋ฒ ์ ๊ณต
const BoxDecoration({ this.color, this.image, this.border, this.borderRadius, this.boxShadow, this.gradient, this.backgroundBlendMode, this.shape = BoxShape.rectangle, }) : assert(shape != null), assert( backgroundBlendMode == null || color != null || gradient != null, "backgroundBlendMode applies to BoxDecoration's background color or " 'gradient, but no color or gradient was provided.', );
- color : ์์์ ๋ฐฐ๊ฒฝ์ ์ฑ์ธ ์์ => final Color? color;
1. ์์์ ์์ ๋ชจ์์ผ๋ก ์ฑ์์ง- image : ๋ฐฐ๊ฒฝ์ ๋๋ ๊ทธ๋ผ๋ฐ์ด์ ์์ ๊ทธ๋ฆด ์ด๋ฏธ์ง => final DecorationImage? image;
- border : ํ ๋๋ฆฌ๋ฅผ ๊ทธ๋ฆฌ๋ ์์ฑ => final BoxBorder? border;
- shape, borderRadius ์์ฑ์ ๋ฐ๋ฅธ๋ค
- borderRadius : ํ ๋๋ฆฌ๋ฅผ ์ผ๋งํผ ๋ฅ๊ธ๊ฒ ๋ง๋ค์ง ๊ฒฐ์ ํ๋ ์์ฑ => final BorderRadiusGeometry? borderRadius;
- ๋ชจ์์ด๋ ํ ๋๋ฆฌ๊ฐ ์ฅ์๋ Container์ child๋ฅผ ์๋ผ๋ด์ง ์์
- shape : ๋ฐ์ค ๋ชจ์์ ๊ฒฐ์ ํ๋ ์์ ฏ(circle,Recktangle) => final BoxShape shape;
- ๋ชจ์์ด๋ ํ ๋๋ฆฌ๊ฐ ์ฅ์๋ Container์ child๋ฅผ ์๋ผ๋ด์ง ์์