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 BigButton extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return new RaisedButton( | |
| child: Text("Click me"), | |
| ); | |
| } | |
| } |
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'; | |
| import 'package:flutter/widgets.dart'; | |
| class CounterWidget extends StatefulWidget { | |
| @override | |
| _CounterWidgetState createState() => _CounterWidgetState(); | |
| } | |
| class _CounterWidgetState extends State<CounterWidget> { | |
| int _counter; |
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'; | |
| import 'package:flutter/widgets.dart'; | |
| class CounterWidget extends StatelessWidget { | |
| int _counter = 0; //The class is immutable so this instance field should be final. | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( |
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
| dependencies: | |
| flutter: | |
| sdk: flutter | |
| http: 0.12.1 |
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
| { | |
| "postId": 1, | |
| "id": 2, | |
| "name": "quo vero reiciendis velit similique earum", | |
| "email": "Jayne_Kuhic@sydney.com", | |
| "body": "est natus enim nihil est dolore omnis voluptatem numquam\net omnis occaecati quod ullam at\nvoluptatem error expedita pariatur\nnihil sint nostrum voluptatem reiciendis et" | |
| }, |
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
| class MessageModel { | |
| String _body; | |
| String _name; | |
| String _email; | |
| MessageModel.fromJson(Map<String, dynamic> json) { | |
| _name = json['name']; | |
| _email = json['email']; | |
| _body = json['body']; | |
| } |
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
| class MessageProvider { | |
| final String _url = "https://jsonplaceholder.typicode.com/comments"; | |
| Client client = Client(); | |
| Future<List<MessageModel>> fetchPosts() async { | |
| final response = await client.get(_url); | |
| if (response.statusCode == 200) { | |
| final parsed = json.decode(response.body); | |
| return parsed.map<MessageModel>((json) => MessageModel.fromJson(json)).toList(); |
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
| MessageModel.fromJson(Map<String, dynamic> json) { | |
| _name = json['name']; | |
| _email = json['email']; | |
| _body = json['body']; | |
| } |
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
| class MessagePage extends StatefulWidget { | |
| @override | |
| _MessagePageState createState() => _MessagePageState(); | |
| } | |
| class _MessagePageState extends State<MessagePage> { | |
| bool isLoading = false; | |
| List<MessageModel> messageList; | |
| MessageProvider messageProvider = new MessageProvider(); |
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
| const TextStyle({ | |
| this.inherit = true, | |
| this.color, | |
| this.backgroundColor, | |
| this.fontSize, | |
| this.fontWeight, | |
| this.fontStyle, | |
| this.letterSpacing, | |
| this.wordSpacing, | |
| this.textBaseline, |
OlderNewer