Fakultas Ilmu Komputer UI

Commit 3be07ef0 authored by Fakhira Devina's avatar Fakhira Devina
Browse files

Merge branch 'dev-agnes' into PBI-5-daftar_layanan_fasilitas_publik

parents bbce47bc 93299b55
{"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-03-28 21:53:45.371259","version":"1.15.17"}
\ No newline at end of file
<<<<<<< HEAD
{"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-03-28 21:53:45.371259","version":"1.15.17"}
=======
{"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":[]}],"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":[]}],"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":[]}],"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":[]}],"date_created":"2020-04-06 23:54:02.345091","version":"1.15.17"}
>>>>>>> dev-agnes
......@@ -33,11 +33,9 @@ class LokasiResponseBloc {
try {
LokasiListResponse lokasiListResponse =
await _lokasiRepository.fetchLokasi();
print("lokasi list response: $lokasiListResponse");
lokasiListSink.add(NetworkModel.completed(lokasiListResponse));
} catch (e) {
lokasiListSink.add(NetworkModel.error(e.toString()));
print("$e");
}
}
......@@ -45,11 +43,9 @@ class LokasiResponseBloc {
recentSearchSink.add(NetworkModel.loading('Getting Recent Search'));
try {
LokasiListResponse recentSearchData = await _lokasiRepository.fetchRecentSearch();
print("recentSearchData ${recentSearchData.listLokasi}");
recentSearchSink.add(NetworkModel.completed(recentSearchData));
} catch (e) {
recentSearchSink.add(NetworkModel.error(e.toString()));
print("line 53 ${e.toString()}");
}
}
......
import 'package:flutter/material.dart';
final Color greenPrimary = Color(0xff3A903A);
final Color greenPale = Color(0xff4FBA4F);
final Color redPrimary = Color(0xffC60000);
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;
......
......@@ -72,7 +72,7 @@ class CookiesInterface {
} else {
currentSearchHistory = json.decode(cookie);
}
currentSearchHistory.add(recentSearch);
currentSearchHistory.insert(0, recentSearch);
});
} else {
currentSearchHistory = [];
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/insideFilter.dart';
class Filter extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Filter',
theme: ThemeData(
primarySwatch: Colors.green,
),
//home: new Icon(Icons.filter_list),
home: MyHomePage(title: 'Filter Informasi'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
AnimationController controller;
Animation<Offset> offset;
// final _controller = new PageController();
// static const _kDuration = const Duration(milliseconds: 300);
// static const _kCurve = Curves.ease;
// final _kArrowColor = Colors.black.withOpacity(0.8);
@override
void initState() {
super.initState();
controller =
AnimationController(vsync: this, duration: Duration(seconds: 1));
offset = Tween<Offset>(begin: Offset.zero, end: Offset(0.0, 1.0))
.animate(controller);
}
bool showUrutan = true;
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
key: Key("tambah informasi"),
title: Text(widget.title),
),
body: Align(
heightFactor: 150,
alignment: Alignment.bottomCenter,
child: SlideTransition(
position: offset,
child: Container(
// margin: EdgeInsets.all(25.0),
child: InsideFilter(),
),
),
),
floatingActionButton: FloatingActionButton(
key: Key("button"),
onPressed: () {
switch (controller.status) {
case AnimationStatus.completed:
controller.reverse();
break;
case AnimationStatus.dismissed:
controller.forward();
break;
default:
}
},
child: Icon(Icons.filter_list),
),
);
}
}
This diff is collapsed.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/bloc/LokasiResponseBloc.dart';
import 'package:ppl_disabilitas/config/styles.dart';
......@@ -5,19 +6,58 @@ import 'package:ppl_disabilitas/model/lokasi.dart';
import 'package:ppl_disabilitas/network/data/network_model.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/fasilitas.dart';
/// Create Pencarian page widget with a state
class Pencarian extends StatefulWidget {
@override
PencarianState createState() => PencarianState();
}
/// State of Pencacrian page
class PencarianState extends State<Pencarian> {
/// Controller for textFormField
TextEditingController myController = TextEditingController();
/// Search Icon for textFormField
Icon searchIcon = Icon(Icons.search);
Widget appBarText = Text("Pencarian Lokasi");
/// Text for appbar
Widget appBarText = Text('Pencarian Lokasi');
/// List of places currently searched on the textFormField
List<Lokasi> currentSearch = [];
/// List for places from API
List<Lokasi> places = [];
/// BLoC for pencarian
LokasiResponseBloc _bloc = LokasiResponseBloc();
LokasiListResponse lokasiFromApi;
LokasiListResponse recentSearch;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty<List>('places', places))
..add(DiagnosticsProperty<List>('currentSearch', currentSearch));
}
@override
void initState() {
myController.addListener(() {
List<Lokasi> tempList = [];
for (int i = 0; i < places.length; i++) {
if (myController.text.isNotEmpty) {
if (places[i]
.nama
.toLowerCase()
.contains(myController.text.toLowerCase())) {
tempList.add(places[i]);
}
}
}
setState(() {
currentSearch = tempList;
});
});
super.initState();
}
......@@ -28,7 +68,7 @@ class PencarianState extends State<Pencarian> {
backgroundColor: greenPrimary,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios, size: 25),
key: Key("Back Icon Key"),
key: Key('Back Icon Key'),
onPressed: () => Navigator.pop(context, 'Take me back')),
title: Container(
margin: EdgeInsets.only(top: doubleSpace, bottom: doubleSpace),
......@@ -37,7 +77,8 @@ class PencarianState extends State<Pencarian> {
borderRadius: doubleBorderRadius,
boxShadow: regularShadow),
child: TextFormField(
key: Key("Text Field Mau Kemana"),
controller: myController,
key: Key('Text Field Mau Kemana'),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
isDense: false,
......@@ -55,12 +96,13 @@ class PencarianState extends State<Pencarian> {
fontFamily: 'Muli',
fontWeight: FontWeight.w700),
suffixIcon: IconButton(
icon: Icon(
Icons.mic,
color: greenPrimary,
size: 25,
),
onPressed: () {})),
icon: Icon(
Icons.mic,
color: greenPrimary,
size: 25,
),
onPressed: () {},
)),
),
),
),
......@@ -80,13 +122,14 @@ class PencarianState extends State<Pencarian> {
);
break;
case Status.COMPLETED:
recentSearch = snapshot.data.data;
final recentSearch = snapshot.data.data;
Widget displayWidget;
if (recentSearch.listLokasi.isEmpty) {
displayWidget = Center(
child: Text("Anda belum pernah melakukan pencarian"));
} else {
displayWidget = makeLokasiWidget("history", recentSearch);
displayWidget = makeLokasiWidget(
"history", recentSearch.listLokasi.take(3).toList());
}
return Expanded(
child: Column(
......@@ -131,9 +174,12 @@ class PencarianState extends State<Pencarian> {
);
break;
case Status.COMPLETED:
lokasiFromApi = snapshot.data.data;
places = snapshot.data.data.listLokasi;
return Expanded(
flex: 2, child: makeLokasiWidget("api", lokasiFromApi));
flex: 2,
child: currentSearch.isEmpty
? Center(child: Text('Cari lokasi'))
: makeLokasiWidget("api", currentSearch));
break;
case Status.ERROR:
return Center(
......@@ -150,23 +196,17 @@ class PencarianState extends State<Pencarian> {
);
}
Widget makeLokasiWidget(String key, LokasiListResponse places) {
Widget makeLokasiWidget(String key, List<Lokasi> places) {
print('$key - $places');
return ListView.builder(
shrinkWrap: true,
itemCount: places.listLokasi.length,
itemCount: places.length,
itemBuilder: (context, index) {
print('${places.listLokasi[index].telepon == null}');
return InkWell(
key: Key("$key-${places.listLokasi[index].nama}"),
key: Key("$key-${places[index].nama}"),
onTap: () {
_bloc.saveRecentSearch(places.listLokasi[index]);
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => Fasilitas(
alamat: places.listLokasi[index].alamat,
nama: places.listLokasi[index].nama,
telpon: places.listLokasi[index].telepon,
url: 'http://dummyimage.com/128x141.png/ff4444/ffffff',
)));
_bloc.saveRecentSearch(places[index]);
},
child: Container(
decoration: BoxDecoration(
......@@ -191,7 +231,7 @@ class PencarianState extends State<Pencarian> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
places.listLokasi[index].nama,
places[index].nama,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w800,
......@@ -200,7 +240,7 @@ class PencarianState extends State<Pencarian> {
),
),
Text(
places.listLokasi[index].alamat,
places[index].alamat,
style: TextStyle(
fontSize: 15,
color: Colors.black,
......
......@@ -27,7 +27,6 @@ class LokasiRepository {
.getCookieFile(fileName: "searchhistory")
.then((cookie) {
response = json.decode(cookie);
print("response type: ${response.runtimeType}");
});
}
});
......
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/filter.dart';
void main() {
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(Filter());
// inside filter
expect(find.byType(Container), findsNWidgets(21));
expect(find.byType(Row), findsNWidgets(12));
expect(find.byType(Column), findsNWidgets(2));
expect(find.byType(Text), findsNWidgets(14));
expect(find.byType(Flex), findsNothing);
expect(find.text('jns fasilitas'), findsNothing);
expect(find.text('urutn'), findsNothing);
expect(find.text('hps smw'), findsNothing);
// filter
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Icon), findsNWidgets(2));
});
}
......@@ -36,7 +36,6 @@ void main() {
});
});
testWidgets('display list view in pencarian', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(MaterialApp(home: Pencarian()));
// [TODO] pencet textfieldnya, isi textfieldnya pake Coolidge
// [TODO] expect nya keluar satu item namanya coolidge, expectnya pake key aja
......@@ -53,4 +52,13 @@ void main() {
expect(find.byKey(textFieldKey), findsOneWidget);
});
testWidgets('test textfield result', (WidgetTester tester) async {
final textFieldKey = Key("Text Field Mau Kemana");
await tester.pumpWidget(MaterialApp(home: Pencarian()));
await tester.enterText(find.byKey(textFieldKey), 'Mallory');
await tester.pump();
expect(find.text('Mallory'), findsOneWidget);
});
}
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