티스토리 뷰

Flutter

Flutter crossAxisAlignment property

아이언 베어 2020. 12. 12. 22:17

crossAxisAlignment property

The crossAxisAlignment property determines how Row and Column can position their children on their cross axes. A Row’s cross axis is vertical, and a Column’s cross axis is horizontal. The crossAxisAlignment property has five possible values:

 

 


CrossAxisAlignment.start

Positions children near the start of the cross axis. (Top for Row, Left for Column)

- Row의 경우 위, Column의 경우 왼쪽

 

 

 

1
2
3
4
5
6
7
8
Row /*or Column*/( 
  crossAxisAlignment: CrossAxisAlignment.center,
  children: <Widget>[
    Icon(Icons.star, size: 50),
   Icon(Icons.star, size: 150),
    Icon(Icons.star, size: 50),
  ],
),
cs

 

 


CrossAxisAlignment.end

Positions children near the end of the cross axis. (Bottom for Row, Right for Column)

- Row의 경우 아래, Column의 경우 오른쪽

 

 

 


CrossAxisAlignment.center

Positions children at the middle of the cross axis. (Middle for Row, Center for Column)

-  cross axis 가운데에 배치

 

 

 


CrossAxisAlignment.stretch

Stretches children across the cross axis. (Top-to-bottom for Row, left-to-right for Column)

 


CrossAxisAlignment.baseline

Aligns children by their character baselines. (Text class only, and requires that the textBaseline property is set to TextBaseline.alphabetic. See the Text widget section for an example.)

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Row(
  crossAxisAlignment: CrossAxisAlignment.baseline,
  textBaseline: TextBaseline.alphabetic,
  children: <Widget>[
    Text(
      'Baseline',
      style: Theme.of(context).textTheme.display3,
    ),
    Text(
      'Baseline',
      style: Theme.of(context).textTheme.body1,
    ),
  ],
),
cs

'Flutter' 카테고리의 다른 글

Flutter Building layouts Tutorial  (0) 2020.12.13
Introduction to widgets  (0) 2020.12.13
Row and Column classes  (0) 2020.12.12
Flutter layout practice/플러터 레이아웃 연습  (0) 2020.12.12
Flutter webview/플러터 웹뷰  (0) 2020.12.12