커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
과제 코드 달라도 되나요?
[왕초보] 플러터(Flutter)로 시작하는 앱개발 종합반 v0
1주차
북마크
최*철
댓글
3
추천
0
조회수
14
조회수
14
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



flutter 1주차 과제를 완성했는데요. 선생님 코드와 좀 다르네요. 그래도 똑같이 만들면 되는건가요?


보고 계신

스파르타 즉문즉답

화면 전체를 캡처해 주시면, 튜터님들이 빠르게 상황을 이해할 수 있어요.




작성한 코드 및 에러 메세지

import 'package:flutter/material.dart';


void main() {

  runApp(const MyApp());

}


class MyApp extends StatelessWidget {

  const MyApp({super.key});


  // This widget is the root of your application.

  @override

  Widget build(BuildContext context) {

    return MaterialApp(

      home: HomePage(),

    );

  }

}


class HomePage extends StatelessWidget {

  const HomePage({super.key});


  @override

  Widget build(BuildContext context) {

    List<Map<String, dynamic>> dataList = [

      {

        "category": "탑건: 매버릭",

        "imgUrl": "https://i.ibb.co/sR32PN3/topgun.jpg",

      },

      {

        "category": "마녀2",

        "imgUrl": "https://i.ibb.co/CKMrv91/The-Witch.jpg",

      },

      {

        "category": "범죄도시2",

        "imgUrl": "https://i.ibb.co/2czdVdm/The-Outlaws.jpg",

      },

      {

        "category": "헤어질 결심",

        "imgUrl": "https://i.ibb.co/gM394CV/Decision-to-Leave.jpg",

      },

      {

        "category": "브로커",

        "imgUrl": "https://i.ibb.co/MSy1XNB/broker.jpg",

      },

      {

        "category": "문폴",

        "imgUrl": "https://i.ibb.co/4JYHHtc/Moonfall.jpg",

      },

    ];

    return Scaffold(

      appBar: AppBar(

        elevation: 0,

        backgroundColor: Colors.white,

        title: Text(

          'Movie Reviews',

          style: TextStyle(color: Colors.black, fontSize: 30),

        ),

        actions: [

          IconButton(

              onPressed: () {},

              icon: Icon(

                Icons.person_outline,

                color: Colors.black,

              ))

        ],

      ),

      body: Column(

        children: [

          Padding(

            padding: const EdgeInsets.all(8.0),

            child: TextField(

              decoration: InputDecoration(

                  suffixIcon: Icon(Icons.search),

                  enabledBorder: OutlineInputBorder(),

                  hintText: '영화 제목을 검색해주세요.'),

            ),

          ),

          Divider(

            height: 1,

          ),

          Expanded(

            child: Card(

              child: ListView.builder(

                itemCount: dataList.length,

                itemBuilder: (BuildContext ctx, int idx) {

                  // return을 안써줘서 계속 화면에 안나왔던 거였다...!!!

                  return Column(

                    children: [

                      Stack(

                        alignment: Alignment.center,

                        children: [

                          Image.network(

                            dataList[idx]['imgUrl'],

                            color: Colors.grey,

                            colorBlendMode: BlendMode.modulate,

                            // 사진 크기조절로 애좀 먹음

                            // height, width, fit을 이용해서 사진 크기 조절함!!

                            height: 200,

                            width: double.infinity,

                            fit: BoxFit.cover,

                          ),

                          Text(

                            dataList[idx]['category'],

                            style: TextStyle(

                              color: Colors.white,

                              fontSize: 35,

                            ),

                          ),

                        ],

                      ),

                      SizedBox(height: 10),

                    ],

                  );

                },

              ),

            ),

          ),

        ],

      ),

    );

  }

}


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴