Skip to content

Commit c32f8fd

Browse files
committed
Base routing completed
1 parent 20c3677 commit c32f8fd

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

lib/main.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import 'package:flutter/material.dart';
2+
import 'package:ninja_app/screens/choose_location.dart';
23
import 'package:ninja_app/screens/home.dart';
4+
import 'package:ninja_app/screens/loading.dart';
35

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

lib/screens/choose_location.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ class _ChooseLocationState extends State<ChooseLocation> {
99
@override
1010
Widget build(BuildContext context) {
1111
return Scaffold(
12-
appBar: AppBar(),
12+
backgroundColor: Colors.grey[200],
13+
appBar: AppBar(
14+
backgroundColor: Colors.blue[900],
15+
centerTitle: true,
16+
title: Text('Choose a location'),
17+
elevation: 0,
18+
),
1319
body: Text('Choose Location Screen'),
1420
);
1521
}

lib/screens/home.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ class _HomeState extends State<Home> {
99
@override
1010
Widget build(BuildContext context) {
1111
return Scaffold(
12-
body: SafeArea(child: Text('Home Screen')),
12+
body: SafeArea(
13+
child: Column(
14+
children: [
15+
FlatButton.icon(
16+
onPressed: () {
17+
Navigator.pushNamed(context, '/location');
18+
},
19+
icon: Icon(Icons.edit_location),
20+
label: Text('Edit Location'))
21+
],
22+
)),
1323
);
1424
}
1525
}

0 commit comments

Comments
 (0)