Skip to content

Commit

Permalink
Updated ReadMe file
Browse files Browse the repository at this point in the history
Updated UI
Fixed internet issue in release mode
Modified advanced search & abstracted search results
  • Loading branch information
mohammadkamal committed Jun 9, 2021
1 parent 657b069 commit f2549a1
Show file tree
Hide file tree
Showing 22 changed files with 454 additions and 171 deletions.
95 changes: 89 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,98 @@
# wazeefa
# Wazeefa

A career finder application

## Tools

* Github jobs [https://jobs.github.com] - RESTful API
* Github jobs [https://jobs.github.com] - RESTful API (Note: To be replaced)
* Web View
* Html View
* SQLite

## Gallery
<img src="docs/Screenshot_2021-05-14-00-09-05-711_com.example.wazeefa.jpg" width="45%">
<img src="docs/Screenshot_2021-05-14-00-09-19-540_com.example.wazeefa.jpg" width="45%">
<img src="docs/Screenshot_2021-05-14-00-09-26-774_com.example.wazeefa.jpg" width="45%">
<img src="docs/Screenshot_2021-05-14-00-09-36-754_com.example.wazeefa.jpg" width="45%">
<img src="docs/Screenshot_2021-06-09-20-28-32-588_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-28-38-279_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-28-44-549_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-28-53-664_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-29-12-119_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-29-38-103_com.example.wazeefa.jpg" width="30%">
<img src="docs/Screenshot_2021-06-09-20-29-52-062_com.example.wazeefa.jpg" width="30%">

## Documentation
### Fetch data from API
To fetch data from RESTful API, You need to use [http package](https://pub.dev/packages/http)
Examine the following example:

```dart
Future<List<Job>> fetchJobs() async {
final respone = await http
.get(Uri.parse('https://jobs.github.com/positions.json?description='));
final parsed = jsonDecode(respone.body).cast<Map<String, dynamic>>();
return parsed.map<Job>((json) => Job.fromJson(json)).toList();
}
```

### Search for specific data
Examine the following example:

```dart
Future<List<Job>> searchJobs(
String description, String location, bool fullTime) async {
String descriptionVariable =
description.isNotEmpty ? 'description=' + description : 'description=';
String locationVariable =
location.isNotEmpty ? '&location=' + location : '&location=';
String fullTimeVariable = fullTime ? '&full_time=true' : '';
final response = await http.get(Uri.parse(
'https://jobs.github.com/positions.json?' +
descriptionVariable +
fullTimeVariable +
locationVariable));
final parsed = jsonDecode(response.body).cast<Map<String, dynamic>>();
return parsed.map<Job>((json) => Job.fromJson(json)).toList();
}
```

For more information, see [Fetch data from the internet](https://flutter.dev/docs/cookbook/networking/fetch-data.html) at Flutter documentation.

For the whole code, you can see [Fetch API functions code](lib/fetch_rest_api.dart)

### Store data on local device
To store data on local device, You can use SQLite database to save your data on your phone. To download the package, go to [sqflite](https://pub.dev/packages/sqflite)

```dart
static Future<Database> futureDatabase;
static Database database;
void onDatabaseIntialize() async {
var databasePath = await getDatabasesPath();
String path = join(databasePath, 'saved_jobs_database.db');
futureDatabase = openDatabase(path, onCreate: (db, version) {
return db.execute(
'CREATE TABLE savedJobs(jobID TEXT PRIMARY KEY, type TEXT, jobURL TEXT, createTime TEXT, companyName TEXT, companyURL TEXT, location TEXT, title TEXT, description TEXT, companyLogoURL TEXT, howToApply TEXT)');
}, version: 1);
database = await futureDatabase;
}
```

To add data (in our case jobs):

```dart
Future<void> addJob(Job job) async {
await database.insert('savedJobs', job.toDatabaseMap(),
conflictAlgorithm: ConflictAlgorithm.replace);
}
```

To remove data:

```dart
Future<void> deleteJob(String id) async {
await database.delete('savedJobs', where: 'jobID = ?', whereArgs: [id]);
}
```

To see the whole code, visit [Jobs Database](lib/jobs_database.dart)
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wazeefa">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="wazeefa"
android:label="Wazeefa"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 21 additions & 14 deletions lib/job_posting_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ class JobPostingItem extends StatelessWidget {
const JobPostingItem({Key key, @required this.job}) : super(key: key);

Widget _photoWidget() {
return CachedNetworkImage(
imageUrl: job.companyLogoURL,
placeholder: (context, url) => Container(
child: CircularProgressIndicator(),
alignment: Alignment.center,
),
errorWidget: (context, url, error) => Container(
child: Icon(Icons.broken_image),
alignment: Alignment.center,
),
height: 100,
width: 100);
return Container(
padding: EdgeInsets.only(left: 10),
child: CachedNetworkImage(
imageUrl: job.companyLogoURL,
placeholder: (context, url) => Container(
child: CircularProgressIndicator(),
alignment: Alignment.center,
),
errorWidget: (context, url, error) => Container(
child: Icon(Icons.broken_image),
alignment: Alignment.center,
),
alignment: Alignment.center,
height: 80,
width: 80));
}

Widget _titleWidget() {
Expand Down Expand Up @@ -65,7 +68,7 @@ class JobPostingItem extends StatelessWidget {
children: [
Icon(
Icons.location_on,
color: Colors.blue[300],
color: Colors.red[400],
),
Container(
width: 150,
Expand Down Expand Up @@ -97,9 +100,13 @@ class JobPostingItem extends StatelessWidget {
return GestureDetector(
child: Container(
padding: EdgeInsets.only(top: 8, bottom: 8),
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.5))]),
borderRadius: BorderRadius.circular(30),
boxShadow: [
BoxShadow(color: Colors.grey.withOpacity(0.5), spreadRadius: 1.5)
]),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [_photoWidget(), _infoWidget()],
Expand Down
Loading

0 comments on commit f2549a1

Please sign in to comment.