Flutter 박스 레이아웃 기초 예시

바다구름·2023년 2월 28일
0

Flutter

목록 보기
5/19
  • 예시 코드
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(),
        body: Container(
          height: 150,
          padding: EdgeInsets.all(20),
          color: Colors.green,
          child: Row(
            children: [
              Image.asset('dog.png', width: 150,),
              Expanded(child: Container(
                color: Colors.grey,
                width: 300,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('카메라 팝니다', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 30),),
                    Text('금호동 3가'),
                    Text('7000원'),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        Icon(Icons.favorite),
                        Text('4')
                      ],
                    )
                  ],
                ),
              ))
            ],
          ),
        )
      ),
    );
  }
}


profile
안녕하세요.

0개의 댓글