Professional Documents
Culture Documents
- 08
Course Outcome:- Design and develop a responsive user Interface by applying PWA
design technique.
Practical Incharge
PRACTICAL NO. 8
Theory:
Responsive web design is about creating web pages that look good on all devices! A responsive web
design will automatically adjust for different screen sizes and viewports.
Example
<meta name=”viewport” content=width=device-width, initial-scale=1.0>
This will set the viewport of your page, which will give the browser instructions on how to control the
page dimensions and scaling.
<section class="about">
<h2>About Me</h2>
<div class="about-content">
<div class="about-text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet magna nec elit
aliquet euismod. Donec maximus, sem non sagittis varius, mi justo laoreet magna, et convallis odio
purus ut justo. Integer auctor eros quis sapien volutpat, id feugiat arcu accumsan.</p>
</div>
</div>
</section>
<section class="experience">
<h2>Experience</h2>
<ul>
<li>
<h3>Web Developer</h3>
<p>ABC Company, 2020 - Present</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet magna nec elit
aliquet euismod.</p>
</li>
<li>
<h3>Frontend Developer</h3>
<p>XYZ Corporation, 2018 - 2020</p>
<p>Nulla facilisi. Proin non lorem nec odio feugiat cursus. Vivamus eu felis ut ipsum
suscipit condimentum.</p>
</li>
</ul>
</section>
<section class="skills">
<h2>Skills</h2>
<ul>
<li>HTML5</li>
<li>CSS3</li>
<li>JavaScript</li>
<li>React.js</li>
<li>Node.js</li>
<li>SQL</li>
</ul>
</section>
<section class="projects">
<h2>Projects</h2>
<ul>
<li>
<h3>Portfolio Website</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet magna nec elit
aliquet euismod.</p>
</li>
<li>
<h3>E-commerce Website</h3>
<p>Nulla facilisi. Proin non lorem nec odio feugiat cursus. Vivamus eu felis ut ipsum
suscipit condimentum.</p>
</li>
</ul>
</section>
<section class="education">
<h2>Education</h2>
<ul>
<li>
<h3>Bachelor of Science in Computer Science</h3>
<p>University of Example, 2014 - 2018</p>
</li>
</ul>
</section>
<section class="contact">
<h2>Contact</h2>
<p>Email: johndoe@example.com</p>
<p>Phone: +1234567890</p>
<p>LinkedIn: <a href="https://www.linkedin.com/in/johndoe/">John Doe</a></p>
</section>
<footer>
<p>© 2024 John Doe. All rights reserved.</p>
</footer>
</body>
</html>
CSS File:
.about,
.experience, /* Media Queries */
.education, @media only screen and (max-width: 600px) {
.skills, header h1 {
.projects, font-size: 2em;
.contact { }
background-color: #fff;
margin: 20px auto; header p {
padding: 30px; font-size: 1em;
border-radius: 5px; }
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
} .about,
.experience,
.about h2, .education,
.experience h2, .skills,
.education h2, .projects,
.skills h2, .contact {
.projects h2, padding: 20px;
.contact h2 { }
margin-bottom: 20px; }
color: #333;
}
.experience ul,
.education ul,
.skills ul,
.projects ul {
list-style-type: none;
}
OUTPUT:
Conclusion:
Created a responsive UI by applying PWA design technique.
EXPERIMENT NO. - 09
Aim of the Experiment: -. To deploy Progressive Web App to Git Hub Pages
Course Outcome:- Develop and analyse PWA Features and deploy it over app hosting
solutions
Practical Incharge
PRACTICAL NO. 9
Theory
Build your PWA:
Develop your PWA using web technologies such as HTML, CSS, and JavaScript.
Implement features like responsiveness, offline functionality using service workers, and a web app
manifest.
If you haven't already, initialize a Git repository in your local PWA project folder:
git init is a command used to initialize a new Git repository in your local project directory. When you
run git init, Git creates a new repository in the current directory or in the directory specified.
a. git add .: The git add . command is used to stage all changes in the current directory and its
subdirectories for the next commit. It prepares changes to be committed to the Git repository. When
you modify files or create new ones in your project, they are initially in an "unstaged" state. Running
git add . adds all these changes to the staging area, marking them for inclusion in the next commit.
b. git commit -m "message":The git commit -m "message" command is used to save the staged
changes to the Git repository. It creates a new commit with a specified commit message describing the
changes made in that commit. The commit message should be descriptive and concise, explaining what
changes were made and why.
git remote add github <url> adds a remote repository named "github" with the specified URL to your
local Git repository, enabling you to push and pull changes to and from that remote location.
5.Fetch and push URLs for each remote repository:
The command git remote -v displays a list of remote repositories associated with your local Git
repository along with their corresponding URLs. It shows both fetch and push URLs for each remote
repository, allowing you to view where your repository is configured to pull changes from and push
changes to.
Successfully Hosted
Conclusion: hence we have successfully deployed Progressive Web App to Git Hub Pages
EXPERIMENT NO. - 10
Aim of the Experiment: -. To use Google Lighthouse PWA Analysis Tool to test
the PWA functioning.
Course Outcome:- Develop and analyse PWA Features and deploy it over app hosting
solutions
Practical Incharge
PRACTICAL NO. 10
Problem Definition: To use Google Lighthouse PWA Analysis Tool to test the PWA functioning.
Theory:
Lighthouse Viewer:
The Lighthouse Viewer is an online tool used to view and share reports generated by the Lighthouse
auditing tool.
It allows users to upload Lighthouse report files (in JSON format) and view them in a user-friendly
format online.
Users can analyze various aspects of web page performance, accessibility, best practices, and SEO, as
evaluated by Lighthouse.
PageSpeed Insights:
PageSpeed Insights is a web-based tool provided by Google to analyze the performance of web pages.
It uses Lighthouse under the hood to generate reports, but it is specifically tailored for analyzing web
page speed and providing recommendations for optimization.
PageSpeed Insights offers a user-friendly interface where users can enter a web page URL and receive
a detailed report on performance metrics and suggestions for improvement.
1.Click on the inspect
Course Outcome:- Analyze and Build production ready app by incorporating backend
services and deploying on andriod
Practical Incharge
PRACTICAL NO. 6
Problem Definition: To write and read data into/from firebase
Theory:
• Language as “Java”
• Example: To connect to “Cloud Firestore”, click on Cloud Firestore first and then on the link
– get started with Cloud Firestore.
8.You will notice that the application Name is extracted automatically. Click on continue on
current and next window.
9.Click on Continue
9.On configure Google Analytics page, select the account as default account for Firebase and click
on create project.
10.Click on Connect
11.Here Your Android Studio project is connected to your Firebase Android app
12.Go back to Android Studio, there under Firebase assistant, you will see that the Firebase is
connected.
13.This way we can connect any Firebase service to Android SDK. Lets test another service i.e.
Firestore SDK.
● Click on “Add the Cloud Firestore SDK to your app”.
● Click on “Accept changes” button on next window. This will add the dependency
automatically.
14.Create Database in Firebase Console-
a. Click on Firebase Console
15.It will take you to web-browser. Select the project “My Application”.
16.Click on Create database option on next page.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go to firebase console and check the data is added there or not."
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constr+
3.0 0aintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java Code:
package com.example.myapplication;
import android.os.Bundle;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
private FirebaseFirestore firestore;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); // Make sure this layout file exists
firestore = FirebaseFirestore.getInstance();
yourMethod();
}
private void yourMethod() {
Map<String, Object> user = new HashMap<>();
user.put("firstName", "Doremon");
user.put("lastName", "Nobita");
user.put("description", "Cartoon");
firestore.collection("users")
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_LONG).show();
}});}}
OUTPUT:
18.Go to firebase console and check if the data is added there. Reload (refresh the page) the Cloud
Firestore.
Conclusion: we have learnt connect and how to write and read data into/from firebase
EXPERIMENT NO. - 07
Aim of the Experiment: -. To test and deploy production ready Flutter App on Android
platform.
Course Outcome:- Analyze and Build production ready app by incorporating backend
services and deploying on andriod
Practical Incharge
PRACTICAL NO. 7
Problem Definition: To test and deploy production ready Flutter App on Android
platform.
Theory:
Implementation:
Steps:
5.Copy paste the keystore code from website and paste in key.properties and change the
password.
6.Copy the upload keystore for windows and run in terminal. Save the upload keystroke in
android folder.
2D To-Do-List_App
Main.dart File:
import 'package:flutter/material.dart';
import 'game_page.dart';
void main() {
runApp(const MyApp());
@override
return MaterialApp(
title: 'ToDo App',
debugShowCheckedModeBanner:
primarySwatch: Colors.blue,
),
home: GamePage(),
);
Conclusion: We have learnt how to test and deploy production ready Flutter App on Android
platform.
INNOVATIVE EXPERIMENT
Main.dart:
import 'package:flutter/material.dart';
import 'calculator_screen.dart';
void main() {
runApp(const MyApp());
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Calculator',
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(),
home: const CalculatorScreen(),
);
}
}
button_values.dart:
class Btn {
static const String del = "D";
static const String clr = "C";
static const String per = "%";
static const String multiply = "×";
static const String divide = "÷";
static const String add = "+";
static const String subtract = "-";
static const String calculate = "=";
static const String dot = ".";
Calculator_screen.dart:
import
'package:calculator_app/button_values.dart'; case Btn.multiply:
import 'package:flutter/material.dart'; result = num1 * num2;
break;
class CalculatorScreen extends StatefulWidget { case Btn.divide:
const CalculatorScreen({super.key}); result = num1 / num2;
break;
@override default:
State<CalculatorScreen> createState() => }
_CalculatorScreenState();
} setState(() {
number1 = result.toStringAsPrecision(3);
class _CalculatorScreenState extends
State<CalculatorScreen> { if (number1.endsWith(".0")) {
String number1 = ""; // . 0-9 number1 = number1.substring(0,
String operand = ""; // + - * / number1.length - 2);
String number2 = ""; // . 0-9 }
"$number1$operand$number2".isEmpty if (operand.isNotEmpty) {
? "0" // cannot be converted
: "$number1$operand$number2", return;
style: const TextStyle( }
fontSize: 48,
fontWeight: FontWeight.bold, final number = double.parse(number1);
), setState(() {
textAlign: TextAlign.end, number1 = "${(number / 100)}";
), operand = "";
), number2 = "";
), });
), }
// buttons // ##############
Wrap( // clears all output
children: Btn.buttonValues void clearAll() {
.map( setState(() {
(value) => SizedBox( number1 = "";
width: value == Btn.n0 operand = "";
? screenSize.width / 2 number2 = "";
: (screenSize.width / 4), });
height: screenSize.width / 5, }
child: buildButton(value),
), // ##############
) // delete one from the end
.toList(), void delete() {
) if (number2.isNotEmpty) {
], // 12323 => 1232
), number2 = number2.substring(0,
), number2.length - 1);
); } else if (operand.isNotEmpty) {
} operand = "";
Widget buildButton(value) { } else if (number1.isNotEmpty) {
return Padding( number1 = number1.substring(0,
padding: const EdgeInsets.all(4.0), number1.length - 1);
child: Material( }
color: getBtnColor(value),
clipBehavior: Clip.hardEdge, setState(() {});
shape: OutlineInputBorder( }
borderSide: const BorderSide( // #############
color: Colors.white24, // appends value to the end
), void appendValue(String value) {
borderRadius: // number1 opernad number2
BorderRadius.circular(100), // 234 + 5343
),
child: InkWell( // if is operand and not "."
onTap: () => onBtnTap(value), if (value != Btn.dot && int.tryParse(value)
child: Center( == null) {
child: Text( // operand pressed
value, if (operand.isNotEmpty &&
style: const TextStyle( number2.isNotEmpty) {
fontWeight: FontWeight.bold, // TODO calculate the equation before
fontSize: 24, assigning new operand
), calculate();
), }
), operand = value;
), }
), // assign value to number1 variable
); else if (number1.isEmpty || operand.isEmpty)
} {
// ######## // check if value is "." | ex: number1 = "1.2"
void onBtnTap(String value) { if (value == Btn.dot &&
if (value == Btn.del) { number1.contains(Btn.dot)) return;
delete(); if (value == Btn.dot && (number1.isEmpty
return; || number1 == Btn.n0)) {
} // ex: number1 = "" | "0"
value = "0.";
if (value == Btn.clr) { }
clearAll(); number1 += value;
return; }
} // assign value to number2 variable
else if (number2.isEmpty ||
if (value == Btn.per) { operand.isNotEmpty) {
convertToPercentage(); // check if value is "." | ex: number1 = "1.2"
return; if (value == Btn.dot &&
} number2.contains(Btn.dot)) return;
if (value == Btn.dot && (number2.isEmpty
if (value == Btn.calculate) { || number2 == Btn.n0)) {
calculate(); // number1 = "" | "0"
return; value = "0.";
} }
number2 += value;
appendValue(value); }
}
setState(() {});
// ############## }
// calculates the result
void calculate() { // ########
if (number1.isEmpty) return; Color getBtnColor(value) {
if (operand.isEmpty) return; return [Btn.del, Btn.clr].contains(value)
if (number2.isEmpty) return; ? Colors.blueGrey
final double num1 = double.parse(number1); :[
final double num2 = double.parse(number2); Btn.per,
var result = 0.0; Btn.multiply,
switch (operand) { Btn.add,
case Btn.add: Btn.subtract,
result = num1 + num2; Btn.divide,
break; Btn.calculate,
case Btn.subtract: ].contains(value)
result = num1 - num2; ? Colors.orange
break; : Colors.black87;
}
}
OUTPUT:
Conclusion: We have learnt how to developed android application to generate calculator using flutter.