Fakultas Ilmu Komputer UI

Commit cdb62534 authored by Usman Sidiq's avatar Usman Sidiq
Browse files

Merge branch 'PBI-3-registrasi_login' of...

Merge branch 'PBI-3-registrasi_login' of https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/dtb-beasiswa-miskin-dan-disabilitas/pplapangan-tembak-dtb-layanan-siswa-disabilitas into dev-sidiq
parents 91ff7a2d 719e66ac
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"sqflite","dependencies":[]}]}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-04-20 14:48:37.594917","version":"1.15.17"}
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/dashboard/dashboard.dart';
import 'package:ppl_disabilitas/page/login/login.dart';
import 'package:ppl_disabilitas/page/registrasi/registrasi.dart';
//import 'package:ppl_disabilitas/page/filter & fasilitas/fasilitas.dart';
class BisaGo extends StatelessWidget {
@override
......@@ -13,12 +10,8 @@ class BisaGo extends StatelessWidget {
fontFamily: 'Muli',
backgroundColor: Colors.white,
),
initialRoute: '/',
routes: {
'/': (context) => Dashboard(),
'/login': (context) => Login(),
'/register': (context) => Registrasi(),
},
home: Dashboard(),
//home: LayananDisabilitas(),
);
}
}
......@@ -7,23 +7,25 @@ import 'package:ppl_disabilitas/repository/KomentarRepository.dart';
class KomentarBloc {
KomentarRepository _komentarRepository;
StreamController _komentarListController;
List<KomentarModel> allKomentarFromApi;
StreamSink<NetworkModel<KomentarList>> get komentarListSink =>
_komentarListController.sink;
Stream<NetworkModel<KomentarList>> get komentarListStream =>
_komentarListController.stream;
KomentarBloc() {
KomentarBloc(String namaLokasi) {
_komentarListController = StreamController<NetworkModel<KomentarList>>();
_komentarRepository = KomentarRepository();
fetchKomentarList();
fetchKomentarList(namaLokasi);
}
fetchKomentarList() async {
fetchKomentarList(String namaLokasi) async {
komentarListSink.add(NetworkModel.loading('Getting Komentar'));
try {
KomentarList komentarListResponse =
await _komentarRepository.fetchKomentar();
await _komentarRepository.fetchKomentar(namaLokasi);
allKomentarFromApi = List.from(komentarListResponse.allKomentar);
komentarListSink.add(NetworkModel.completed(komentarListResponse));
} catch (e) {
komentarListSink.add(NetworkModel.error(e.toString()));
......@@ -31,6 +33,39 @@ class KomentarBloc {
}
}
filterKomentarList(String tag, bool value, List<KomentarModel> currentList) {
if (value) {
for (var komentar in allKomentarFromApi) {
if (komentar.tag.contains(tag)) {
currentList.add(komentar);
}
}
} else {
currentList.removeWhere((komentar) => komentar.tag.contains(tag));
}
komentarListSink.add(NetworkModel.completed(KomentarList(currentList)));
}
sortKomentarList(String option, List<KomentarModel> currentList) {
if (option == 'latest') {
currentList.sort((next_komentar, prev_komentar) =>
prev_komentar.date_time.compareTo(next_komentar.date_time));
} else if (option == 'rating') {
currentList.sort((next_komentar, prev_komentar) =>
prev_komentar.like.compareTo(next_komentar.like));
} else {
currentList.sort((next_komentar, prev_komentar) =>
(prev_komentar.like + prev_komentar.dislike)
.compareTo(next_komentar.like + next_komentar.dislike));
}
komentarListSink.add(NetworkModel.completed(KomentarList(currentList)));
}
resetKomentarList() {
komentarListSink
.add(NetworkModel.completed(KomentarList(allKomentarFromApi)));
}
dispose() {
_komentarListController?.close();
}
......
......@@ -31,7 +31,7 @@ class LokasiResponseBloc {
fetchLokasiList() async {
lokasiListSink.add(NetworkModel.loading('Getting Locations'));
try {
LokasiListResponse lokasiListResponse =
final lokasiListResponse =
await _lokasiRepository.fetchLokasi();
lokasiListSink.add(NetworkModel.completed(lokasiListResponse));
} catch (e) {
......@@ -42,7 +42,7 @@ class LokasiResponseBloc {
fetchRecentSearch() async {
recentSearchSink.add(NetworkModel.loading('Getting Recent Search'));
try {
LokasiListResponse recentSearchData = await _lokasiRepository.fetchRecentSearch();
final recentSearchData = await _lokasiRepository.fetchRecentSearch();
recentSearchSink.add(NetworkModel.completed(recentSearchData));
} catch (e) {
recentSearchSink.add(NetworkModel.error(e.toString()));
......
......@@ -16,10 +16,7 @@ class ImageHolder extends StatelessWidget {
placeholder: (context, _) =>
const Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/margocity.png'),
fit: BoxFit.scaleDown)),
child: Center(child: Text('Failed to load images'),),
),
);
}
......
......@@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/styles.dart';
class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
BisaGoAppBar({this.title = 'bisaGo', Key key}) : super(key: key);
@override
final Size preferredSize = Size.fromHeight(55);
final Size preferredSize = const Size.fromHeight(55);
@override
Widget build(BuildContext context) {
return AppBar(
......@@ -14,15 +16,16 @@ class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
"bisaGo",
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),)
Padding(
padding: EdgeInsets.all(doubleSpace),
child: Text(
title,
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),
)
],
),
);
......
......@@ -11,11 +11,11 @@ class BisaGoDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<Widget> menus = drawerList.map((menu) {
final menus = drawerList.map((menu) {
return _createListTile(
context: context, icon: menu['icon'], title: menu['title']);
}).toList();
List<Widget> drawerItem = [
final drawerItem = [
Container(
height: 130,
child: DrawerHeader(
......
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/styles.dart';
class InformasiSekolahAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
final Size preferredSize = Size.fromHeight(55);
@override
Widget build(BuildContext context) {
return AppBar(
elevation: 15,
centerTitle: true,
backgroundColor: greenPrimary,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios, size: 20),
key: Key('Back Icon Key'),
onPressed: () => Navigator.pop(context, 'Take me back')),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
"Informasi Sekolah",
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),)
],
),
);
}
}
// Frequently used strings are stored here
// No hardcoding string view files. Store here.
final String devBaseURL = "poipole.herokuapp.com";
final String baseURL = "poipole.herokuapp.com";
const String devBaseURL = "poipole.herokuapp.com";
const String baseURL = "poipole.herokuapp.com";
String key = "";
String csrf = "";
String sessionId = "";
......@@ -13,4 +13,24 @@ setKey(String newKey) {
setSessionId(String newSessionId) {
sessionId = newSessionId;
}
final tags = {
'KR': 'kursiroda',
'LF': 'liftdisabilitas',
'TD': 'toiletdisabilitas',
'MM': 'masjid',
'GB': 'guidingblock',
'BM': 'bidangmiring',
'CP': 'temandisabilitas',
'JI': 'jurubahasaisyarat',
'TN': 'tongkatdisabilitasnetra',
'KD': 'kursiumumdisabilitas',
'PK': 'tempatparkirdisabilitas',
'RT': 'runningtext',
'TB': 'tempatparkirbiasa'
};
getTag(String tag) {
return tags[tag];
}
\ No newline at end of file
import 'package:flutter/material.dart';
final Color greenPrimary = Color(0xff3A903A);
final Color greenPale = Color(0xff4FBA4F);
final Color redPrimary = Color(0xffC60000);
const Color white = Color(0xffFFFFFF);
const Color greenPrimary = Color(0xff3A903A);
const Color greenPale = Color(0xff4FBA4F);
const Color redPrimary = Color(0xffC60000);
const Color grayPrimary = Color(0xff645C5C);
final double superSmallSpace = 4.0;
final double smallSpace = 4.0;
final double regularSpace = 8.0;
final double regularBiggerSpace = 12.0;
final double doubleSpace = 16.0;
final double tripleSpace = 32.0;
final double spaceFourty = 45.0;
final double quartetSpace = 64.0;
final double spaceFourtyEight = 48.0;
const double superSmallSpace = 2.0;
const double smallSpace = 4.0;
const double regularSpace = 8.0;
const double regularBiggerSpace = 12.0;
const double doubleSpace = 16.0;
const double tripleSpace = 32.0;
const double spaceFourty = 45.0;
const double quartetSpace = 64.0;
const double spaceFourtyEight = 48.0;
final List<BoxShadow> regularShadow = [
BoxShadow(
......
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/app.dart';
import 'flavor/flavor.dart';
void main() {
ApiFlavor.flavor = BuildFlavor.production.toString();
runApp(BisaGo());
}
......@@ -10,13 +10,20 @@ class KomentarList {
@JsonSerializable()
class KomentarModel {
final String nama_orang;
final int suka;
final int tidak_suka;
final String foto;
final String nama_lokasi;
final String deskripsi;
final String creator;
final DateTime date_time;
final int like;
final int dislike;
final int rating;
final List<String> tag;
final String image;
final bool is_verified;
KomentarModel(
{this.nama_orang, this.suka, this.tidak_suka, this.foto});
{this.nama_lokasi, this.deskripsi, this.creator, this.date_time,
this.like, this.dislike, this.rating, this.tag, this.image, this.is_verified});
factory KomentarModel.fromJson(Map<String, dynamic> json) => _$KomentarModelFromJson(json);
......
......@@ -23,17 +23,31 @@ Map<String, dynamic> _$KomentarListToJson(KomentarList instance) =>
KomentarModel _$KomentarModelFromJson(Map<String, dynamic> json) {
return KomentarModel(
nama_orang: json['nama_orang'] as String,
suka: json['suka'] as int,
tidak_suka: json['tidak_suka'] as int,
foto: json['foto'] as String,
nama_lokasi: json['nama_lokasi'] as String,
deskripsi: json['deskripsi'] as String,
creator: json['creator'] as String,
date_time: json['date_time'] == null
? null
: DateTime.parse(json['date_time'] as String),
like: json['like'] as int,
dislike: json['dislike'] as int,
rating: json['rating'] as int,
tag: (json['tag'] as List)?.map((e) => e as String)?.toList(),
image: json['image'] as String,
is_verified: json['is_verified'] as bool,
);
}
Map<String, dynamic> _$KomentarModelToJson(KomentarModel instance) =>
<String, dynamic>{
'nama_orang': instance.nama_orang,
'suka': instance.suka,
'tidak_suka': instance.tidak_suka,
'foto': instance.foto,
'nama_lokasi': instance.nama_lokasi,
'deskripsi': instance.deskripsi,
'creator': instance.creator,
'date_time': instance.date_time?.toIso8601String(),
'like': instance.like,
'dislike': instance.dislike,
'rating': instance.rating,
'tag': instance.tag,
'image': instance.image,
'is_verified': instance.is_verified,
};
......@@ -9,12 +9,13 @@ class LokasiListResponse {
@JsonSerializable(nullable: true)
class Lokasi {
String nama;
int id;
String name;
double latitude;
double longitude;
String alamat;
String foto;
String telepon;
String image;
String no_telp;
Lokasi();
......
......@@ -22,19 +22,21 @@ Map<String, dynamic> _$LokasiListResponseToJson(LokasiListResponse instance) =>
Lokasi _$LokasiFromJson(Map<String, dynamic> json) {
return Lokasi()
..nama = json['nama'] as String
..id = json['id'] as int
..name = json['name'] as String
..latitude = (json['latitude'] as num)?.toDouble()
..longitude = (json['longitude'] as num)?.toDouble()
..alamat = json['alamat'] as String
..foto = json['foto'] as String
..telepon = json['telepon'] as String;
..image = json['image'] as String
..no_telp = json['no_telp'] as String;
}
Map<String, dynamic> _$LokasiToJson(Lokasi instance) => <String, dynamic>{
'nama': instance.nama,
'id': instance.id,
'name': instance.name,
'latitude': instance.latitude,
'longitude': instance.longitude,
'alamat': instance.alamat,
'foto': instance.foto,
'telepon': instance.telepon,
'image': instance.image,
'no_telp': instance.no_telp,
};
......@@ -10,14 +10,14 @@ class CookiesInterface {
await getApplicationDocumentsDirectory().then((Directory directory) {
dir = directory;
});
File cookieFile = File("${dir.path}/$fileName.json");
bool cookiesExist = cookieFile.existsSync();
final cookieFile = File("${dir.path}/$fileName.json");
final cookiesExist = cookieFile.existsSync();
return cookiesExist;
}
Future<File> createSignInCookie({
Map<String, dynamic> responseHeaders}) async {
Future<File> createSignInCookie(
{Map<String, dynamic> responseHeaders}) async {
try {
String setCookie;
String csrfToken;
......@@ -29,7 +29,7 @@ class CookiesInterface {
await getApplicationDocumentsDirectory().then((Directory directory) {
dir = directory;
});
File cookieFile = File("${dir.path}/usercookies.json");
final cookieFile = File("${dir.path}/usercookies.json");
cookieFile.createSync();
setCookie = responseHeaders["set-cookie"];
......@@ -51,8 +51,8 @@ class CookiesInterface {
}
}
Future<File> createSearchHistoryCookie({
Map<String, dynamic> recentSearch}) async {
Future<File> createSearchHistoryCookie(
{Map<String, dynamic> recentSearch}) async {
print("recent searrch $recentSearch");
Directory dir;
List currentSearchHistory;
......@@ -60,9 +60,10 @@ class CookiesInterface {
await getApplicationDocumentsDirectory().then((Directory directory) {
dir = directory;
});
File cookieFile = File('${dir.path}/searchhistory.json');
final cookieFile = File('${dir.path}/searchhistory.json');
cookieFile.createSync();
await checkCookieFileAvailability(fileName: "searchhistory").then((available) async {
await checkCookieFileAvailability(fileName: "searchhistory")
.then((available) async {
if (available) {
await getCookieFile(fileName: "searchhistory").then((cookie) {
if (cookie == null) {
......@@ -70,7 +71,9 @@ class CookiesInterface {
} else {
currentSearchHistory = cookie == "" ? [] : json.decode(cookie);
}
currentSearchHistory.insert(0, recentSearch);
if (!currentSearchHistory.contains(recentSearch)) {
currentSearchHistory.insert(0, recentSearch);
}
});
} else {
currentSearchHistory = [];
......@@ -89,7 +92,7 @@ class CookiesInterface {
await getApplicationDocumentsDirectory().then((Directory directory) {
dir = directory;
});
File file = File("${dir.path}/$fileName.json");
final file = File("${dir.path}/$fileName.json");
dynamic res;
try {
res = file.readAsStringSync();
......
......@@ -7,13 +7,13 @@ class NetworkInterface {
//String key = KEY;
// POST request
Future<dynamic> post({
Future<dynamic> post( {
String url, //url nya apa
dynamic bodyParams, //data apa yang mau dikasih
bool isLogin, //dia login apa ngga
}) async {
var responseJson;
Map<String, String> headersJson =
final headersJson =
await _buildRequestHeader(isLogin); //butuh header apa ngga
try {
final response = await http.post(
......@@ -34,7 +34,7 @@ class NetworkInterface {
bool isLogin,
}) async {
var responseJson;
Map<String, dynamic> headersJson = await _buildRequestHeader(isLogin);
final headersJson = await _buildRequestHeader(isLogin);
try {
final response = await http.get(
"$url",
......@@ -76,6 +76,9 @@ class NetworkInterface {
dynamic _response(http.Response response) {
switch (response.statusCode) {
case 200:
final responseJson = json.decode(response.body.toString());
return responseJson;
case 201:
var responseJson = json.decode(response.body.toString());
return responseJson;
case 400:
......
......@@ -6,6 +6,7 @@ import 'package:ppl_disabilitas/component/bisago_appbar.dart';
import 'package:ppl_disabilitas/component/bisago_drawer.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/page/pencarian/pencarian.dart';
import 'package:ppl_disabilitas/page/informasi/layananDisabilitas.dart';
class Dashboard extends StatefulWidget {
DashboardState createState() => DashboardState();
......@@ -14,7 +15,7 @@ class Dashboard extends StatefulWidget {
class DashboardState extends State<Dashboard> {
final Completer<GoogleMapController> _controller = Completer();
final double cameraZoom = 16;
final LatLng defaultLocation = LatLng(-6.1753924, 106.8249641);
final LatLng defaultLocation = const LatLng(-6.1753924, 106.8249641);
final String currentLocationIconAsset = "assets/icon/current_loc.png";
Location location;
Set<Marker> _markers = Set<Marker>();
......@@ -25,7 +26,7 @@ class DashboardState extends State<Dashboard> {
Marker contohMarker = Marker(
markerId: MarkerId("contoh1"),
position: LatLng(-6.365474, 106.828157),
infoWindow: InfoWindow(title: "Fasilkom"),
infoWindow: const InfoWindow(title: "Fasilkom"),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueViolet,
),
......@@ -45,7 +46,7 @@ class DashboardState extends State<Dashboard> {
_markers.add(contohMarker);
}
void enableLocationService() async {
enableLocationService() async {
await location.changeSettings(accuracy: LocationAccuracy.HIGH);
_serviceEnabled = await location.serviceEnabled();
if (!_serviceEnabled) {
......@@ -63,23 +64,28 @@ class DashboardState extends State<Dashboard> {
}
}
void _navigateToPencarianPage(BuildContext context) {
void _navigateToPencarianPage(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Pencarian());
Navigator.of(context).push(route);
}
void _navigateToInformasiLayananDisabilitasPage(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => LayananDisabilitas());
Navigator.of(context).push(route);
}
static const textFieldKey = Key('Text Field Mau Kemana');
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: BisaGoDrawer(),
body: Stack(key: Key("Stack"),children: <Widget>[
body: Stack(key: const Key("Stack"), children: <Widget>[
_buildGoogleMap(context),
InkWell(
key: Key("Navigate to Pencarian"),
key: const Key("Navigate to Pencarian"),
onTap: () => _navigateToPencarianPage(context),
child: Container(