본문 바로가기

Dead Code/Flutter_Dart

[플러터] web 빌드 그리고 row/column 리스트 개별 관리

Github에 flutter로 만든 웹사이트를 올릴때,

flutter build web 으로 빌드

web 폴더 push

index 파일의 경로를 / 에서 ./ 로 수정

 

Row나 Column 위젯에서,

리스트의 일부만 특정한 함수를 적용하고 싶다면, 리스트를 2개로 가르고, 1번리스트에만 기능을 적용한다. 그리고 두개의 리스트를 +로 합쳐준다.

아래 예시는 리스트 중 3개의 Container Widget 중 1,2번만 색상이 변경되는 경우를 만들어 본 것이다.

 

 

 

child: Row(
  mainAxisAlignment: MainAxisAlignment.center,
  children: colortilelist +
      [
        Container(
          color: Colors.amber,
          child: Padding(padding: EdgeInsets.all(50.0)),
        ),
      ],
),

 

 

 

별거 아닌걸 너무 장황하게 적었나?