Flutter

황인호·2022년 12월 19일
0

Flutter

  • 모든 UI의 기원은 네모박스이다.
  1. 박스에 여백을 주는 방법
    => margin : 박스 바깥 테두리에 여백을 줌
    => padding : 박스 안쪽에 여백을 줌

  2. 박스에 테두리를 주는 방법
    => decoration

  3. 박스의 위치를 정렬하는 방법
    => Container 를 Align으로 감싼다.
    example

import 'package:flutter/material.dart';

void main() {
  // 앱을 구동시켜달라는 뜻
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('앱임'),
        ),
        body: Align(
          alignment: Alignment.centerLeft,
          child: Container(
            width: 50,
            height: double.infinity,
            color: Colors.blue,
          ),
        ),
      ),
    );
  }
}
  1. 가로, 세로를 꽉차게 하고싶을때
    double.infinity 를 사용하면 된다.
profile
성장중인 백엔드 개발자!!

0개의 댓글