Fakultas Ilmu Komputer UI

Commit 23def66f authored by Agnes Handoko's avatar Agnes Handoko
Browse files

[REFACTOR] refactor some duplications after merge request

parents e532a4c5 1cded1bc
Pipeline #40963 passed with stages
in 6 minutes and 10 seconds
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/dashboard/dashboard.dart';
//import 'package:ppl_disabilitas/page/informasi/layananDisabilitas.dart';
//import 'package:ppl_disabilitas/page/filter & fasilitas/fasilitas.dart';
class BisaGo extends StatelessWidget {
@override
......
......@@ -16,15 +16,16 @@ class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
title,
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),
),
)
],
),
);
......
......@@ -98,4 +98,4 @@ class CookiesInterface {
}
return res;
}
}
}
\ No newline at end of file
......@@ -227,13 +227,13 @@ class _ListSekolahState extends State<ListSekolah> {
splashColor: Colors.green[400],
highlightColor: Colors.green[400],
onTap: () => setStateModal(() {
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = true;
showKategoriSekolah = false;
showTingkatSekolah = false;
})),
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = true;
showKategoriSekolah = false;
showTingkatSekolah = false;
})),
Container(
decoration: BoxDecoration(
border: Border(
......@@ -262,13 +262,13 @@ class _ListSekolahState extends State<ListSekolah> {
splashColor: Colors.green[400],
highlightColor: Colors.green[400],
onTap: () => setStateModal(() {
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = false;
showKategoriSekolah = true;
showTingkatSekolah = false;
})),
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = false;
showKategoriSekolah = true;
showTingkatSekolah = false;
})),
Container(
decoration: BoxDecoration(
border: Border(
......@@ -297,13 +297,13 @@ class _ListSekolahState extends State<ListSekolah> {
splashColor: Colors.green[400],
highlightColor: Colors.green[400],
onTap: () => setStateModal(() {
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = false;
showKategoriSekolah = false;
showTingkatSekolah = true;
})),
print("yes");
showProvinsi = false;
showKota = false;
showKecamatan = false;
showKategoriSekolah = false;
showTingkatSekolah = true;
})),
Container(
decoration: BoxDecoration(
border: Border(
......@@ -339,8 +339,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -359,7 +358,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -367,8 +366,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -394,7 +392,7 @@ class _ListSekolahState extends State<ListSekolah> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -402,8 +400,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -422,7 +419,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -430,8 +427,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -457,7 +453,7 @@ class _ListSekolahState extends State<ListSekolah> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -465,8 +461,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -485,7 +480,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -493,8 +488,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -520,7 +514,7 @@ class _ListSekolahState extends State<ListSekolah> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -528,8 +522,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: inklusi,
onChanged: (bool value) {
setStateModal(() {
......@@ -548,7 +541,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -556,8 +549,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: luarBiasa,
onChanged: (bool value) {
setStateModal(() {
......@@ -583,7 +575,7 @@ class _ListSekolahState extends State<ListSekolah> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -591,8 +583,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......@@ -611,7 +602,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -619,8 +610,7 @@ class _ListSekolahState extends State<ListSekolah> {
),
child: Checkbox(
checkColor: greenPrimary,
activeColor:
greenPale,
activeColor: greenPale,
value: jawaTengah,
onChanged: (bool value) {
setStateModal(() {
......
......@@ -9,7 +9,8 @@ class LokasiRepository {
final _cookie = CookiesInterface();
Future<LokasiListResponse> fetchLokasi() async {
final response = await _network.get(
url: 'http://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/list/',
url:
'http://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/list/',
isLogin: false);
return LokasiListResponse(
response.map<Lokasi>((lokasi) => Lokasi.fromJson(lokasi)).toList());
......@@ -27,7 +28,7 @@ class LokasiRepository {
await _cookie.getCookieFile(fileName: "searchhistory").then((cookie) {
response = json.decode(cookie);
});
} on Exception{
} on Exception {
response = [];
}
}
......
......@@ -15,11 +15,6 @@ void main() {
return MediaQuery(data: MediaQueryData(), child: MaterialApp(home: widget));
}
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(buildTestableWidget(ListSekolah()));
});
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(buildTestableWidget(ListSekolah()));
......@@ -37,6 +32,5 @@ void main() {
expect(find.byType(Icon), findsNWidgets(3));
await tester.tap(find.byKey(Key('Scaffold Text Field')));
await tester.pump();
});
}
......@@ -5,7 +5,6 @@
// 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 'dart:io';
import 'package:flutter/material.dart';
......@@ -20,19 +19,18 @@ void main() {
MockNetwork mockNetwork;
setUp(() {
mockNetwork = MockNetwork();
when(mockNetwork.get(isLogin: false, url: anyNamed('url'))).thenAnswer((_) async {
when(mockNetwork.get(isLogin: false, url: anyNamed('url')))
.thenAnswer((_) async {
await Future.delayed(Duration(milliseconds: 50));
return Future<dynamic>.value(
[
{
"nama": "Coolidge",
"latitude": -23.7169139,
"longitude": -46.8498038,
"alamat": "74809 Hooker Drive",
"telepon": "+55 956 836 5799"
}
]
);
return Future<dynamic>.value([
{
"nama": "Coolidge",
"latitude": -23.7169139,
"longitude": -46.8498038,
"alamat": "74809 Hooker Drive",
"telepon": "+55 956 836 5799"
}
]);
});
});
testWidgets('display list view in pencarian', (WidgetTester tester) async {
......@@ -40,7 +38,8 @@ void main() {
expect(find.byKey(const Key("Text Field Mau Kemana")), findsOneWidget);
//var textField = find.byKey(const Key("Text Field Mau Kemana"));
//await tester.tap(textField);
await tester.enterText(find.byKey(const Key("Text Field Mau Kemana")), "Coolidge");
await tester.enterText(
find.byKey(const Key("Text Field Mau Kemana")), "Coolidge");
await tester.pump();
expect(find.text("Hasil Pencarian"), findsOneWidget);
......@@ -60,13 +59,11 @@ 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