0% found this document useful (0 votes)
13 views4 pages

Practical 7

Uploaded by

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

Practical 7

Uploaded by

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

FACULTY OF ENGINEERING AND TECHNOLOGY

Department of Computer Engineering


App Development Using Flutter (01CE0610)

Practical 7 : Create and application with Navigation in Flutter.

Main.dart

import 'package:flutter/material.dart';
import 'navigation_page.dart';
void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: NavigationPage(),
);
}
}

navigation_page.dart

import 'package:flutter/material.dart';

class NavigationPage extends StatefulWidget {


@override
_NavigationPageState createState() => _NavigationPageState();
}

class _NavigationPageState extends State<NavigationPage> {


int _currentIndex = 0;

final List<Widget> _pages = [


HomePage(),
AboutPage(),
ContactPage(),
];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Navigation Page"),
backgroundColor: Colors.deepPurple,
foregroundColor: Colors.white,
),
body: _pages[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (index) {

92220103007 Batch – 6TC1 C


FACULTY OF ENGINEERING AND TECHNOLOGY
Department of Computer Engineering
App Development Using Flutter (01CE0610)

setState(() {
_currentIndex = index;
});
},
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label: "Home"),
BottomNavigationBarItem(icon: Icon(Icons.info), label: "About"),
BottomNavigationBarItem(
icon: Icon(Icons.contact_mail), label: "Contact"),
],
),
);
}
}

// ... (existing code)

class HomePage extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Welcome to the Home Page",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: 20),
Icon(Icons.home, size: 50, color: Colors.deepPurple),
SizedBox(height: 20),

],
),
);
}
}

class AboutPage extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("About Us",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: 20),
Text("Learn more about our company and mission."),
SizedBox(height: 20),
Image.asset(
'assets/about_image.png', // Add the path to your image asset
width: 150,

92220103007 Batch – 6TC1 C


FACULTY OF ENGINEERING AND TECHNOLOGY
Department of Computer Engineering
App Development Using Flutter (01CE0610)

height: 150,
),
SizedBox(height: 20),
Text("Additional information about your company."),
SizedBox(height: 20),
Icon(Icons.info, size: 50, color: Colors.deepPurple),
],
),
);
}
}

class ContactPage extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Contact Us",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: 20),
Text("Reach out to us for any inquiries or support."),
SizedBox(height: 20),
TextFormField(
decoration: InputDecoration(
labelText: 'Your Name',
),
),
SizedBox(height: 10),
TextFormField(
decoration: InputDecoration(
labelText: 'Email Address',
),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Add your action for the form submission
},
child: Text('Submit'),
),
SizedBox(height: 20),
Icon(Icons.contact_mail, size: 50, color: Colors.deepPurple),
],
),
);
}
}

92220103007 Batch – 6TC1 C


FACULTY OF ENGINEERING AND TECHNOLOGY
Department of Computer Engineering
App Development Using Flutter (01CE0610)

Output:

92220103007 Batch – 6TC1 C

You might also like