Skip to content

Commit 33ebb23

Browse files
committed
Learnt on TODO and also the build and initState functions
1 parent c32f8fd commit 33ebb23

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/screens/choose_location.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ class ChooseLocation extends StatefulWidget {
66
}
77

88
class _ChooseLocationState extends State<ChooseLocation> {
9+
@override
10+
int counter = 0;
11+
12+
void initState() {
13+
// TODO: implement initState
14+
super.initState();
15+
print('initState function has been run');
16+
}
17+
918
@override
1019
Widget build(BuildContext context) {
20+
print('build function has been run');
1121
return Scaffold(
1222
backgroundColor: Colors.grey[200],
1323
appBar: AppBar(
@@ -16,7 +26,14 @@ class _ChooseLocationState extends State<ChooseLocation> {
1626
title: Text('Choose a location'),
1727
elevation: 0,
1828
),
19-
body: Text('Choose Location Screen'),
29+
body: RaisedButton(
30+
onPressed: () {
31+
setState(() {
32+
counter++;
33+
});
34+
},
35+
child: Text('Counter is: $counter'),
36+
),
2037
);
2138
}
2239
}

0 commit comments

Comments
 (0)