Skip to content

Instantly share code, notes, and snippets.

@hongsw
Created November 2, 2022 02:11
Show Gist options
  • Save hongsw/8d0715e2840e8881ebce7ee3790badf6 to your computer and use it in GitHub Desktop.
Save hongsw/8d0715e2840e8881ebce7ee3790badf6 to your computer and use it in GitHub Desktop.
3.4 새로운 위젯을 만들자

3.4 새로운 위젯을 만들자

Created with <3 with dartpad.dev.

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