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
[C:\git\dart] dart joke.dart | |
Why did the burglar hang his mugshot on the wall? To prove that he was framed! | |
[C:\git\dart] |
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 JokePageState extends State<JokePage> { | |
Future<String> response; | |
initState() { | |
super.initState(); | |
response = http.read(dadJokeApi, headers: httpHeaders); | |
} | |
Widget build(BuildContext context) { | |
return new 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: | |
share: "^0.3.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
flutter: | |
uses-material-design: true | |
fonts: | |
- family: Patrick Hand | |
fonts: | |
- asset: assets/fonts/PatrickHand-Regular.ttf |
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
// declaring a text style based on custom font | |
const jokeTextStyle = const TextStyle( | |
fontFamily: 'Patrick Hand', | |
fontSize: 34.0, | |
color: Colors.black87, | |
letterSpacing: -0.5, | |
fontStyle: FontStyle.normal, | |
fontWeight: FontWeight.normal); | |
// now all we have to do is add a style to the Text widget |
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
_refreshAction() { | |
setState(() { | |
_response = http.read(dadJokeApi, headers: httpHeaders); | |
}); | |
} | |
... | |
if (decoded['status'] == 200) { | |
_displayedJoke = decoded['joke']; |
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
Widget build(BuildContext context) => Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
actions: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.info), | |
onPressed: _aboutAction, | |
), | |
IconButton( | |
icon: Icon(Icons.share), |
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 comments = <Comment>[ | |
Comment( | |
"Creating apps is just faster and more fun with Flutter.", | |
"Posse Inc."), | |
Comment( | |
"Yesterday I was trying #Flutter for the first time, today I published an application.", | |
"@CristianDudca"), | |
Comment( | |
"This weekend: Met and fell in love with Flutter.", | |
"@FIREYOSE"), |