Commit a4b1cd8a authored by Shivanthi Fernando's avatar Shivanthi Fernando

Create navbar and navbar screens

parent 80e300b3
import 'package:flutter/material.dart';
import 'login_screen.dart';
import 'pages/login_screen.dart';
void main() {
runApp(MyApp());
......
import 'package:flutter/material.dart';
import 'navbar.dart';
import 'signup_screen.dart';
class LoginScreen extends StatefulWidget {
......@@ -107,7 +107,8 @@ Widget initWidget(BuildContext context) {
GestureDetector(
onTap: () => {
//Link to nav bar
Navigator.push(context,
MaterialPageRoute(builder: (context) => NavBarScreen()))
},
child: Container(
margin: EdgeInsets.only(left: 20, right: 20, top: 70),
......
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'navbar_screens/account.dart';
import 'navbar_screens/history.dart';
import 'navbar_screens/home.dart';
import 'navbar_screens/notifications.dart';
import 'navbar_screens/vehicle_details.dart';
class NavBarScreen extends StatefulWidget {
@override
_NavBarScreenState createState() => _NavBarScreenState();
}
class _NavBarScreenState extends State<NavBarScreen> {
int selected_index = 2;
final HistoryScreen _history = new HistoryScreen();
final VehicleDetailsScreen _vehicleDetails = new VehicleDetailsScreen();
final HomeScreen _home = HomeScreen();
final NotificationsScreen _notifications = new NotificationsScreen();
final AccountScreen _account = new AccountScreen();
Widget _showPage = new HomeScreen();
Widget _pageChooser(int page) {
switch (page) {
case 0:
return _history;
case 1:
return _vehicleDetails;
case 2:
return _home;
case 3:
return _notifications;
case 4:
return _account;
default:
return new Container(
child: new Center(
child: new Text("No page found"),
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: CurvedNavigationBar(
index: selected_index,
color: Color(0xff01122b),
buttonBackgroundColor: Color(0xff01122b),
backgroundColor: Colors.white,
animationDuration: Duration(milliseconds: 400),
animationCurve: Curves.easeInBack,
height: 55.0,
items: <Widget>[
Icon(Icons.history, size: 30, color: Colors.white),
Icon(Icons.car_rental_rounded, size: 30, color: Colors.white),
Icon(Icons.home, size: 30, color: Colors.white),
Icon(Icons.notification_add, size: 30, color: Colors.white),
Icon(Icons.person, size: 30, color: Colors.white),
],
onTap: (int tapped_index) {
setState(() {
_showPage = _pageChooser(tapped_index);
});
},
),
body: Container(
child: Center(
child: _showPage,
),
),
);
}
}
import 'package:flutter/material.dart';
class AccountScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => InitState();
}
class InitState extends State<AccountScreen> {
@override
Widget build(BuildContext context) {
return initWidget();
}
Widget initWidget() {
return Container(
child: Text(
'Account',
textScaleFactor: 2.0,
),
);
}
}
import 'package:flutter/material.dart';
class HistoryScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => InitState();
}
class InitState extends State<HistoryScreen> {
@override
Widget build(BuildContext context) {
return initWidget();
}
Widget initWidget() {
return Container(
child: Text(
'History',
textScaleFactor: 2.0,
),
);
}
}
import 'package:flutter/material.dart';
class HomeScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => InitState();
}
class InitState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return initWidget();
}
Widget initWidget() {
return Container(
child: Text(
'New Booking',
textScaleFactor: 2.0,
),
);
}
}
import 'package:flutter/material.dart';
class NotificationsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => InitState();
}
class InitState extends State<NotificationsScreen> {
@override
Widget build(BuildContext context) {
return initWidget();
}
Widget initWidget() {
return Container(
child: Text(
'Notifications',
textScaleFactor: 2.0,
),
);
}
}
import 'package:flutter/material.dart';
class VehicleDetailsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() => InitState();
}
class InitState extends State<VehicleDetailsScreen> {
@override
Widget build(BuildContext context) {
return initWidget();
}
Widget initWidget() {
return Container(
child: Text(
'Vehicle Details',
textScaleFactor: 2.0,
),
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment