MAD Project Report
MAD Project Report
Facebook-Clone
Session 2021-2025
Project Documentation
Submitted To
Sir Waseem
Submitted By
Abdullah Mazher 2021-CS-198
4. Project Code.................................................................................................................................. 7
4.1 Interface.dart ........................................................................................................................... 7
4.2 Profile.dart ............................................................................................................................ 10
2|Pag e
1. Introduction
1.1 Project Description
1.2 Features
Create Account
Login to account
Edit Bio, Profile Picture, Email
View Users
Send & Receive Requests
View and upload Posts
Save the last profile information
Audit Tables
3|Pag e
1.3 Technology Used
4|Pag e
3- Profile 4- Profile Update
5- Pricacy 6- Interface
5|Pag e
3. Project Diagrams
3.1 Class Diagram
6|Pag e
4. Some Snippets of Code
3.1. Interface.dart
@override
return MaterialApp(
home: Scaffold(
appBar: AppBar(
? Row(
children: [
CircleAvatar(
backgroundImage: AssetImage('assets/im/abd.jpeg'),
),
SizedBox(width: 8.0),
Text(loggedInUser!.name),
],
: Text('Home'),
actions: [
IconButton(
icon: Icon(Icons.menu),
onPressed: () {
_showOptionsMenu();
},
7|Pag e
),
IconButton(
icon: Icon(Icons.person),
onPressed: loadrequests,
),
IconButton(
icon: Icon(Icons.logout),
onPressed: () {
Navigator.pop(context);
},
),
],
),
body: Column(
children: [
Padding(
child: Row(
children: [
Expanded(
child: TextField(
controller: _textEditingController,
decoration: InputDecoration(
),
),
8|Pag e
),
IconButton(
icon: Icon(Icons.attach_file),
onPressed: () {
},
),
IconButton(
icon: Icon(Icons.send),
),
IconButton(
icon: Icon(Icons.post_add),
onPressed: () {},
),
],
),
),
SizedBox(height: 16.0),
Expanded(
child: posts.isNotEmpty
? ListView.separated(
itemCount: posts.length,
9|Pag e
return _buildPost(post);
},
: Center(
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
Navigator.push(
context,
);
},
child: Icon(Icons.person),
),
),
);
3.2. Profile.dart
@override
return Scaffold(
10 | P a g e
appBar: AppBar(
title: Text('Profile'),
),
body: Padding(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
radius: 70,
? FileImage(_selectedImage!)
: AssetImage(UserData.profilePic) as ImageProvider,
),
SizedBox(height: 15),
SizedBox(height: 10),
_buildTextField("Name", _nameController),
_buildTextField("Password", _passwordController),
_buildTextField("Bio", _bioController),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
updateProfile(UserData.username, _bioController.text);
//keeprecord(UserData.username, UserData.bio);
11 | P a g e
print("done");
UserData.name = _nameController.text;
UserData.bio = _bioController.text;
UserData.profilePic =
_selectedImage?.path ?? UserData.profilePic;
Navigator.pop(context);
},
),
],
),
),
);
3.3. CreateAccount.dart
@override
return Scaffold(
appBar: AppBar(
title: Text('Create-Account'),
),
body: Center(
child: Container(
12 | P a g e
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.facebook,
size: 40.0,
color: Colors.blue,
),
Text(
'Facebook-Clone',
style: TextStyle(
color: Colors.blue,
fontSize: 30.0,
fontWeight: FontWeight.w900,
),
),
SizedBox(height: 16.0),
NameTextBox(controller: nameController),
SizedBox(height: 16.0),
EmailTextBox(controller: emailController),
SizedBox(height: 16.0),
PasswordTextBox(controller: passwordController),
SizedBox(height: 16.0),
ConfirmPasswordBox(controller: passwordController),
SizedBox(height: 16.0),
ElevatedButton(
13 | P a g e
onPressed: () {
addbio(email);
displayMessage(context,
},
style: ElevatedButton.styleFrom(
primary: Colors.white,
side: BorderSide(
color: Colors.blue,
width: 2.0,
),
),
child: Text(
'Create Account',
style: TextStyle(
color: Colors.blue,
),
),
),
],
),
),
14 | P a g e
),
);
3.4 Privacy.dart
@override
return Scaffold(
appBar: AppBar(
title: Text('Privacy'),
),
body: Padding(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Account Visibility',
),
Row(
children: [
Radio(
value: true,
groupValue: isAccountPublic,
onChanged: (value) {
15 | P a g e
setState(() {
isAccountPublic = true;
});
},
),
Text('Public'),
SizedBox(width: 20),
Radio(
value: false,
groupValue: isAccountPublic,
onChanged: (value) {
setState(() {
isAccountPublic = false;
});
},
),
Text('Private'),
],
),
SizedBox(height: 20),
Text(
'Messaging Permissions',
),
CheckboxListTile(
16 | P a g e
value: canReceiveMessages,
onChanged: (value) {
setState(() {
canReceiveMessages = value!;
});
},
),
CheckboxListTile(
value: canReceiveMessages,
onChanged: (value) {
setState(() {
canReceiveMessages = value!;
});
},
),
CheckboxListTile(
value: canReceiveMessages,
onChanged: (value) {
setState(() {
canReceiveMessages = value!;
});
},
),
SizedBox(height: 20),
17 | P a g e
Text(
),
CheckboxListTile(
value: canLikeComments,
onChanged: (value) {
setState(() {
canLikeComments = value!;
});
},
),
CheckboxListTile(
value: canCommentOnPosts,
onChanged: (value) {
setState(() {
canCommentOnPosts = value!;
});
},
),
CheckboxListTile(
value: canSharePosts,
onChanged: (value) {
18 | P a g e
setState(() {
canSharePosts = value!;
});
},
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
},
child: Text('Save'),
),
],
),
),
);
3.5 Users.dart
@override
return Scaffold(
appBar: AppBar(
title: Text('Users'),
),
body: users.isEmpty
19 | P a g e
? Center(
child: CircularProgressIndicator(),
: ListView.builder(
itemCount: users.length,
return _buildUserCard(users[index]);
},
),
);
bool isRequestSent =
return Card(
child: ListTile(
leading: CircleAvatar(
radius: 30,
),
trailing: ElevatedButton(
onPressed: isRequestSent
20 | P a g e
: () {
_sendFriendRequest(user['email'].toString(), user['name']);
setState(() {
sentRequests.add(user['_id']);
});
},
),
),
);
21 | P a g e