Skip to content

Commit 7eaea20

Browse files
committed
lesson-23
1 parent 41b0d4f commit 7eaea20

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

world_time_app/lib/main.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import 'package:flutter/material.dart';
22
import 'package:world_time_app/pages/home.dart';
3+
import 'package:world_time_app/pages/loading.dart';
4+
import 'package:world_time_app/pages/choose_location.dart';
35

46
void main() => runApp(MaterialApp(
5-
home: Home(),
7+
initialRoute: '/home',
8+
routes: {
9+
'/': (context) => Loading(),
10+
'/home': (context) => Home(),
11+
'/location': (context) => ChooseLocation(),
12+
}
613
));
714

world_time_app/lib/pages/choose_location.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ class ChooseLocation extends StatefulWidget {
88
class _ChooseLocationState extends State<ChooseLocation> {
99
@override
1010
Widget build(BuildContext context) {
11-
return Container();
11+
return Scaffold(
12+
backgroundColor: Colors.grey[200],
13+
appBar: AppBar(
14+
backgroundColor: Colors.blue[900],
15+
title: Text('Choose a Location'),
16+
centerTitle: true,
17+
elevation: 0,
18+
),
19+
);
1220
}
1321
}

world_time_app/lib/pages/home.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ class _HomeState extends State<Home> {
1010
Widget build(BuildContext context) {
1111
return Scaffold(
1212
body: SafeArea(
13-
child: Text('home screen'),
13+
child: Column(
14+
children: <Widget>[
15+
FlatButton.icon(
16+
onPressed: () {
17+
Navigator.pushNamed(context, '/location');
18+
},
19+
icon: Icon(Icons.edit_location),
20+
label: Text(
21+
'Edit Location'
22+
)
23+
)
24+
],
25+
),
1426
),
1527
);
1628
}

0 commit comments

Comments
 (0)