Skip to content

Instantly share code, notes, and snippets.

@hongsw
Last active November 17, 2022 08:02
Show Gist options
  • Save hongsw/471315618d560aa7299557a4100a37a8 to your computer and use it in GitHub Desktop.
Save hongsw/471315618d560aa7299557a4100a37a8 to your computer and use it in GitHub Desktop.
3.4 상세화면
import 'package:flutter/material.dart';
class Webtoon extends StatelessWidget {
String image, title;
Webtoon({required this.image, required this.title});
@override
Widget build(BuildContext context) {
return Column(
children: [
Image.network(image),
Text(title)]);
}
}
class Subpage extends StatelessWidget {
String image, title;
Subpage({required this.image, required this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Webtoon(image: image, title: title));
}
}
final toons = [
{"title": "이상한 변호사 우영우", "image": "https://my-k-toon.web.app/webtoon/1.png"},
{"title": "외모지상주의", "image": "https://my-k-toon.web.app/webtoon/2.png"}
];
class Homepage extends StatelessWidget {
const Homepage({key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("내폰내툰")),
body: Row(
children: toons
.map((item) => GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Subpage(
image: item['image']!,
title: item['title']!)));
},
child:
Webtoon(image: item['image']!, title: item['title']!)))
.toList()));
}
}
void main() {
runApp(const MaterialApp(home: Homepage()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment