Fakultas Ilmu Komputer UI

Commit 26c635ba authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

Merge remote-tracking branch 'origin/PBI-12-info_kegiatan' into dev-ariq-PBI-10

parents 58259cda f9a04a8f
......@@ -6,4 +6,9 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
......@@ -8,7 +8,13 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:requestLegacyExternalStorage="true"
android:name="io.flutter.app.FlutterApplication"
android:label="bisaGo"
android:icon="@mipmap/launcher_icon">
......
......@@ -6,4 +6,9 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
......@@ -36,9 +36,9 @@ class KegiatanBloc {
}
Future<dynamic> addNewKegiatan(
Map<String, dynamic> newKegiatanData, String placeId) async {
Map<String, dynamic> newKegiatanData) async {
try {
return await _kegiatanRepository.createKegiatan(newKegiatanData, placeId);
return await _kegiatanRepository.createKegiatan(newKegiatanData);
} catch (e) {
return Response('Failed to register komentar', 400);
}
......
......@@ -2,6 +2,6 @@ import 'package:intl/intl.dart';
class CustomSerializer {
static DateTime stringToDateTime(String date) {
return DateFormat('dd-MM-yyyy hh:mm').parse(date);
return DateFormat('yyyy-MM-dd HH:mm').parse(date);
}
}
......@@ -99,6 +99,12 @@ const fasilitas = {
'TB': 'Tempat Parkir Biasa',
};
const zonaWaktu = [
'WIB',
'WITA',
'WIT',
];
String getTag(String tag) {
return tags[tag];
}
......@@ -13,34 +13,42 @@ class KegiatanList {
class KegiatanModel {
final int id;
@JsonKey(name: 'place_id')
final String placeId;
final String creator;
@JsonKey(name: 'creator_email')
final String creatorEmail;
String placeId;
String creator;
@JsonKey(name: 'nama_kegiatan')
final String namaKegiatan;
final String penyelenggara;
final String narahubung;
final String deskripsi;
String namaKegiatan;
String penyelenggara;
String deskripsi;
@JsonKey(name: 'nama_kontak')
String namaKontak;
@JsonKey(name: 'nomor_kontak')
String nomorKontak;
String links;
@JsonKey(name: 'time_start', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeStart;
DateTime timeStart;
@JsonKey(name: 'time_end', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeEnd;
List<String> image;
DateTime timeEnd;
@JsonKey(name: 'zona_waktu')
String zonaWaktu;
List<String> images;
KegiatanModel({
this.id,
this.placeId,
this.creator,
this.namaKegiatan,
this.penyelenggara,
this.narahubung,
this.deskripsi,
this.timeStart,
this.timeEnd,
this.image,
this.creatorEmail,
});
KegiatanModel(
{
this.id,
this.placeId,
this.creator,
this.namaKegiatan,
this.penyelenggara,
this.deskripsi,
this.namaKontak,
this.nomorKontak,
this.links,
this.timeStart,
this.timeEnd,
this.zonaWaktu,
this.images,
}
);
factory KegiatanModel.fromJson(Map<String, dynamic> json) =>
_$KegiatanModelFromJson(json);
......
......@@ -28,12 +28,14 @@ KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) {
creator: json['creator'] as String,
namaKegiatan: json['nama_kegiatan'] as String,
penyelenggara: json['penyelenggara'] as String,
narahubung: json['narahubung'] as String,
deskripsi: json['deskripsi'] as String,
namaKontak: json['nama_kontak'] as String,
nomorKontak: json['nomor_kontak'] as String,
links: json['links'] as String,
timeStart: CustomSerializer.stringToDateTime(json['time_start'] as String),
timeEnd: CustomSerializer.stringToDateTime(json['time_end'] as String),
image: (json['image'] as List)?.map((e) => e as String)?.toList(),
creatorEmail: json['creator_email'] as String,
zonaWaktu: json['zona_waktu'] as String,
images: (json['images'] as List)?.map((e) => e as String)?.toList(),
);
}
......@@ -42,12 +44,14 @@ Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) =>
'id': instance.id,
'place_id': instance.placeId,
'creator': instance.creator,
'creator_email': instance.creatorEmail,
'nama_kegiatan': instance.namaKegiatan,
'penyelenggara': instance.penyelenggara,
'narahubung': instance.narahubung,
'deskripsi': instance.deskripsi,
'nama_kontak': instance.namaKontak,
'nomor_kontak': instance.nomorKontak,
'links': instance.links,
'time_start': instance.timeStart?.toIso8601String(),
'time_end': instance.timeEnd?.toIso8601String(),
'image': instance.image,
'zona_waktu': instance.zonaWaktu,
'images': instance.images,
};
import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:bisaGo/config/custom_serializer.dart';
part 'komentar_posting.g.dart';
......@@ -18,7 +18,7 @@ class KomentarPostingModel {
final String creatorEmail;
@JsonKey(name: 'creator_picture')
final String creatorPicture;
@JsonKey(fromJson: CustomSerializer.stringToDateTime)
@JsonKey(fromJson: _stringToDateTime)
final DateTime created;
KomentarPostingModel({
......@@ -35,3 +35,7 @@ class KomentarPostingModel {
Map<String, dynamic> toJson() => _$KomentarPostingModelToJson(this);
}
DateTime _stringToDateTime(String date) {
return DateFormat('dd-MM-yyyy hh:mm').parse(date);
}
......@@ -29,7 +29,7 @@ KomentarPostingModel _$KomentarPostingModelFromJson(Map<String, dynamic> json) {
creator: json['creator'] as String,
creatorEmail: json['creator_email'] as String,
creatorPicture: json['creator_picture'] as String,
created: CustomSerializer.stringToDateTime(json['created'] as String),
created: _stringToDateTime(json['created'] as String),
);
}
......
import 'package:intl/intl.dart';
import 'package:bisaGo/config/custom_serializer.dart';
import 'package:json_annotation/json_annotation.dart';
part 'komentar_posting_kegiatan.g.dart';
......@@ -18,7 +18,7 @@ class KomentarPostingKegiatanModel {
@JsonKey(name: 'creator_picture')
final String creatorPicture;
final String deskripsi;
@JsonKey(name: 'created', fromJson: _stringToDateTime)
@JsonKey(name: 'created', fromJson: CustomSerializer.stringToDateTime)
final DateTime created;
KomentarPostingKegiatanModel({
......@@ -35,7 +35,3 @@ class KomentarPostingKegiatanModel {
Map<String, dynamic> toJson() => _$KomentarPostingKegiatanModelToJson(this);
}
DateTime _stringToDateTime(String date) {
return DateFormat('yyy-MM-dd hh:mm').parse(date);
}
......@@ -422,7 +422,6 @@ class AddInformasiState extends State<AddInformasi> {
.asUint8List();
newKomentarData['image'] =
MultipartFile.fromBytes(bytes, filename: 'kursiroda.jpg');
print('Fasilitas null dalem addinfo adalah: ' + _jenisFasilitas);
break;
case 'LF':
var bytes =
......@@ -520,7 +519,6 @@ class AddInformasiState extends State<AddInformasi> {
.asUint8List();
newKomentarData['image'] =
MultipartFile.fromBytes(bytes, filename: 'defaultDisable.png');
print('Fasilitas null default addinfo adalah: ' + _jenisFasilitas);
break;
}
} else {
......
......@@ -447,20 +447,23 @@ class DashboardState extends State<Dashboard> {
..name = namaLokasi;
final fasilitasRoute = MaterialPageRoute(
builder: (BuildContext context) => DetailPostKegiatanPage(
lokasi: lokasi,
kegiatan: KegiatanModel(
id: kegiatan.id,
placeId: lokasi.placeId,
creator: kegiatan.creator,
namaKegiatan: kegiatan.namaKegiatan,
penyelenggara: kegiatan.penyelenggara,
narahubung: kegiatan.narahubung,
deskripsi: kegiatan.deskripsi,
timeStart: kegiatan.timeStart,
timeEnd: kegiatan.timeEnd,
image: kegiatan.image,
),
));
lokasi: lokasi,
kegiatan: KegiatanModel(
id: kegiatan.id,
placeId: lokasi.placeId,
creator: kegiatan.creator,
namaKegiatan: kegiatan.namaKegiatan,
penyelenggara: kegiatan.penyelenggara,
deskripsi: kegiatan.deskripsi,
namaKontak: kegiatan.namaKontak,
nomorKontak: kegiatan.nomorKontak,
links: kegiatan.links,
timeStart: kegiatan.timeStart,
timeEnd: kegiatan.timeEnd,
zonaWaktu: kegiatan.zonaWaktu,
images: kegiatan.images,
),
));
await Navigator.of(context).push(fasilitasRoute);
}
......
This diff is collapsed.
......@@ -29,7 +29,8 @@ class Fasilitas extends StatefulWidget {
_FasilitasState createState() => _FasilitasState();
}
class _FasilitasState extends State<Fasilitas> {
class _FasilitasState extends State<Fasilitas>
with AutomaticKeepAliveClientMixin<Fasilitas> {
var kursiRodaVal = true;
var liftVal = true;
var toiletDisabilitasVal = true;
......@@ -64,6 +65,7 @@ class _FasilitasState extends State<Fasilitas> {
@override
Widget build(BuildContext context) {
super.build(context);
return DefaultTabController(
length: 2,
child: Scaffold(
......@@ -506,4 +508,7 @@ class _FasilitasState extends State<Fasilitas> {
await _lokasiBloc.postSearchHistory(widget.lokasi.placeId, token);
}
}
@override
bool get wantKeepAlive => true;
}
......@@ -4,7 +4,6 @@ import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/page/filter_fasilitas/postingan/detail_post_kegiatan.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
// import 'package:bisaGo/component/image_holder.dart';
class Kegiatan extends StatefulWidget {
final Lokasi lokasi;
......@@ -17,28 +16,32 @@ class Kegiatan extends StatefulWidget {
}
class _KegiatanState extends State<Kegiatan> {
@override
Widget build(BuildContext context) {
return InkWell(
key: Key(widget.kegiatan.namaKegiatan),
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => DetailPostKegiatanPage(
lokasi: widget.lokasi,
kegiatan: KegiatanModel(
id: widget.kegiatan.id,
placeId: widget.kegiatan.placeId,
creator: widget.kegiatan.creator,
namaKegiatan: widget.kegiatan.namaKegiatan,
penyelenggara: widget.kegiatan.penyelenggara,
narahubung: widget.kegiatan.narahubung,
deskripsi: widget.kegiatan.deskripsi,
timeStart: widget.kegiatan.timeStart,
timeEnd: widget.kegiatan.timeEnd,
image: widget.kegiatan.image,
creatorEmail: widget.kegiatan.creatorEmail,
),
)));
lokasi: widget.lokasi,
kegiatan: KegiatanModel(
id: widget.kegiatan.id,
placeId: widget.kegiatan.placeId,
creator: widget.kegiatan.creator,
namaKegiatan: widget.kegiatan.namaKegiatan,
penyelenggara: widget.kegiatan.penyelenggara,
deskripsi: widget.kegiatan.deskripsi,
namaKontak: widget.kegiatan.namaKontak,
nomorKontak: widget.kegiatan.nomorKontak,
links: widget.kegiatan.links,
timeStart: widget.kegiatan.timeStart,
timeEnd: widget.kegiatan.timeEnd,
zonaWaktu: widget.kegiatan.zonaWaktu,
images: widget.kegiatan.images,
),
)
));
},
child: Container(
margin: const EdgeInsets.only(bottom: regularSpace),
......@@ -71,68 +74,59 @@ class _KegiatanState extends State<Kegiatan> {
),
),
Container(
margin: const EdgeInsets.only(bottom: regularSpace),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: 160,
child: CarouselSlider(
options: CarouselOptions(
aspectRatio: 1.0,
enlargeCenterPage: true,
enableInfiniteScroll: false,
initialPage: 0,
autoPlay: true,
),
items: widget.kegiatan.image
.map((item) => Container(
margin: const EdgeInsets.only(bottom: regularSpace),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: 160,
child: CarouselSlider(
options: CarouselOptions(
aspectRatio: 1.0,
enlargeCenterPage: true,
enableInfiniteScroll: false,
initialPage: 0,
autoPlay: true,
),
items: widget.kegiatan.images.map((item) => Container(
child: Container(
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20)),
child: Stack(
children: <Widget>[
Image.network(item, fit: BoxFit.cover, width: 1000.0),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(20)),
child: Stack(
children: <Widget>[
Image.network(item,
fit: BoxFit.cover,
width: 1000.0),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromARGB(
200, 0, 0, 0),
Color.fromARGB(
0, 0, 0, 0)
],
begin: Alignment
.bottomCenter,
end: Alignment.topCenter,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 20.0),
child: Text(
'#${widget.kegiatan.image.indexOf(item) + 1}',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontWeight:
FontWeight.bold,
),
),
),
),
],
)),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromARGB(200, 0, 0, 0),
Color.fromARGB(0, 0, 0, 0)
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
),
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
child: Text(
'#${widget.kegiatan.images.indexOf(item)+1}',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
))
.toList(),
),
)),
),
],
)
),
),
)).toList(),
),
)
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
......@@ -157,4 +151,4 @@ class _KegiatanState extends State<Kegiatan> {
),
));
}
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
class KegiatanImageView extends StatefulWidget {
final String url;
KegiatanImageView(this.url);
@override
_KegiatanImageView createState() => _KegiatanImageView(url);
}
class _KegiatanImageView extends State<KegiatanImageView> {
final String url;
_KegiatanImageView(this.url);
@override
Widget build(BuildContext context) {
return Scaffold(
body: PhotoView(
imageProvider: NetworkImage(url),
)
);
}
}
\ No newline at end of file
import 'package:bisaGo/component/bisago_appbar.dart';
import 'package:bisaGo/page/filter_fasilitas/kegiatan_image_view.dart';
import 'package:flutter/material.dart';
class KegiatanListImages extends StatefulWidget {
final List<String> urls;
final String namaKegiatan;
KegiatanListImages(this.urls, this.namaKegiatan);
@override
_KegiatanListImages createState() => _KegiatanListImages(urls, namaKegiatan);
}
class _KegiatanListImages extends State<KegiatanListImages> {
List<String> urls;
String namaKegiatan;
_KegiatanListImages(this.urls, this.namaKegiatan);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: BisaGoAppBar(
title: namaKegiatan,
),
body: Container(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 2.0),
child: GridView.count(
crossAxisCount: 2,
padding: EdgeInsets.all(3.0),
children: urls.map<Widget>((url) => renderImage(url)).toList(),
),
),
);
}
Card renderImage(String imageUrl) {
return Card(
elevation: 1.0,
margin: EdgeInsets.all(5.0),
child: Container(
child: InkWell(
onTap: () {
Navigator.push<Widget>(
context,
MaterialPageRoute(
builder: (context) => KegiatanImageView(imageUrl),
),
);
},
child: Image.network(imageUrl, fit: BoxFit.cover),
),
)
);
}
}
\ No newline at end of file
import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/model/lokasi.dart';
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import 'package:multi_image_picker/multi_image_picker.dart';
class UpdateKegiatan extends StatefulWidget {
UpdateKegiatan({
Key key,
@required this.kegiatan,
@required this.placeId,
}) : super(key: key);
final KegiatanModel kegiatan;