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

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

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


body 부분에 listview.builder를 추가하려고 하는데 혹시 child를 하나 더 만들어야 하는 접근 방식이 맞을까요?

이미 body에 textfield를 child로 사용해서 또 다른 child 생성은 불가능할까요?


구글링해서 child 추가하는 검색 결과 new container가 나와서 시도해 봤는데요. 적히는건 가능하던데 빨간줄로 에러가 나요!


+ 그리고 맨 아래 이미 실습준비로 제공된 사진들 코드는 widget으로 적혀있는데, 이건 왜 시물레이션에 안나오는걸까요?



스파르타 즉문즉답






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(

centerTitle: false,

titleTextStyle: TextStyle(

fontSize: 28, color: Colors.black, fontWeight: FontWeight.bold),

title: Text("Movie Reviews"),

actions: <Widget>[

Padding(

padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 0),

child: IconButton(

icon: const Icon(

Icons.person,

color: Colors.black,

size: 40,

),

tooltip: 'Show Snackbar',

onPressed: () {

ScaffoldMessenger.of(context).showSnackBar(

const SnackBar(content: Text('This is a snackbar')));

},

),

),

],

backgroundColor: Colors.white70,

),

body: Padding(

padding: const EdgeInsets.all(16),

child: const TextField(

obscureText: true,

decoration: InputDecoration(

suffixIcon: Icon(

Icons.search,

),

border: OutlineInputBorder(),

labelText: '영화 제목을 입력해 주세요.',

),

),

new Container()

),

// 홈페이지 보여주기

),

);

}

}


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();

}

}




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