
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
에러가 뜹니다.
가상 휴대폰 창을 만질 때마다 계속 에러가 추가되어서.. 뭔가 루프에 걸렸던가 아니면 붉은색으로 표시되는 부분만 읽어보면, 어떠한 사이즈를 규정을 해주지 않아서 문제 발생하는 듯한데.. 이유를 모르겠습니다.
검색창까지는 문제 없이 실행되는데,
아래 코드 작성 후에는 에러가 계속 뜨네요..
Divider(height: 1,),
Expanded(
child : ListView.builder(
scrollDirection: Axis.vertical,
itemCount: dataList.length,
itemBuilder: (context,index) {
String category = dataList[index]['category'];
String imgUrl = dataList[index]['imgUrl'];
return Card(
child: Stack(
children: [
Text(category),
Image.network(imgUrl, width: double.infinity, height: 200, fit:BoxFit.cover),
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({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 MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0.0,
title:
Text('Movie Reviews',
style: TextStyle(
color : Colors.black,
fontSize: 25,
fontWeight: FontWeight.bold)),
leadingWidth: 300,
actions: [Icon(Icons.person_outline, color: Colors.black
),
],
),
body: Column(
children: <Widget>[
Container(
width: double.infinity,
height: 60,
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
borderRadius : BorderRadius.circular(7),
border: Border.all(
color: Colors.black12, width: 1,
),
),
child: TextField(
decoration: InputDecoration(
labelText: '영화 제목을 검색해주세요.',
labelStyle: TextStyle(color: Colors.black54),
border: InputBorder.none,
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: (){}),
suffixIconColor: Colors.black54,
),
),
),
Divider(height: 1,),
Expanded(
child : ListView.builder(
scrollDirection: Axis.vertical,
itemCount: dataList.length,
itemBuilder: (context,index) {
String category = dataList[index]['category'];
String imgUrl = dataList[index]['imgUrl'];
return Card(
child: Stack(
children: [
Text(category),
Image.network(imgUrl, width: double.infinity, height: 200, fit:BoxFit.cover),
],
),
);
}
),
),
].map((widget) => Padding(
padding: const EdgeInsets.all(5), child: widget,
)).toList(),
),
),
);
}
}
