flutter : 구글이 만든 프레임 워크로, 크로스 플랫폼이 장점.
listview 클래스 쓸때는 expanded를 반드시 선언해주어야함.
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: HomePage(), // 홈페이지 보여주기
);
}
}
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(
appBar: AppBar(
elevation: 0, // app bar 그림자 없애는 옵션
backgroundColor: Colors.white,
title: Text(
"Movie Reviews",
style: TextStyle(fontSize: 30, color: Colors.black),
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.person_outline, color: Colors.black),
onPressed: () => {},
)
],
),
body: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: "영화 제목을 검색해주세요.",
suffixIcon: Icon(Icons.search, color: Colors.black)),
),
Divider(
thickness: 1,
color: Colors.black,
),
Expanded(
child: ListView(children: <Widget>[
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network('https://i.ibb.co/sR32PN3/topgun.jpg',
height: 200, width: 400, fit: BoxFit.fitWidth),
)),
Text(
'탑건: 매버릭 ',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network(
'https://i.ibb.co/CKMrv91/The-Witch.jpg',
height: 200,
width: 400,
fit: BoxFit.fitWidth),
)),
Text(
'마녀2 ',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network(
'https://i.ibb.co/2czdVdm/The-Outlaws.jpg',
height: 200,
width: 400,
fit: BoxFit.fitWidth),
)),
Text(
'범죄도시2 ',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network(
'https://i.ibb.co/gM394CV/Decision-to-Leave.jpg',
height: 200,
width: 400,
fit: BoxFit.fitWidth),
)),
Text(
'헤어질 결심',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network('https://i.ibb.co/MSy1XNB/broker.jpg',
height: 200, width: 400, fit: BoxFit.fitWidth),
)),
Text(
'브로커 ',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
Stack(alignment: Alignment.center, children: [
Card(
child: Container(
color: Colors.white,
child: Image.network(
'https://i.ibb.co/4JYHHtc/Moonfall.jpg',
height: 200,
width: 400,
fit: BoxFit.fitWidth),
)),
Text(
'문폴',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
),
]),
]),
)
/*ListView.builder(
itemCount: 6,
itemBuilder: (BuildContext context, int index) {
return dataList();
}),*/
],
),
),
);
}
}