Fakultas Ilmu Komputer UI

Commit 6e2f4d27 authored by Jovi Handono Hutama's avatar Jovi Handono Hutama
Browse files

Merge branch 'dev-jovi' into 'PBI-9-info_kegiatan'

Render all Kegiatan in Lokasi

See merge request !32
parents e98a5e01 14f5e24a
Pipeline #76811 failed with stages
in 1 minute and 35 seconds
......@@ -12,29 +12,30 @@ class KegiatanList {
@JsonSerializable()
class KegiatanModel {
final int id;
@JsonKey(name: 'nama_lokasi')
final String namaLokasi;
@JsonKey(name: 'place_id')
final String placeId;
final String creator;
@JsonKey(name: 'nama_kegiatan')
final String namaKegiatan;
final String penyelenggara;
final String narahubung;
final String deskripsi;
@JsonKey(name: 'time_start', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeStart;
@JsonKey(name: 'time_end', fromJson: CustomSerializer.stringToDateTime)
final DateTime timeEnd;
// @JsonKey(name: 'time_start', fromJson: CustomSerializer.stringToDateTime)
// final DateTime timeStart;
// @JsonKey(name: 'time_end', fromJson: CustomSerializer.stringToDateTime)
// final DateTime timeEnd;
KegiatanModel(
{
this.id,
this.namaLokasi,
this.placeId,
this.creator,
this.namaKegiatan,
this.penyelenggara,
this.narahubung,
this.deskripsi,
this.timeStart,
this.timeEnd
// this.timeStart,
// this.timeEnd
}
);
......
......@@ -24,26 +24,22 @@ Map<String, dynamic> _$KegiatanListToJson(KegiatanList instance) =>
KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) {
return KegiatanModel(
id: json['id'] as int,
namaLokasi: json['nama_lokasi'] as String,
placeId: json['place_id'] as String,
creator: json['creator'] as String,
namaKegiatan: json['namaKegiatan'] as String,
namaKegiatan: json['nama_kegiatan'] as String,
penyelenggara: json['penyelenggara'] as String,
narahubung: json['narahubung'] 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) =>
<String, dynamic>{
'id': instance.id,
'nama_lokasi': instance.namaLokasi,
'place_id': instance.placeId,
'creator': instance.creator,
'namaKegiatan': instance.namaKegiatan,
'nama_kegiatan': instance.namaKegiatan,
'penyelenggara': instance.penyelenggara,
'narahubung': instance.narahubung,
'deskripsi': instance.deskripsi,
'time_start': instance.timeStart?.toIso8601String(),
'time_end': instance.timeEnd?.toIso8601String(),
};
......@@ -16,29 +16,25 @@ class Kegiatan extends StatefulWidget {
}
class _KegiatanState extends State<Kegiatan> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return InkWell(
key: Key('Kegiatan'),
key: Key(widget.kegiatan.namaKegiatan),
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => DetailPostKegiatanPage(
lokasi: widget.lokasi,
kegiatan: KegiatanModel(
id: widget.kegiatan.id,
namaLokasi: widget.lokasi.name,
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
// timeStart: widget.kegiatan.timeStart,
// timeEnd: widget.kegiatan.timeEnd,
),
)
));
......@@ -49,9 +45,7 @@ class _KegiatanState extends State<Kegiatan> {
decoration: BoxDecoration(
boxShadow: regularShadow,
border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)),
borderRadius: const BorderRadius.all(
Radius.circular(10)
),
borderRadius: const BorderRadius.all(Radius.circular(10)),
color: Colors.white,
),
child: Stack(
......@@ -64,7 +58,7 @@ class _KegiatanState extends State<Kegiatan> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Kegiatan',
widget.kegiatan.namaKegiatan,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w800,
......@@ -92,7 +86,7 @@ class _KegiatanState extends State<Kegiatan> {
children: <Widget>[
Flexible(
child: Text(
'ditambahkan oleh TEST',
'ditambahkan oleh ${widget.kegiatan.creator}',
softWrap: true,
style: const TextStyle(
fontSize: 12,
......
......@@ -47,8 +47,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
return WillPopScope(
child: Scaffold(
appBar: BisaGoAppBar(
title: widget.kegiatan.namaLokasi, // ganti widget.x.namalokasi // sudah
key: Key('appbar-text-${widget.kegiatan.namaLokasi}'),
title: widget.kegiatan.placeId, // ganti widget.x.namalokasi // sudah
key: Key('appbar-text-${widget.kegiatan.placeId}'),
actions: <Widget>[
InkWell(
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