-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create models for Artikel and create get-post method * refactor method get and post * create myartikel.dart for artikel page * create artikel_by_id.dart * create floating action button for tambah artikel * create form_tambah_artikel.dart for form tambah artikel page * delete keyboard type in form tambah artikel * Implement auth: done (#3) * Init authentication page * Add bottom navbar * Implement login and signup UI * Authentication: done * edit _bacabund.dart * add conditional for floating action button in myartikel.dart * changed widget name into MyArtikel * add BacaBundPage to routes_factory.dart, but still got an error * form + list diary * fixed bug string got null * fixed bug in models and method get artikel * change button color into red * fixed overflow in login page * fixed overflow in signup page * date & fetch belom :( * use the postArtikel method in form page * styling only without features & fetch * change the login and signup url & changed models attribute variable names * trash #1 * create new post method using request.post, but still got an error * build method get & post but didnt work * fixed bugs in post artikel * fixed bugs in button simpan form artikel * delete unnecessary comments * add configuration for deployment * use circular progress indicator while fetching artikel * add state while fetching data * fetch data to django without filter * last revision, failed to fetch with login required * roles handled, still clueless abt filter-delete-post * Periksabund ui * Create Home, Onboarding, and TanyaBund Page (#4) * Feat: TanyaBund Post Question and Answer (#5) * Create Home, Onboarding, and TanyaBund Page * Feat: Implement Functionality to Add Question and Answer * implement get & post, but not applicable in railway * add delete method, but still get authentication problem * new branch * Temporary commit * get post * Commit * Add Functionality to Delete Question and Answer (#6) * Create Home, Onboarding, and TanyaBund Page * Feat: Implement Functionality to Add Question and Answer * Add Functionality to Delete Question and Answer * Fix: Conflict * Finishing TanyaBund * PeriksaBund Get, Post #1 * solve merge * Pubspec commit * change appbar color * merge development * delete codes for debugging * Commit pubspec * Change Api to Railway * get, post, delete done :') * add if else for faskes * railway * scrollview * PeriksaBund Delete Feature #1 * scrollview * Implementing Logout * Commit * PeriksaBund Final * Add Role Greetings * Finishing Co-authored-by: iqbalpa <[email protected]> Co-authored-by: Mayfa Shadrina Siddi <[email protected]> Co-authored-by: shafanjw <[email protected]> Co-authored-by: dionavarastika <[email protected]> Co-authored-by: Mayfa Shadrina Siddi <[email protected]>
- Loading branch information
1 parent
8070135
commit 6dcad84
Showing
31 changed files
with
1,071 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// To parse this JSON data, do | ||
// | ||
// final diary = diaryFromJson(jsonString); | ||
|
||
import 'dart:convert'; | ||
|
||
List<Diary> diaryFromJson(String str) => List<Diary>.from(json.decode(str).map((x) => Diary.fromJson(x))); | ||
|
||
String diaryToJson(List<Diary> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | ||
|
||
class Diary { | ||
Diary({ | ||
required this.pk, | ||
required this.fields, | ||
}); | ||
|
||
int pk; | ||
Fields fields; | ||
|
||
factory Diary.fromJson(Map<String, dynamic> json) => Diary( | ||
pk: json["pk"], | ||
fields: Fields.fromJson(json["fields"]), | ||
); | ||
|
||
Map<String, dynamic> toJson() => { | ||
"pk": pk, | ||
"fields": fields.toJson(), | ||
}; | ||
} | ||
|
||
class Fields { | ||
Fields({ | ||
required this.user, | ||
required this.date, | ||
required this.title, | ||
required this.emotion, | ||
required this.fieldsAbstract, | ||
required this.description, | ||
}); | ||
|
||
String user; | ||
DateTime date; | ||
String title; | ||
int emotion; | ||
String fieldsAbstract; | ||
String description; | ||
|
||
factory Fields.fromJson(Map<String, dynamic> json) => Fields( | ||
user: json["user"], | ||
date: DateTime.parse(json["date"]), | ||
title: json["title"], | ||
emotion: json["emotion"], | ||
fieldsAbstract: json["abstract"], | ||
description: json["description"], | ||
); | ||
|
||
Map<String, dynamic> toJson() => { | ||
"user": user, | ||
"date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | ||
"title": title, | ||
"emotion": emotion, | ||
"abstract": fieldsAbstract, | ||
"description": description, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// import 'dart:js'; | ||
|
||
import 'package:flutter/cupertino.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'dart:convert'; | ||
import 'package:endterm_project/models/diarybund/diary.dart'; | ||
import 'package:endterm_project/views/pages/diarybund/_diarybund.dart'; | ||
import 'package:pbp_django_auth/pbp_django_auth.dart'; | ||
|
||
|
||
part 'get_diary.dart'; | ||
part 'post_diary.dart'; | ||
part 'delete_diary.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
part of '_diarybund.dart'; | ||
|
||
// Delete JSON data from the specified URL | ||
Future<dynamic> deleteDiary(int pk) async { | ||
final url = Uri.parse('https://halowbund.up.railway.app/diarybund/delete-flutter/$pk'); | ||
final headers = {'Content-type': 'application/json'}; | ||
final response = await http.delete(url, headers: headers); | ||
|
||
return jsonDecode(response.body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
part of '_diarybund.dart'; | ||
|
||
Future<List<Diary>> getDiary(String username) async { | ||
var url = Uri.parse('https://halowbund.up.railway.app/diarybund/json-flutter/$username'); | ||
var response = await http.get( | ||
url, | ||
headers: { | ||
"Access-Control-Allow-Origin": "*", | ||
"Content-Type": "application/json", | ||
}, | ||
); | ||
|
||
// melakukan decode response menjadi bentuk json | ||
// print(utf8.decode(response.bodyBytes)); | ||
var data = jsonDecode(utf8.decode(response.bodyBytes)); | ||
|
||
// melakukan konversi data json menjadi object Catat | ||
List<Diary> listCatat = []; | ||
for (var d in data) { | ||
// print("masuk"); | ||
if (d != null) { | ||
// print("sini"); | ||
// print(Diary.fromJson(d)); | ||
listCatat.add(Diary.fromJson(d)); | ||
} | ||
} | ||
return listCatat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
part of '_diarybund.dart'; | ||
|
||
Future<List<Diary>> postDiary(request, String title, String abstract, String description, int emotion, String username, BuildContext context, mounted) async { | ||
|
||
final response = await http.post(Uri.parse('https://halowbund.up.railway.app/diarybund/create-ajax-flutter/'), | ||
headers: <String, String>{ | ||
'Content-Type': 'application/json;charset=UTF-8' | ||
}, | ||
body: jsonEncode(<String, dynamic>{ | ||
'username' : username, | ||
'title': title, | ||
'description': description, | ||
'abstract': abstract, | ||
'emotion': emotion, | ||
})); | ||
|
||
// melakukan decode response menjadi bentuk json | ||
var data = jsonDecode(utf8.decode(response.bodyBytes)); | ||
|
||
// melakukan konversi data json menjadi object ToDo | ||
List<Diary> listCatat = []; | ||
for (var d in data) { | ||
if (d != null) { | ||
listCatat.add(Diary.fromJson(d)); | ||
} | ||
} | ||
return listCatat; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:endterm_project/main.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:pbp_django_auth/pbp_django_auth.dart'; | ||
|
||
import 'package:http/http.dart' as http; | ||
import 'dart:convert'; | ||
import 'package:endterm_project/models/diarybund/diary.dart'; | ||
|
||
import '../../../utils/_utils.dart'; | ||
import '../../../utils/diarybund/_diarybund.dart'; | ||
import '../../../routes/routes_name.dart'; | ||
import '../../widgets/globals/_globals.dart'; | ||
import '../authentication/_authentication.dart'; | ||
import '../homepage/_homepage.dart'; | ||
|
||
part 'listdiary_page.dart'; | ||
part 'form.dart'; | ||
part 'diary_details.dart'; |
Oops, something went wrong.