Fakultas Ilmu Komputer UI

Commit 57cb4305 authored by Ferdi Salim Sungkar's avatar Ferdi Salim Sungkar
Browse files

feat: pulling from staging

parents ebf15253 c475ad3f
......@@ -668,7 +668,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-05-30T08:30:27.845505Z",
"generated": "2021-05-30T08:50:09.184066Z",
"generator": "pub",
"generatorVersion": "2.12.0"
}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":[]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-30 15:30:27.985080","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":[]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-31 02:58:49.646797","version":"2.0.1"}
\ No newline at end of file
image: cirrusci/flutter:stable
image: cirrusci/flutter:2.0.6
stages:
- linter
......@@ -6,11 +6,6 @@ stages:
- sonar
- build_android
before_script:
- flutter pub get
- flutter clean
- flutter --version
lint:flutter:
stage: linter
script:
......
......@@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-05-30 15:30:27.817003.
# Generated by pub on 2021-05-30 15:50:09.158599.
_fe_analyzer_shared:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-14.0.0/lib/
analyzer:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/
args:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.0.0/lib/
......
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:fundex_app/storage/storage.dart';
import 'package:http/http.dart' show Client;
import 'package:flutter/material.dart';
class Api {
Client client = Client();
......@@ -17,32 +20,8 @@ class Api {
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var token = jsonData['token'];
await secureStorage.writeSecureData('token', token);
} else if (apiResult.statusCode == 400) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var jsonError = jsonData['errors'];
var jsonErrorMessage = jsonError[0]['message'];
switch (jsonErrorMessage) {
case 'invalid.credential':
{
throw Exception('Invalid Credential');
}
break;
case 'empty.email':
{
throw Exception('Email cannot be empty');
}
break;
case 'empty.password':
{
throw Exception('Password cannot be empty');
}
break;
}
} else {
throw Exception('Failed to Login');
}
return apiResult.statusCode;
}
Future<int> register(String email, String password) async {
......@@ -76,13 +55,425 @@ class Api {
print('pinter');
var jsonObject = json.decode(apiResult.body);
var accessToken = (jsonObject as Map<String, dynamic>)['access_token'];
//var jsonData = (jsonObject as Map<String, dynamic>)['data'];
await secureStorage.writeSecureData('accessToken', accessToken);
print(await secureStorage.readSecureData('accessToken'));
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var userInfo = (jsonData as Map<String, dynamic>)['user_info'];
var userName = (userInfo as Map<String, dynamic>)['name'];
var userRole = (userInfo as Map<String, dynamic>)['role'];
var userProfilePic =
(userInfo as Map<String, dynamic>)['profile_picture'];
await secureStorage.writeSecureData('userName', userName);
print('username: ' + await secureStorage.readSecureData('userName'));
await secureStorage.writeSecureData('userRole', userRole);
print('userRole: ' + await secureStorage.readSecureData('userRole'));
await secureStorage.writeSecureData('userProfilePic', userProfilePic);
print('userProfilePic: ' +
await secureStorage.readSecureData('userProfilePic'));
} else if (apiResult.statusCode == 400) {
print("Failed");
} else {
print("Unknown");
}
}
Future patchMember(String name, int addressId, String phone) async {
var apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/member');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.patch(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode(
{'name': name, 'address_id': addressId, 'phone': phone}));
if (apiResult.statusCode == 200) {
print('Patch member berhasil');
print(apiResult.statusCode);
print(apiResult.body);
return 'Simpan Berhasil!';
} else {
print('Patch member ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future gender(String gen) async {
var apiURL =
Uri.parse('https://canary.fundex.id/api/v1.1/member-attribute');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode({'attribute_name': 'gender', 'attribute_value': gen}));
if (apiResult.statusCode == 200) {
print('gender berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeGender = jsonData['id'];
await secureStorage.writeSecureData(
'idMemberAttributeGender', idMemberAttributeGender.toString());
print(await secureStorage.readSecureData('idMemberAttributeGender'));
} else {
print('gender ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan gender');
}
}
Future birthdate(DateTime date) async {
var apiURL =
Uri.parse('https://canary.fundex.id/api/v1.1/member-attribute');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode(
{'attribute_name': 'birthdate', 'attribute_value': date}));
if (apiResult.statusCode == 200) {
print('birthdate berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeBirthdate = jsonData['id'];
await secureStorage.writeSecureData(
'idMemberAttributeBirthdate', idMemberAttributeBirthdate);
print(await secureStorage.readSecureData('idMemberAttributeBirthdate'));
return 'Simpan Berhasil!';
} else {
print('birthdate ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future birthplace(String nameCity) async {
var apiURL =
Uri.parse('https://canary.fundex.id/api/v1.1/member-attribute');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode(
{'attribute_name': 'birthplace', 'attribute_value': nameCity}));
if (apiResult.statusCode == 200) {
print('birthplace berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeBirthplace = jsonData['id'];
await secureStorage.writeSecureData(
'idMemberAttributeBirthplace', idMemberAttributeBirthplace);
print(await secureStorage.readSecureData('idMemberAttributeBirthplace'));
return 'Simpan Berhasil!';
} else {
print('birthplace ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan tempat lahir');
}
}
Future getMember() async {
final apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/member');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get member: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var jsonMember = (jsonData as Map<String, dynamic>)['member'];
return jsonMember;
} else {
throw Exception('Get Failed');
}
}
Future getRefCity() async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/ref-cities?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref cities: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_cities'];
final List<String> city = <String>[];
for (var i = 0; i < refCities.length; i++) {
city.add(refCities[i]['name']);
}
return city;
} else {
throw Exception('Get Failed');
}
}
Future getRefState() async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/ref-states?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref state: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_states'];
final List<String> state = <String>[];
for (var i = 0; i < refCities.length; i++) {
state.add(refCities[i]['name']);
}
return state;
} else {
throw Exception('Get Failed');
}
}
Future getRefDistrict() async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/ref-districts?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref state: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_districts'];
final List<String> distr = <String>[];
for (var i = 0; i < refCities.length; i++) {
distr.add(refCities[i]['name']);
}
return distr;
} else {
throw Exception('Get Failed');
}
}
Future postAddress(String address, String district, String city,
String province, String zipCode) async {
var apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/address');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode(<String, String>{
"address": address,
"district": district,
"city": city,
"province": province,
"country": "Indonesia",
"zip_code": zipCode
}));
if (apiResult.statusCode == 200) {
// var jsonObject = json.decode(apiResult.body);
// var data = (jsonObject as Map<String, dynamic>)['data'];
// var name = data['name'];
// Map<String, dynamic> map = {'name': name};
print('Patch member berhasil');
print(apiResult.statusCode);
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
return 'Simpan Berhasil!';
} else {
print(apiResult.statusCode);
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future forgetPassword(String email, int statusCode) async {
final apiURL =
Uri.parse('https://canary.fundex.id/api/v1.1/auth/forgot-password');
var body = jsonEncode({'email': email});
var headers = {'Content-type': 'application/json'};
var apiResult = await client.post(apiURL, headers: headers, body: body);
statusCode = apiResult.statusCode;
return (statusCode);
}
Future getMemberDocsId() async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member-attributes?attribute_name=agreement_doc_id&offset=&limit=&order_by=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
'Authorization': 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var memberAttributes =
(jsonData as Map<String, dynamic>)['member_attributes'];
var idMemberDocs = (memberAttributes as Map<String, dynamic>)['id'];
await secureStorage.writeSecureData('idMemberDocs', idMemberDocs);
print(await secureStorage.readSecureData('idMemberDocs'));
} else {
throw Exception('Failed to get MemberDocsID');
}
}
Future getMemberDocs(String memberDocsId) async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member-documents/$memberDocsId/private');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
'Authorization': 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var memberDocument =
(jsonData as Map<String, dynamic>)['member_document'];
var description = (memberDocument as Map<String, dynamic>)['description'];
var download = (description as Map<String, dynamic>)['download'];
var expiredAt = (download as Map<String, dynamic>)['expiredAt'];
var name = (memberDocument as Map<String, dynamic>)['name'];
var imgUrl = (memberDocument as Map<String, dynamic>)['url'];
await secureStorage.writeSecureData('memberDocs-expiredAt', expiredAt);
await secureStorage.writeSecureData('memberDocs-name', name);
await secureStorage.writeSecureData('memberDocs-imgUrl', imgUrl);
print(await secureStorage.readSecureData('memberDocs-expiredAt'));
print(await secureStorage.readSecureData('memberDocs-name'));
print(await secureStorage.readSecureData('memberDocs-imgUrl'));
// ISI DESCRIPTION
// {
// "docToken": "bb5e12c77438f60da1f2ab6e566c5aeb6d03561bec3e5d588f7e240e4c164120",
// "recipients": [{
// "privyId": "AB1234",
// "type": "Reviewer",
// "signatoryStatus": "Completed"
// },
// {
// "privyId": "DE3456",
// "type": "Signer",
// "signatoryStatus": "Completed"
// }
// ],
// "documentStatus": "Completed",
// "urlDocument": "https://sign-sandbox.privy.id/doc/bb5e12c77438f60da1f2ab6e566c5aeb6d03561bec3e5d588f7e240e4c164120",
// "download": {
// "url": "http://api-sandbox.privy.id/document/6S7p0MVgdB-f9a360ab-6d47-41d8-881d-b4492bad49f8",
// "expiredAt": "2019-04-25T09:33:58+00:00"
// }}
} else {
throw Exception('Failed to get MemberDocsID');
}
}
Future getEquityOfferingsByID(String iD) async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/public/equity-offerings/$iD');
var headers = {'Content-type': 'application/json'};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var equityOffering = jsonData['equity_offering'];
return equityOffering;
}
}
Future getEquityOfferingDocsByID(String iD) async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/public/equity-offerings/$iD');
var headers = {'Content-type': 'application/json'};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var equityOfferingDocs = jsonData['offering_docs'];
return equityOfferingDocs;
}
}
Future getEquityOfferingBannersByID(String iD) async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/public/equity-offerings/$iD');
var headers = {'Content-type': 'application/json'};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var equityOfferingBanners = jsonData['offering_banners'];
return equityOfferingBanners;
}
}
Future getEquityOfferingSummaryByID(String iD) async {
final apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/public/equity-offerings/$iD/summary');
var headers = {'Content-type': 'application/json'};
var apiResult = await client.get(apiURL, headers: headers);
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var equityOfferingsSummary = jsonData['summary'];
return equityOfferingsSummary;
}
}
Future getEquityOfferingDetailsByID(String iD) async {
final apiURL =
Uri.parse('https://canary.fundex.id/api/v1.1/public/equities/$iD');
var headers = {'Content-type': 'application/json'};
var apiResult = await client.get(apiURL, headers: headers);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var equityOfferingDetails = jsonData['equity'];
return equityOfferingDetails;
}
}
import 'package:flutter/material.dart';
const primary = Color(0xFF12284B);
const secondary = Color(0xFF0091C9);
const white = Color(0xFFFFFFFF);
const black1 = Color(0xFF000000);
const gray4 = Color(0xFFBDBDBD);
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:fundex_app/my_flutter_app_icons.dart';
import 'package:fundex_app/pages/business/homekyc.dart';
import 'package:fundex_app/pages/profile/akun.dart';
import 'package:fundex_app/pages/transaction/DetailTransactionPembelian.dart';
import 'package:fundex_app/pages/profile/profile_base_page.dart';
import 'package:fundex_app/pages/transaction/Transaction.dart';
import 'package:google_fonts/google_fonts.dart';
class MainScreen extends StatefulWidget {
......@@ -16,9 +16,9 @@ class _MainScreenState extends State<MainScreen> {
List<Widget> _widgetOptions = <Widget>[
HomeKYC(),
HomeKYC(),
DetailTransactionPembelian(),
Transaction(),
HomeKYC(),
Akun(),
ProfilBasePage(),
];
@override
......
import 'package:flutter/material.dart';
import 'package:fundex_app/pages/business/prospectus_page.dart';
import 'package:fundex_app/pages/register/register.dart';
void main() {
runApp(MaterialApp(home: ProspectusPage()));
......
// To parse this JSON data, do
//
// final user = userFromJson(jsonString);
import 'dart:convert';
User userFromJson(String str) => User.fromJson(json.decode(str));
String userToJson(User data) => json.encode(data.toJson());
class User {
User({
this.email,
this.password,
this.role,
this.isCompany,
});
String email;
String password;
String role;
bool isCompany;
factory User.fromJson(Map<String, dynamic> json) => User(
email: json["email"],
password: json["password"],
role: json["role"],
isCompany: json["is_company"],
);
Map<String, dynamic> toJson() => {