0% found this document useful (0 votes)
8 views3 pages

Lab 8

App development
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Lab 8

App development
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

8. Creating Navigation and Routing a Pizza Store App.

main.dart

import 'package:flutter/material.dart';
import 'package:lab8/Dashboard.dart';

void main() async{


runApp(MyApp());
}

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'pizza dashboard',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
debugShowCheckedModeBanner: false,
home: Dashboard(),
);
// });
}
}

TopNavigationBar.dart
import 'package:flutter/material.dart';

class TopNavigationBar extends StatelessWidget{

@override
Widget build(BuildContext context){
return DefaultTabController(length: 3,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.redAccent,
title: Row(children: [
Text('WOW Pizza',
style:TextStyle(fontSize: 20.0),),
SizedBox(width:160.0,),
Container(child:GestureDetector(
child:Image.asset(
'Images/twitter.png',
fit:BoxFit.contain,
height: 30,),
),),
SizedBox(width:10.0,),
Container(child:GestureDetector(
child:Image.asset(
'Images/facebook.png',
fit:BoxFit.contain,
height: 40,),
),),
],
),
bottom: TabBar(indicatorColor: Colors.red,
tabs:[
Tab(icon: Container(height:40,
child: Image.asset('lib/icons/pizza.png')),
text:'Vegitable Pizza'
),
Tab(icon: Container(height: 40,
child: Image.asset('lib/icons/pizza.png')),
text:'Cheese Pizza'
),
Tab(icon: Container(height: 40,
child: Image.asset('lib/icons/french-fries.png')),
text:'Fries'
),
]
)
),
body:TabBarView(
children: [
MaterialApp(home:Center(child:Column(children:[
Image.asset('Images/Vpizza.png',
width:400.0,
height:300.0,),
Text("Hi, I'm Pizza Assistant, what can I help you order?",
style: TextStyle(decoration:TextDecoration.none,fontSize:30.0),
textAlign: TextAlign.center,
),
]
)
),
),
MaterialApp(home:Center(child:Column(children:[
Image.asset('Images/cheesepizza.png',
width:400.0,
height:300.0,),
Text("Hi, I'm Pizza Assistant, what can I help you order?",
style: TextStyle(decoration:TextDecoration.none,fontSize:30.0),
textAlign: TextAlign.center,
),
]
)
),
),
MaterialApp(home:Center(child:Column(children:[
Image.asset('Images/Fpizza.png',
width:400.0,
height:300.0,),
Text("Hi, I'm Pizza Assistant, what can I help you order?",
style: TextStyle(decoration:TextDecoration.none,fontSize:30.0),
textAlign: TextAlign.center,
),
]
)
),
),
],
),
));
}
}
Dashboard.dart
import 'package:flutter/material.dart';
import 'package:lab8/TopNavigationBar.dart';

class Dashboard extends StatelessWidget {


const Dashboard({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
// Material App
return MaterialApp(
home:Scaffold(
appBar: AppBar(
title: Text("Welcome to WOW PIZZA!"),
centerTitle: true,
backgroundColor: Colors.deepOrange,
),
body: Column(children:[
Image.asset('Images/meal.jpg',
width:400.0,
height:300.0,),
Text("Wanna Order Something... ",
style: TextStyle(decoration:TextDecoration.none,fontSize:30.0),
textAlign: TextAlign.center,
),
ElevatedButton(
onPressed: () async => {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => TopNavigationBar(),
),
(route) => false)
},
child: Text('Lets Go'),
style: ElevatedButton.styleFrom(primary: Colors.amber),
)
]
)
));
}
}

You might also like