Created with <3 with dartpad.dev.
Created
November 2, 2022 02:11
-
-
Save hongsw/8d0715e2840e8881ebce7ee3790badf6 to your computer and use it in GitHub Desktop.
3.4 새로운 위젯을 만들자
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Webtoon extends StatelessWidget { | |
Webtoon({key, required this.image, required this.title}) : super(key: key); | |
String image; | |
String title; | |
@override | |
Widget build(BuildContext context) { | |
return Column(children: [ | |
Image.network(image), | |
Text(title) | |
]); | |
} | |
} | |
void main() { | |
final toons = [ | |
{ | |
"title": "이상한 변호사 우영우", | |
"image": "https://my-k-toon.web.app/webtoon/1.png" | |
}, | |
{ | |
"title": "외모지상주의", | |
"image": "https://my-k-toon.web.app/webtoon/2.png" | |
} | |
]; | |
runApp(MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: const Text("내폰내툰")), | |
body: Row( | |
children: toons.map((item) => | |
Webtoon(image : item['image']!, title: item['title']!) | |
).toList() | |
)))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment