Created with <3 with dartpad.dev.
Created
April 12, 2023 06:53
-
-
Save hongsw/3559c26e92c231c76caa122b15cccc06 to your computer and use it in GitHub Desktop.
volcanic-hyacinth-3074
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:http/http.dart' as http; | |
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
void main() async { | |
var jsonDomain = "gist.githubusercontent.com"; | |
var jsonUrl = | |
"hongsw/bda2f942a8a8c32f5cd0a49b5650b062/raw/01c789addcab42ed3ff6e8587b21f31c92abd55c/webtoon.json"; | |
var response = await http.get(Uri.https(jsonDomain, jsonUrl)); | |
var toons = json.decode(utf8.decode(response.bodyBytes)); | |
runApp( | |
MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: const Text("내폰내툰")), | |
body: Center( | |
child: Container( | |
margin: const EdgeInsets.all(10.0), | |
color: Colors.amber[600], | |
child: Column(children: [ | |
const Placeholder(fallbackHeight: 40), | |
Row( | |
children: toons | |
.map<Widget>( | |
(item) => Column(children: [ | |
Image.network(item['image']!), | |
Text(item['title']!) | |
]), | |
) | |
.toList()), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: const <Widget>[ | |
Icon( | |
Icons.favorite, | |
color: Colors.pink, | |
size: 24.0, | |
semanticLabel: | |
'Text to announce in accessibility modes', | |
), | |
Icon( | |
Icons.audiotrack, | |
color: Colors.green, | |
size: 30.0, | |
), | |
Icon( | |
Icons.beach_access, | |
color: Colors.blue, | |
size: 36.0, | |
), | |
], | |
), | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
TextFormField( | |
decoration: const InputDecoration( | |
hintText: 'Enter your email', | |
), | |
validator: (String? value) { | |
if (value == null || value.isEmpty) { | |
return 'Please enter some text'; | |
} | |
return null; | |
}, | |
), | |
Padding( | |
padding: const EdgeInsets.symmetric(vertical: 16.0), | |
child: ElevatedButton( | |
onPressed: () { | |
// Validate will return true if the form is valid, or false if | |
// the form is invalid. | |
}, | |
child: const Text('Submit'), | |
), | |
), | |
], | |
), | |
]))))), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment