
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
1주차 MovieReviews를 만들고 있는데 아래의 List타입의 dataList를 어떻게 가져와야하는지 잘 모르겠습니다.
현재 appBar와 TextField를 구현하고 그 아래에 Listview.builder를 통해서 만드려고 하는데 진행이 잘 안됩니다.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
flutter listview builder 키워드로 구글링 2페이지까지 검색하였는데 사용하는 방법에서 이해를 잘 못하겠습니다.
flutter 기초 문법 다시 보기
로그인 페이지 만들기 강의 다시보기
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text(
"Movie Reviews",
style: TextStyle(fontSize: 28),
),
actions: [
IconButton(
onPressed: () {}, icon: Icon(Icons.account_circle_outlined))
],
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
TextField(
decoration: InputDecoration(
hintText: "영화 제목을 검색해주세요.",
suffixIcon: Icon(Icons.search),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color.fromARGB(95, 34, 32, 32),
width: 1.0,
),
),
),
), //이미지 추가
],
),
),
), // 홈페이지 보여주기
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: 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();
}
}
