Created
January 15, 2020 23:32
-
-
Save dsibinski/6a140d19910f60d03e8752b1a3b7f083 to your computer and use it in GitHub Desktop.
This file contains 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'; | |
void main() => runApp( | |
MaterialApp( | |
title: "My CodeJourney Flutter app", | |
home: MySecondWidget(), | |
), | |
); | |
class MySecondWidget extends StatefulWidget { | |
MySecondWidget({Key key}) : super(key: key); | |
@override | |
_MySecondWidgetState createState() => _MySecondWidgetState(); | |
} | |
class _MySecondWidgetState extends State<MySecondWidget> { | |
int _clickCount = 0; | |
void incrementClickCount() { | |
setState(() { | |
this._clickCount++; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("My First App"), | |
), | |
body: Container( | |
padding: EdgeInsets.all(8.0), | |
child: Text( | |
"Hello! Times clicked: " + this._clickCount.toString(), | |
style: TextStyle(color: Colors.green, fontSize: 20.0), | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
child: Icon(Icons.add), | |
onPressed: this.incrementClickCount, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment