Skip to content

Instantly share code, notes, and snippets.

@jinyongp
Created June 28, 2023 10:08
Show Gist options
  • Save jinyongp/a92d7ac36eae072383b19b8438df0a15 to your computer and use it in GitHub Desktop.
Save jinyongp/a92d7ac36eae072383b19b8438df0a15 to your computer and use it in GitHub Desktop.
Flutter Movies
// ignore_for_file: prefer_const_constructors
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>> movies = [
{
"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(
title: Text("Movie Reviews",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w600,
color: Colors.black)),
backgroundColor: Colors.white,
elevation: 0,
centerTitle: false,
iconTheme: IconThemeData(color: Colors.black),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.person_outline),
),
],
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: "영화 제목을 입력해주세요.",
suffixIcon: Icon(Icons.search),
),
),
),
Divider(height: 1),
Expanded(
child: ListView.builder(
itemCount: movies.length,
itemBuilder: (ctx, index) {
return Card(
child: Stack(alignment: Alignment.center, children: [
Image.network(
movies[index]["imgUrl"],
fit: BoxFit.cover,
height: 200,
width: double.infinity,
color: Colors.black.withOpacity(0.4),
colorBlendMode: BlendMode.darken,
),
Text(movies[index]["category"],
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w600,
color: Colors.white)),
]));
}),
)
],
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment