Fakultas Ilmu Komputer UI

Commit a1ca60b8 authored by Bayukanta Iqbal Gunawan's avatar Bayukanta Iqbal Gunawan
Browse files

[CHORES] tarik file staging ke pbi-4

parents 7997ad24 874191e1
Pipeline #42350 failed with stages
in 14 minutes and 23 seconds
{"_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":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]}]}
\ No newline at end of file
{"_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":"image_picker","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
......@@ -287,3 +287,7 @@ modules.xml
.venv/
# End of https://www.gitignore.io/api/linux,django,python,pycharm+all
tests.output
.flutter-plugins-dependencies
......@@ -22,8 +22,8 @@ Lint:
Test:
stage: test
script:
- flutter test --machine > tests.output
- flutter test --coverage
- flutter test --machine > tests.output
- lcov --summary coverage/lcov.info
- genhtml coverage/lcov.info --output=coverage
artifacts:
......@@ -41,9 +41,6 @@ Sonarqube:
- flutter pub get
script:
- sonar-scanner -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.branch.name=$CI_COMMIT_REF_NAME -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -X
only:
- master
- staging
DeployToProduction:
......
......@@ -50,4 +50,17 @@ MAPS_API_KEY=Bu***************
Run the app using the development flavor
```bash
flutter run -t lib/main_dev.dart
```
\ No newline at end of file
```
## Building Models with JsonSerializable
Jadi abis get dari API, jsonnya di map ke models biar rapih.
1. Tulis ada field apa aja dari jsonnya (bisa liat contoh yang di models/lokasi.dart)
2. bagian 'part of {nama models}.g.dart' itu harus ditulis di model yg mau dibuat. di awal emang merah, tapi biarin aja
3. kalo semua field udah di tulis, run
```bash
flutter pub run build_runner build
```
4. nanti akan ke build file {nama models}.g.dart, yang di nomor 2 merah harusnya udah gak merah lagi
## Passing Data with BLoC
Udah ada contohnya di /bloc (implementasi di screen nya ada di page/pencarian/pencarian.dart)
Bisa baca [disini]https://itnext.io/flutter-handling-your-network-api-calls-like-a-boss-936eef296547 sebagai panduannya
\ No newline at end of file
include: package:pedantic/analysis_options.yaml
analyzer:
exclude:
- "**/*.g.dart"
\ No newline at end of file
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
......@@ -12,6 +12,7 @@ class BisaGo extends StatelessWidget {
backgroundColor: Colors.white,
),
home: Dashboard(),
//home: LayananDisabilitas(),
);
}
}
import 'dart:async';
import 'package:ppl_disabilitas/model/komentar.dart';
import 'package:ppl_disabilitas/network/data/network_model.dart';
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(String namaLokasi) {
_komentarListController = StreamController<NetworkModel<KomentarList>>();
_komentarRepository = KomentarRepository();
fetchKomentarList(namaLokasi);
}
fetchKomentarList(String namaLokasi) async {
komentarListSink.add(NetworkModel.loading('Getting Komentar'));
try {
KomentarList komentarListResponse =
await _komentarRepository.fetchKomentar(namaLokasi);
allKomentarFromApi = List.from(komentarListResponse.allKomentar);
komentarListSink.add(NetworkModel.completed(komentarListResponse));
} catch (e) {
komentarListSink.add(NetworkModel.error(e.toString()));
print("$e");
}
}
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(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 == 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)));
}
resetKomentarList() {
komentarListSink
.add(NetworkModel.completed(KomentarList(allKomentarFromApi)));
}
dispose() {
_komentarListController?.close();
}
}
import 'dart:async';
import 'package:ppl_disabilitas/model/lokasi.dart';
import 'package:ppl_disabilitas/network/data/network_model.dart';
import 'package:ppl_disabilitas/repository/LokasiRepository.dart';
class LokasiResponseBloc {
StreamController _recentSearchController;
LokasiRepository _lokasiRepository;
StreamController _lokasiListController;
StreamSink<NetworkModel<LokasiListResponse>> get recentSearchSink =>
_recentSearchController.sink;
Stream<NetworkModel<LokasiListResponse>> get recentSearchStream =>
_recentSearchController.stream;
StreamSink<NetworkModel<LokasiListResponse>> get lokasiListSink =>
_lokasiListController.sink;
Stream<NetworkModel<LokasiListResponse>> get lokasiListStream =>
_lokasiListController.stream;
LokasiResponseBloc() {
_lokasiListController =
StreamController<NetworkModel<LokasiListResponse>>();
_recentSearchController = StreamController<NetworkModel<LokasiListResponse>>();
_lokasiRepository = LokasiRepository();
fetchLokasiList();
fetchRecentSearch();
}
fetchLokasiList() async {
lokasiListSink.add(NetworkModel.loading('Getting Locations'));
try {
final lokasiListResponse =
await _lokasiRepository.fetchLokasi();
lokasiListSink.add(NetworkModel.completed(lokasiListResponse));
} catch (e) {
lokasiListSink.add(NetworkModel.error(e.toString()));
}
}
fetchRecentSearch() async {
recentSearchSink.add(NetworkModel.loading('Getting Recent Search'));
try {
final recentSearchData = await _lokasiRepository.fetchRecentSearch();
recentSearchSink.add(NetworkModel.completed(recentSearchData));
} catch (e) {
recentSearchSink.add(NetworkModel.error(e.toString()));
}
}
saveRecentSearch(Lokasi search) async {
await _lokasiRepository.saveRecentSearch(search);
}
dispose() {
_recentSearchController?.close();
_lokasiListController?.close();
}
}
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
class ImageHolder extends StatelessWidget {
final String url;
ImageHolder({@required this.url});
@override
Widget build(BuildContext context) {
return CachedNetworkImage(
imageUrl: url,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(image: imageProvider, fit: BoxFit.fill)),
),
placeholder: (context, _) =>
const Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => Container(
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(
......@@ -82,10 +82,10 @@ class BisaGoDrawer extends StatelessWidget {
Navigator.pop(context);
},
),
decoration: new BoxDecoration(
decoration: BoxDecoration(
color: greenPrimary,
border: new Border(
bottom: new BorderSide(color: Colors.white),
border: Border(
bottom: BorderSide(color: Colors.white),
),
),
);
......
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),
),)
],
),
);
}
}
class CustomSerializer {
static DateTime stringToDateTime(String date) => DateTime.parse(date);
}
// 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 = "";
String sessionId = "";
setKey(String key) {
key = key;
setKey(String newKey) {
key = newKey;
}
setSessionId(String sessionId) {
sessionID = sessionId;
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 redPrimary = Color(0xffC60000);
final Color bluePrimary = Color(0xff537AC6);
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 smallSpace = 4.0;
final double regularSpace = 8.0;
final double doubleSpace = 16.0;
final double tripleSpace = 32.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(
blurRadius: 4,
color: Colors.black.withOpacity(0.25),
offset: Offset(0, 0))
color: Colors.black.withOpacity(0.25),
blurRadius: 7.0, // has the effect of softening the shadow
offset: Offset(
5.0, // horizontal, move right 10
5.0, // vertical, movesn down 10
),
)
];
final List<BoxShadow> smallShadow = [
BoxShadow(
color: Colors.black.withOpacity(0.25),
blurRadius: 2.0, // has the effect of softening the shadow
offset: Offset(
1.5, // horizontal, move right 10
1.5, // vertical, move down 10
),
)
];
final BorderRadius regularBorderRadius = BorderRadius.circular(10);
final BorderRadius doubleBorderRadius = BorderRadius.circular(20);
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/app.dart';
import 'flavor/flavor.dart';
void main() {
ApiFlavor.flavor = BuildFlavor.production.toString();
runApp(BisaGo());
}
import 'package:json_annotation/json_annotation.dart';
part 'komentar.g.dart';
@JsonSerializable()
class KomentarList {
final List<KomentarModel> allKomentar;
KomentarList(this.allKomentar);
}
@JsonSerializable()
class KomentarModel {
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_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);
Map<String, dynamic> toJson() => _$KomentarModelToJson(this);
}
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