Fakultas Ilmu Komputer UI

Commit 2f14feb4 authored by Fakhira Devina's avatar Fakhira Devina
Browse files

[GREEN] detail post page

- still waiting for comment on postingan API and fix picture
parent f618dee9
{"_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-16 14:34:00.434107","version":"1.15.17"}
\ No newline at end of file
......@@ -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()));
......
......@@ -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(
......@@ -16,7 +18,7 @@ class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
"bisaGo",
title,
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
......
......@@ -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(
......
// 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 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 = 4.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(
......
......@@ -10,8 +10,8 @@ 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;
}
......@@ -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"];
......@@ -60,7 +60,7 @@ 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 {
if (available) {
......@@ -89,7 +89,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,7 +76,7 @@ class NetworkInterface {
dynamic _response(http.Response response) {
switch (response.statusCode) {
case 200:
var responseJson = json.decode(response.body.toString());
final responseJson = json.decode(response.body.toString());
return responseJson;
case 201:
var responseJson = json.decode(response.body.toString());
......
......@@ -14,7 +14,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 +25,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 +45,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) {
......@@ -73,13 +73,13 @@ class DashboardState extends State<Dashboard> {
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(
key: Key("Container Text Field"),
key: const Key("Container Text Field"),
margin: EdgeInsets.only(
left: doubleSpace, right: doubleSpace, top: doubleSpace),
decoration: BoxDecoration(
......@@ -88,7 +88,7 @@ class DashboardState extends State<Dashboard> {
boxShadow: regularShadow),
child: TextFormField(
enabled: false,
key: Key("Text Field Mau Kemana"),
key: const Key("Text Field Mau Kemana"),
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
......@@ -104,7 +104,7 @@ class DashboardState extends State<Dashboard> {
fontFamily: 'Muli',
fontWeight: FontWeight.w700),
suffixIcon: IconButton(
key: Key("IconButton Text Field"),
key: const Key("IconButton Text Field"),
icon: Icon(
Icons.mic,
color: greenPrimary,
......@@ -117,9 +117,9 @@ class DashboardState extends State<Dashboard> {
),
]),
appBar: PreferredSize(
preferredSize: Size.fromHeight(55),
preferredSize: const Size.fromHeight(55),
child: BisaGoAppBar(),
key: Key("Scaffold Text Field"),
key: const Key("Scaffold Text Field"),
),
);
}
......@@ -136,11 +136,11 @@ class DashboardState extends State<Dashboard> {
);
}
return Container(
key: Key("Container GoogleMap"),
key: const Key("Container GoogleMap"),
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: GoogleMap(
key: Key("Google Map"),
key: const Key("Google Map"),
markers: _markers,
mapType: MapType.normal,
initialCameraPosition: initialCameraPosition,
......@@ -151,12 +151,12 @@ class DashboardState extends State<Dashboard> {
);
}
void setSourceAndDestinationIcons() async {
setSourceAndDestinationIcons() async {
currentLocationIcon = await BitmapDescriptor.fromAssetImage(
ImageConfiguration(devicePixelRatio: 5), currentLocationIconAsset);
}
void updatePinOnMap() async {
updatePinOnMap() async {
CameraPosition cPosition = CameraPosition(
zoom: cameraZoom,
target: LatLng(currentLocation.latitude, currentLocation.longitude),
......@@ -174,7 +174,7 @@ class DashboardState extends State<Dashboard> {
});
}
void setInitialLocation() async {
setInitialLocation() async {
currentLocation = await location.getLocation();
}
}
......@@ -39,7 +39,7 @@ class _FasilitasState extends State<Fasilitas> {
_bloc = KomentarBloc(widget.nama);
super.initState();
}
@override
Widget build(BuildContext context) {
print('widget.telpon ${widget.url}');
......@@ -183,7 +183,6 @@ class _FasilitasState extends State<Fasilitas> {
],
),
),
// TODO change with komentar stream
StreamBuilder(
stream: _bloc.komentarListStream,
builder: (context, snapshot) {
......@@ -199,25 +198,12 @@ class _FasilitasState extends State<Fasilitas> {
break;
case Status.COMPLETED:
final komentar = snapshot.data.data;
print("IN FASILITAs");
print(komentar.allKomentar[0].deskripsi);
return ListView.builder(
shrinkWrap: true,
itemCount: komentar.allKomentar.length,
itemBuilder: (BuildContext context, int index) {
return Komentar(
dislike:
komentar.allKomentar[index].dislike,
komentar: komentar.allKomentar[index].deskripsi,
like: komentar.allKomentar[index].like,
tags:komentar.allKomentar[index].tag,
urlImage: [
komentar.allKomentar[index].image
],
user:
komentar.allKomentar[index].creator,
);
});
return Column(
children: komentar
.allKomentar.map<Widget>((k) => Komentar(
komentar: k,
))
.toList());
break;
case Status.ERROR:
return Center(
......@@ -240,7 +226,7 @@ class _FasilitasState extends State<Fasilitas> {
),
);
}
InsideFilter() {
return StatefulBuilder(
builder: (context, setStateModal) => Container(
......@@ -249,7 +235,7 @@ class _FasilitasState extends State<Fasilitas> {
boxShadow: regularShadow,
borderRadius: BorderRadius.all(
Radius.circular(10) // <--- border radius here
),
),
color: Colors.white,
),
child: Container(
......@@ -328,15 +314,15 @@ class _FasilitasState extends State<Fasilitas> {
splashColor: Colors.green[400],
highlightColor: Colors.green[400],
onTap: () => setStateModal(() {
print('no');
showUrutan = true;
})),
print('no');
showUrutan = true;
})),
Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: greenPrimary, width: 1.5),
)),
top: BorderSide(
color: greenPrimary, width: 1.5),
)),
),
InkWell(
child: Container(
......@@ -360,9 +346,9 @@ class _FasilitasState extends State<Fasilitas> {
splashColor: Colors.green[400],
highlightColor: Colors.green[400],
onTap: () => setStateModal(() {
print("yes");
showUrutan = false;
})),
print("yes");
showUrutan = false;
})),
Container(
decoration: BoxDecoration(
border: Border(
......@@ -390,7 +376,7 @@ class _FasilitasState extends State<Fasilitas> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -417,7 +403,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -445,12 +431,12 @@ class _FasilitasState extends State<Fasilitas> {
Container(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
unselectedWidgetColor:
greenPrimary,
greenPrimary,
),
child: Checkbox(
checkColor: Colors.red,
......@@ -483,7 +469,7 @@ class _FasilitasState extends State<Fasilitas> {
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -510,7 +496,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -537,7 +523,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -564,7 +550,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -591,7 +577,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -618,7 +604,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -645,7 +631,7 @@ class _FasilitasState extends State<Fasilitas> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(
......@@ -687,12 +673,12 @@ class _FasilitasState extends State<Fasilitas> {
Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: greenPrimary, width: 1.5),
)),
top: BorderSide(color: greenPrimary, width: 1.5),
)),
),
Container(
margin:
EdgeInsets.only(left: doubleSpace, right: doubleSpace),
EdgeInsets.only(left: doubleSpace, right: doubleSpace),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
......
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/strings.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/model/komentar.dart';
import 'package:ppl_disabilitas/page/filter_fasilitas/postingan/detailpost.dart';
class Komentar extends StatefulWidget {
final String user;
final int like;
final int dislike;
final List<String> urlImage;
final String komentar;
final List<String> tags;
final KomentarModel komentar;
Komentar(
{@required this.user,
@required this.like,
@required this.dislike,
@required this.urlImage,
@required this.komentar,
@required this.tags});
Komentar({@required this.komentar});
@override
_KomentarState createState() => _KomentarState();
}
......@@ -23,97 +15,106 @@ class Komentar extends StatefulWidget {
class _KomentarState extends State<Komentar> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: regularSpace),
padding: EdgeInsets.all(doubleSpace),
decoration: BoxDecoration(
boxShadow: regularShadow,
border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)),
borderRadius: BorderRadius.all(
Radius.circular(10) // <--- border radius here
),
color: Colors.white,
),
child: Column(
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: regularSpace),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.user,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w800,
color: Colors.black,
fontFamily: 'Muli',
return InkWell(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => DetailPostPage(
komentar: widget.komentar,
)));
},
child: Container(
margin: EdgeInsets.only(bottom: regularSpace),
padding: EdgeInsets.all(doubleSpace),
decoration: BoxDecoration(
boxShadow: regularShadow,
border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)),
borderRadius: BorderRadius.all(
Radius.circular(10) // <--- border radius here
),
color: Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: regularSpace),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
widget.komentar.creator,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w800,