8000 :bulb: Final Commit · CRYPTOcoderAS/Vault-Flutter@9b6ee47 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b6ee47

Browse files
committed
💡 Final Commit
1 parent 6ca9af1 commit 9b6ee47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3977
-108
lines changed

PasswordVault.apk

6.45 MB
Binary file not shown.

README.md

Lines changed: 117 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,123 @@
1-
# passvault
21

3-
A new Flutter project.
2+
<p align="center">
3+
<img align= "center" src="https://drive.google.com/uc?export=view&id=1WgZHCHX8LbjJODPuKHmz_QgTqYGi50Yo" style=" align: center ; width: 650px; height: 320px" title="Akshat Sachan" />
4+
5+
</p>
46

5-
## Getting Started
67

7-
This project is a starting point for a Flutter application.
8+
<h1 align="center">Welcome to Password Vault 👋</h1>
9+
<p>
10+
<img alt="Version" src="https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000" />
11+
<a href="to be added" target="_blank">
12+
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
13+
</a>
14+
<a href="nonee" target="_blank">
15+
<img alt="License: MIT " src="https://img.shields.io/badge/License-MIT-yellow.svg" />
16+
</a>
17+
</p>
818

9-
A few resources to get you started if this is your first Flutter project:
19+
> Offline Password Manager mobile application built using flutter and sqlite.
1020
11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
21+
## APP PREVIEW
22+
23+
<p align="center">
24+
<img src="./assets/1.png" width=350 alt="accessibility text">
25+
<img src="./assets/2.png" width=350 title="hover text">
26+
<img src="./assets/3.png" width=350 alt="accessibility text">
27+
<img src="./assets/4.png" width=350 alt="accessibility text">
28+
29+
</p>
30+
31+
## Install
32+
33+
```sh
34+
flutter pub get
35+
```
36+
37+
## Usage
38+
39+
```sh
40+
flutter run
41+
```
42+
43+
## Run tests
44+
45+
```sh
46+
f5 / debug
47+
```
48+
49+
50+
51+
52+
<div align="center">
53+
<img src="https://img.shields.io/badge/Contributors-seashell?logo=Microsoft%20Teams&style=for-the-badge" />
54+
</div>
55+
<br>
56+
57+
58+
<div align="center">
59+
<table>
60+
<tr align="center">
61+
62+
<td>
63+
64+
👤 **Akshat Sachan**
65+
66+
<p align="center">
67+
<img src = "https://avatars.githubusercontent.com/cryptocoderas" height="120" alt="Akshat Sachan">
68+
</p>
69+
<p align="center">
70+
<a href = "https://github.com/cryptocoderas">
71+
<img src = "http://www.iconninja.com/files/241/825/211/round-collaboration-social-github-code-circle-network-icon.svg"
72+
width="36" height = "36"/></a>
73+
<a href = "https://www.linkedin.com/in/akshat-sachan-58b2921ab/">
74+
<img src = "http://www.iconninja.com/files/863/607/751/network-linkedin-social-connection-circular-circle-media-icon.svg" width="36" height="36"/>
75+
</a>
76+
</p>
77+
</td>
78+
79+
80+
</table>
81+
</tr>
82+
</div>
83+
<br>
84+
85+
86+
<div align="center">
87+
<img src="https://img.shields.io/badge/Please%20'star',%20if%20you%20like%20it-blue?logo=Starship&style=for-the-badge" width="300" height="35"/>
88+
</div>
89+
90+
## Show your support
91+
92+
Give a ⭐️ if you liked this project or it helped you!
93+
94+
## 📝 License
95+
96+
Copyright © 2021 [Akshat Sachan](https://github.com/CryptocoderAS)<br />
97+
This project is [MIT](none) licensed.
98+
99+
## MIT License
100+
101+
```
102+
103+
Copyright (c) 2021 AKSHAT SACHAN
104+
105+
Permission is hereby granted, free of charge, to any person obtaining a copy
106+
of this software and associated documentation files (the "Software"), to deal
107+
in the Software without restriction, including without limitation the rights
108+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109+
copies of the Software, and to permit persons to whom the Software is
110+
furnished to do so, subject to the following conditions:
111+
112+
The above copyright notice and this permission notice shall be included in all
113+
copies or substantial portions of the Software.
114+
115+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
121+
SOFTWARE.
122+
```
13123

14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.passvault">
33
<application
4-
android:label="passvault"
5-
android:icon="@mipmap/ic_launcher">
4+
android:label="PasswordVault"
5+
android:icon="@mipmap/appicn">
66
<activity
77
android:name=".MainActivity"
88
android:launchMode="singleTop"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@mipmap/appicn_adaptive_back"/>
4+
<foreground android:drawable="@mipmap/appicn_adaptive_fore"/>
5+
</adaptive-icon>
6.57 KB
Loading
Loading
Loading
-544 Bytes
Binary file not shown.
3.52 KB
Loading
Loading
Loading
-442 Bytes
Binary file not shown.
9.97 KB
Loading
Loading
Loading
Binary file not shown.
Loading
Loading
Loading
Binary file not shown.
Loading
Loading
Loading
Binary file not shown.

assets/1.jpg

178 KB
Loading

assets/1.png

88.6 KB
Loading

assets/2.png

75.6 KB
Loading

assets/3.png

78.8 KB
Loading

assets/4.png

133 KB
Loading

assets/github.png

3.42 KB
Loading

assets/icon.png

381 KB
Loading

assets/web.png

3.76 KB
Loading

lib/db/password_database.dart

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import 'package:path/path.dart';
2+
import 'package:sqflite/sqflite.dart';
3+
import 'package:passvault/model/password_model.dart';
4+
5+
class PasswordDatabase {
6+
static final PasswordDatabase instance = PasswordDatabase._init();
7+
8+
static Database? _database;
9+
10+
PasswordDatabase._init();
11+
12+
Future<Database> get database async {
13+
if (_database != null) return _database!;
14+
15+
_database = await _initDB('password_info.db');
16+
return _database!;
17+
}
18+
19+
Future<Database> _initDB(String filePath) async {
20+
final dbPath = await getDatabasesPath();
21+
final path = join(dbPath, filePath);
22+
23+
return await openDatabase(path, version: 1, onCreate: _createDB);
24+
}
25+
26+
Future _createDB(Database db, int version) async {
27+
final idType = 'INTEGER PRIMARY KEY AUTOINCREMENT';
28+
final textType = 'TEXT NOT NULL';
29+
30+
await db.execute('''
31+
CREATE TABLE $tableNotes (
32+
${PasswordFields.id} $idType,
33+
${PasswordFields.title} $textType,
34+
${PasswordFields.username} $textType,
35+
${PasswordFields.password} $textType
36+
)
37+
''');
38+
}
39+
40+
Future<Password> create(Password password) async {
41+
final db = await instance.database;
42+
43+
// final json = note.toJson();
44+
// final columns =
45+
// '${NoteFields.title}, ${NoteFields.description}, ${NoteFields.time}';
46+
// final values =
47+
// '${json[NoteFields.title]}, ${json[NoteFields.description]}, ${json[NoteFields.time]}';
48+
// final id = await db
49+
// .rawInsert('INSERT INTO table_name ($columns) VALUES ($values)');
50+
51+
final id = await db.insert(tableNotes, password.toJson());
52+
return password.copy(id: id);
53+
}
54+
55+
Future<Password> readNote(int id) async {
56+
final db = await instance.database;
57+
58+
final maps = await db.query(
59+
tableNotes,
60+
columns: PasswordFields.values,
61+
where: '${PasswordFields.id} = ?',
62+
whereArgs: [id],
63+
);
64+
65+
if (maps.isNotEmpty) {
66+
return Password.fromJson(maps.first);
67+
} else {
68+
throw Exception('ID $id not found');
69+
}
70+
}
71+
72+
Future<List<Password>> readAllNotes() async {
73+
final db = await instance.database;
74+
75+
// final result =
76+
// await db.rawQuery('SELECT * FROM $tableNotes ORDER BY $orderBy');
77+
78+
final result = await db.query(tableNotes);
79+
80+
return result.map((json) => Password.fromJson(json)).toList();
81+
}
82+
83+
Future<int> update(Password password) async {
84+
final db = await instance.database;
85+
86+
return db.update(
87+
tableNotes,
88+
password.toJson(),
89+
where: '${PasswordFields.id} = ?',
90+
whereArgs: [password.id],
91+
);
92+
}
93+
94+
Future<int> delete(int id) async {
95+
final db = await instance.database;
96+
97+
return await db.delete(
98+
tableNotes,
99+
where: '${PasswordFields.id} = ?',
100+
whereArgs: [id],
101+
);
102+
}
103+
104+
Future close() async {
105+
final db = await instance.database;
106+
107+
db.close();
108+
}
109+
}

lib/db/user_database.dart

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import 'package:path/path.dart';
2+
import 'package:sqflite/sqflite.dart';
3+
import 'package:passvault/model/user_info_model.dart';
4+
5+
class UserDatabase {
6+
static final UserDatabase instance = UserDatabase._init();
7+
8+
static Database? _database;
9+
10+
UserDatabase._init();
11+
12+
Future<Database> get database async {
13+
if (_database != null) return _database!;
14+
15+
_database = await _initDB('notes.db');
16+
return _database!;
17+
}
18+
19+
Future<Database> _initDB(String filePath) async {
20+
final dbPath = await getDatabasesPath();
21+
final path = join(dbPath, filePath);
22+
23+
return await openDatabase(path, version: 1, onCreate: _createDB);
24+
}
25+
26+
Future _createDB(Database db, int version) async {
27+
final idType = 'INTEGER PRIMARY KEY AUTOINCREMENT';
28+
final textType = 'TEXT NOT NULL';
29+
final boolType = 'BOOLEAN NOT NULL';
30+
31+
await db.execute('''
32+
CREATE TABLE $tableNotes (
33+
${UserFields.id} $idType,
34+
${UserFields.loginRequired} $boolType,
35+
${UserFields.masterpswd} $textType
36+
)
37+
''');
38+
}
39+
40+
Future<User> create(User user) async {
41+
final db = await instance.database;
42+
43+
// final json = user.toJson();
44+
// final columns =
45+
// '${UserFields.title}, ${UserFields.description}, ${UserFields.time}';
46+
// final values =
47+
// '${json[UserFields.title]}, ${json[UserFields.description]}, ${json[UserFields.time]}';
48+
// final id = await db
49+
// .rawInsert('INSERT INTO table_name ($columns) VALUES ($values)');
50+
51+
final id = await db.insert(tableNotes, user.toJson());
52+
return user.copy(id: id);
53+
}
54+
55+
Future<User> readNote(int id) async {
56+
final db = await instance.database;
57+
58+
final maps = await db.query(
59+
tableNotes,
60+
columns: UserFields.values,
61+
where: '${UserFields.id} = ?',
62+
whereArgs: [id],
63+
);
64+
65+
if (maps.isNotEmpty) {
66+
return User.fromJson(maps.first);
67+
} else {
68+
throw Exception('ID $id not found');
69+
}
70+
}
71+
72+
Future<List<User>> readAllNotes() async {
73+
final db = await instance.database;
74+
75+
// final result =
76+
// await db.rawQuery('SELECT * FROM $tableNotes ORDER BY $orderBy');
77+
78+
final result = await db.query(tableNotes);
79+
80+
return result.map((json) => User.fromJson(json)).toList();
81+
}
82+
83+
Future<int> update(User user) async {
84+
final db = await instance.database;
85+
86+
return db.update(
87+
tableNotes,
88+
user.toJson(),
89+
where: '${UserFields.id} = ?',
90+
whereArgs: [user.id],
91+
);
92+
}
93+
94+
Future<int> delete(int id) async {
95+
final db = await instance.database;
96+
97+
return await db.delete(
98+
tableNotes,
99+
where: '${UserFields.id} = ?',
100+
whereArgs: [id],
101+
);
102+
}
103+
104+
Future close() async {
105+
final db = await instance.database;
106+
_database = null;
107+
return db.close();
108+
}
109+
}

0 commit comments

Comments
 (0)
0