Fakultas Ilmu Komputer UI

Commit 391bc1e0 authored by Dzaky Noor Hasyim's avatar Dzaky Noor Hasyim
Browse files

Merge branch 'PBI-9-info_kegiatan' of...

Merge branch 'PBI-9-info_kegiatan' of https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/sosial/bisago/bisago-fe into dev-noor
parents 4e545b17 6e2f4d27
...@@ -12,29 +12,30 @@ class KegiatanList { ...@@ -12,29 +12,30 @@ class KegiatanList {
@JsonSerializable() @JsonSerializable()
class KegiatanModel { class KegiatanModel {
final int id; final int id;
@JsonKey(name: 'nama_lokasi') @JsonKey(name: 'place_id')
final String namaLokasi; final String placeId;
final String creator; final String creator;
@JsonKey(name: 'nama_kegiatan')
final String namaKegiatan; final String namaKegiatan;
final String penyelenggara; final String penyelenggara;
final String narahubung; final String narahubung;
final String deskripsi; final String deskripsi;
@JsonKey(name: 'time_start', fromJson: CustomSerializer.stringToDateTime) // @JsonKey(name: 'time_start', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeStart; // final DateTime timeStart;
@JsonKey(name: 'time_end', fromJson: CustomSerializer.stringToDateTime) // @JsonKey(name: 'time_end', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeEnd; // final DateTime timeEnd;
KegiatanModel( KegiatanModel(
{ {
this.id, this.id,
this.namaLokasi, this.placeId,
this.creator, this.creator,
this.namaKegiatan, this.namaKegiatan,
this.penyelenggara, this.penyelenggara,
this.narahubung, this.narahubung,
this.deskripsi, this.deskripsi,
this.timeStart, // this.timeStart,
this.timeEnd // this.timeEnd
} }
); );
......
...@@ -24,26 +24,22 @@ Map<String, dynamic> _$KegiatanListToJson(KegiatanList instance) => ...@@ -24,26 +24,22 @@ Map<String, dynamic> _$KegiatanListToJson(KegiatanList instance) =>
KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) { KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) {
return KegiatanModel( return KegiatanModel(
id: json['id'] as int, id: json['id'] as int,
namaLokasi: json['nama_lokasi'] as String, placeId: json['place_id'] as String,
creator: json['creator'] as String, creator: json['creator'] as String,
namaKegiatan: json['namaKegiatan'] as String, namaKegiatan: json['nama_kegiatan'] as String,
penyelenggara: json['penyelenggara'] as String, penyelenggara: json['penyelenggara'] as String,
narahubung: json['narahubung'] as String, narahubung: json['narahubung'] as String,
deskripsi: json['deskripsi'] as String, deskripsi: json['deskripsi'] as String,
timeStart: CustomSerializer.stringToDateTime(json['time_start'] as String),
timeEnd: CustomSerializer.stringToDateTime(json['time_end'] as String),
); );
} }
Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) => Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) =>
<String, dynamic>{ <String, dynamic>{
'id': instance.id, 'id': instance.id,
'nama_lokasi': instance.namaLokasi, 'place_id': instance.placeId,
'creator': instance.creator, 'creator': instance.creator,
'namaKegiatan': instance.namaKegiatan, 'nama_kegiatan': instance.namaKegiatan,
'penyelenggara': instance.penyelenggara, 'penyelenggara': instance.penyelenggara,
'narahubung': instance.narahubung, 'narahubung': instance.narahubung,
'deskripsi': instance.deskripsi, 'deskripsi': instance.deskripsi,
'time_start': instance.timeStart?.toIso8601String(),
'time_end': instance.timeEnd?.toIso8601String(),
}; };
...@@ -16,29 +16,25 @@ class Kegiatan extends StatefulWidget { ...@@ -16,29 +16,25 @@ class Kegiatan extends StatefulWidget {
} }
class _KegiatanState extends State<Kegiatan> { class _KegiatanState extends State<Kegiatan> {
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
key: Key('Kegiatan'), key: Key(widget.kegiatan.namaKegiatan),
onTap: () { onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute( Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => DetailPostKegiatanPage( builder: (BuildContext context) => DetailPostKegiatanPage(
lokasi: widget.lokasi, lokasi: widget.lokasi,
kegiatan: KegiatanModel( kegiatan: KegiatanModel(
id: widget.kegiatan.id, id: widget.kegiatan.id,
namaLokasi: widget.lokasi.name, placeId: widget.kegiatan.placeId,
creator: widget.kegiatan.creator, creator: widget.kegiatan.creator,
namaKegiatan: widget.kegiatan.namaKegiatan, namaKegiatan: widget.kegiatan.namaKegiatan,
penyelenggara: widget.kegiatan.penyelenggara, penyelenggara: widget.kegiatan.penyelenggara,
narahubung: widget.kegiatan.narahubung, narahubung: widget.kegiatan.narahubung,
deskripsi: widget.kegiatan.deskripsi, deskripsi: widget.kegiatan.deskripsi,
timeStart: widget.kegiatan.timeStart, // timeStart: widget.kegiatan.timeStart,
timeEnd: widget.kegiatan.timeEnd // timeEnd: widget.kegiatan.timeEnd,
), ),
) )
)); ));
...@@ -49,9 +45,7 @@ class _KegiatanState extends State<Kegiatan> { ...@@ -49,9 +45,7 @@ class _KegiatanState extends State<Kegiatan> {
decoration: BoxDecoration( decoration: BoxDecoration(
boxShadow: regularShadow, boxShadow: regularShadow,
border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)), border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)),
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(Radius.circular(10)),
Radius.circular(10)
),
color: Colors.white, color: Colors.white,
), ),
child: Stack( child: Stack(
...@@ -64,7 +58,7 @@ class _KegiatanState extends State<Kegiatan> { ...@@ -64,7 +58,7 @@ class _KegiatanState extends State<Kegiatan> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Text( Text(
'Kegiatan', widget.kegiatan.namaKegiatan,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
...@@ -92,7 +86,7 @@ class _KegiatanState extends State<Kegiatan> { ...@@ -92,7 +86,7 @@ class _KegiatanState extends State<Kegiatan> {
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Text( child: Text(
'ditambahkan oleh TEST', 'ditambahkan oleh ${widget.kegiatan.creator}',
softWrap: true, softWrap: true,
style: const TextStyle( style: const TextStyle(
fontSize: 12, fontSize: 12,
......
...@@ -47,8 +47,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> { ...@@ -47,8 +47,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
return WillPopScope( return WillPopScope(
child: Scaffold( child: Scaffold(
appBar: BisaGoAppBar( appBar: BisaGoAppBar(
title: widget.kegiatan.namaLokasi, // ganti widget.x.namalokasi // sudah title: widget.kegiatan.placeId, // ganti widget.x.namalokasi // sudah
key: Key('appbar-text-${widget.kegiatan.namaLokasi}'), key: Key('appbar-text-${widget.kegiatan.placeId}'),
actions: <Widget>[ actions: <Widget>[
InkWell( InkWell(
child: const Icon(Icons.share), child: const Icon(Icons.share),
......
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