Fakultas Ilmu Komputer UI

Commit 874191e1 authored by Fakhira Devina's avatar Fakhira Devina
Browse files

Merge branch 'coldfix' into 'staging'

Change sorting in fasilitas with radio button

See merge request !50
parents c8a475c6 9a782883
Pipeline #42095 passed with stages
in 25 minutes and 59 seconds
{"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"}
\ 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 21:59:20.942979","version":"1.15.17"}
\ No newline at end of file
......@@ -46,17 +46,17 @@ class KomentarBloc {
komentarListSink.add(NetworkModel.completed(KomentarList(currentList)));
}
sortKomentarList(String option, List<KomentarModel> currentList) {
if (option == 'latest') {
sortKomentarList(int option, List<KomentarModel> currentList) {
if (option == 0) {
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 {
} else if (option == 1) {
currentList.sort((next_komentar, prev_komentar) =>
(prev_komentar.like + prev_komentar.dislike)
.compareTo(next_komentar.like + next_komentar.dislike));
} else if (option == 2) {
currentList.sort((next_komentar, prev_komentar) =>
prev_komentar.like.compareTo(next_komentar.like));
}
komentarListSink.add(NetworkModel.completed(KomentarList(currentList)));
}
......
......@@ -8,6 +8,7 @@ import 'package:ppl_disabilitas/network/data/network_model.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/komentar.dart';
import 'package:ppl_disabilitas/model/komentar.dart';
class Fasilitas extends StatefulWidget {
final String nama;
final String alamat;
......@@ -33,9 +34,7 @@ class _FasilitasState extends State<Fasilitas> {
var tongkatVal = true;
var kursiDisabilitasVal = true;
var runningTextVal = true;
var komentarTerbaru = false;
var komentarRatingTertinggi = false;
var komentarTerpopuler = false;
var sortKomentar = -1;
var showUrutan = true;
var komentarStream;
List<KomentarModel> allKomentarFromApi;
......@@ -380,17 +379,16 @@ class _FasilitasState extends State<Fasilitas> {
data: Theme.of(context).copyWith(
unselectedWidgetColor: greenPrimary,
),
child: Checkbox(
checkColor: greenPrimary,
child: Radio(
value: 0,
groupValue: sortKomentar,
activeColor: greenPale,
value: komentarTerbaru,
onChanged: (bool value) {
if (value) {
onChanged: (sort) {
_bloc.sortKomentarList(
'latest', allKomentarFromApi);
}
sort, allKomentarFromApi);
setStateModal(() {
komentarTerbaru = value;
sortKomentar = sort;
});
},
),
......@@ -409,17 +407,16 @@ class _FasilitasState extends State<Fasilitas> {
data: Theme.of(context).copyWith(
unselectedWidgetColor: greenPrimary,
),
child: Checkbox(
checkColor: greenPrimary,
child: Radio(
value: 1,
groupValue: sortKomentar,
activeColor: greenPale,
value: komentarTerpopuler,
onChanged: (bool value) {
if (value) {
_bloc.sortKomentarList(
'popular', allKomentarFromApi);
}
onChanged: (sort) {
_bloc.sortKomentarList(
sort, allKomentarFromApi);
setStateModal(() {
komentarTerpopuler = value;
sortKomentar = sort;
});
},
),
......@@ -440,17 +437,16 @@ class _FasilitasState extends State<Fasilitas> {
data: Theme.of(context).copyWith(
unselectedWidgetColor: greenPrimary,
),
child: Checkbox(
checkColor: greenPrimary,
child: Radio(
value: 2,
groupValue: sortKomentar,
activeColor: greenPale,
value: komentarRatingTertinggi,
onChanged: (bool value) {
if (value) {
_bloc.sortKomentarList(
'rating', allKomentarFromApi);
}
onChanged: (sort) {
_bloc.sortKomentarList(
sort, allKomentarFromApi);
setStateModal(() {
komentarRatingTertinggi = value;
sortKomentar = sort;
});
},
),
......@@ -896,10 +892,7 @@ class _FasilitasState extends State<Fasilitas> {
tongkatVal = true;
kursiDisabilitasVal = true;
runningTextVal = true;
komentarTerbaru = false;
komentarRatingTertinggi = false;
komentarTerpopuler = false;
showUrutan = true;
sortKomentar = -1;
});
_bloc.resetKomentarList();
},
......@@ -937,10 +930,7 @@ class _FasilitasState extends State<Fasilitas> {
tongkatVal = true;
kursiDisabilitasVal = true;
runningTextVal = true;
komentarTerbaru = false;
komentarRatingTertinggi = false;
komentarTerpopuler = false;
showUrutan = true;
sortKomentar = -1;
super.dispose();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment