Image

tpids·2024년 9월 6일

Flutter

목록 보기
5/40
post-thumbnail

pubspec.yaml
// 이미지 파일 경로 추가

...

flutter:
  uses-material-design: true

  assets:
    - image/
    
...

image.dart

import 'package:flutter/material.dart';

class ExImage extends StatelessWidget {
  const ExImage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('첫번째 예제'),
        backgroundColor: Colors.lightGreen,
      ),
      body: SafeArea(
          child: Column(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Image.asset('image/mokoko.jpg', width: 120, height: 120,),
                ],
              ),
              Text('귀여운 모코코 이미지 띄우기!'),

              Row(
                children: [
                  Image.asset('image/mokoko.jpg', width: 120, height: 120,),
                  Image.asset('image/mokoko.jpg', width: 120, height: 120,),
                  Image.asset('image/mokoko.jpg', width: 120, height: 120,),
                ],
              ),
              Text('귀여운 모코코 이미지 띄우기!'),
            ],
          ),
      ),
    );
  }
}

profile
개발자

0개의 댓글