Created
February 19, 2020 18:11
-
-
Save MarkTechson/da36a3ad9519e6b06f6e10f13951ef09 to your computer and use it in GitHub Desktop.
Flutter Study Jam Part 2 - Demo 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
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: Clock(), | |
), | |
), | |
); | |
} | |
} | |
class Clock extends StatefulWidget { | |
const Clock({Key key}) : super(key: key); | |
@override | |
_ClockState createState() => _ClockState(); | |
} | |
class _ClockState extends State<Clock> { | |
int _timeInSeconds = 0; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
width: 500.0, | |
color: Colors.black, | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'$_timeInSeconds', | |
style: TextStyle( | |
fontSize: 40.0, | |
), | |
), | |
FlatButton( | |
child: Text('Increment'), | |
onPressed: () => _timeInSeconds++, | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment