Last active
June 8, 2021 14:39
-
-
Save tolo/5f694d1622e9ed8c8981a94aad1efa0c to your computer and use it in GitHub Desktop.
Flutter Labinar - Lab 1 - Counter (incomplete)
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(CounterApp()); | |
} | |
class CounterApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'CounterApp', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
canvasColor: Colors.teal, | |
), | |
home: CounterPage(title: 'CounterApp'), | |
); | |
} | |
} | |
class CounterPage extends StatefulWidget { | |
CounterPage({Key? key, required this.title}) : super(key: key); | |
final String title; | |
@override | |
_CounterPageState createState() => _CounterPageState(); | |
} | |
class _CounterPageState extends State<CounterPage> { | |
int _counter = 0; | |
void _incrementCounter() { | |
// TODO: Implement counter | |
_counter++; | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Container( | |
decoration: BoxDecoration( | |
// color: Colors.cyan, // Perhaps add a background color | |
//gradient: LinearGradient( // Or a gradient | |
// begin: Alignment.topRight, | |
// end: Alignment.bottomLeft, | |
// colors: [Colors.lightBlueAccent, Colors.pinkAccent], | |
//), | |
//border: Border.all( // Maybe a border | |
// color: Colors.black38, | |
// width: 4, | |
//), | |
borderRadius: BorderRadius.circular(20), | |
), | |
margin: EdgeInsets.symmetric(vertical: 24, horizontal: 8), | |
alignment: Alignment.center, | |
child: | |
Column(mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Icon(Icons.warning, size: 96, color: Colors.orange), | |
Text('Work in progress...', style: TextStyle(color: Colors.white)), | |
]), | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: _incrementCounter, | |
tooltip: 'Increment', | |
child: Icon(Icons.add), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment