Skip to content

Commit 9aa1815

Browse files
committed
lesson-25
1 parent 519896f commit 9aa1815

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

world_time_app/lib/pages/choose_location.dart

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ class ChooseLocation extends StatefulWidget {
77

88
class _ChooseLocationState extends State<ChooseLocation> {
99

10-
int counter = 0;
10+
void getData() async {
11+
12+
// simulate network request for a username
13+
String username = await Future.delayed(Duration(seconds: 3), () {
14+
return 'yoshi';
15+
});
16+
17+
// simulate a network request to get the bio of that username
18+
String bio = await Future.delayed(Duration(seconds: 2), () {
19+
return 'vegan, musician & egg collector';
20+
});
21+
22+
print('$username - $bio');
23+
24+
}
1125

1226
@override
1327
void initState() {
1428
super.initState();
15-
print('initState function ran');
29+
getData();
30+
print('hey there!');
1631
}
1732

1833
@override
1934
Widget build(BuildContext context) {
20-
print('build function ran');
2135
return Scaffold(
2236
backgroundColor: Colors.grey[200],
2337
appBar: AppBar(
@@ -26,14 +40,6 @@ class _ChooseLocationState extends State<ChooseLocation> {
2640
centerTitle: true,
2741
elevation: 0,
2842
),
29-
body: RaisedButton(
30-
onPressed: (){
31-
setState(() {
32-
counter += 1;
33-
});
34-
},
35-
child: Text('$counter'),
36-
)
3743
);
3844
}
3945
}

0 commit comments

Comments
 (0)