Fakultas Ilmu Komputer UI

Verified Commit b16a7f3c authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

[CHORE] Done PBI 10, added previewable profile from kegiatan and komentar kegiatan

parent 67cc76a8
Pipeline #81588 passed with stages
in 15 minutes and 54 seconds
......@@ -17,6 +17,8 @@ class KegiatanModel {
String creator;
@JsonKey(name: 'nama_kegiatan')
String namaKegiatan;
@JsonKey(name: 'creator_email')
String creatorEmail;
String penyelenggara;
String deskripsi;
@JsonKey(name: 'nama_kontak')
......@@ -38,6 +40,7 @@ class KegiatanModel {
this.placeId,
this.creator,
this.namaKegiatan,
this.creatorEmail,
this.penyelenggara,
this.deskripsi,
this.namaKontak,
......
......@@ -27,6 +27,7 @@ KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) {
placeId: json['place_id'] as String,
creator: json['creator'] as String,
namaKegiatan: json['nama_kegiatan'] as String,
creatorEmail: json['creator_email'] as String,
penyelenggara: json['penyelenggara'] as String,
deskripsi: json['deskripsi'] as String,
namaKontak: json['nama_kontak'] as String,
......@@ -45,6 +46,7 @@ Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) =>
'place_id': instance.placeId,
'creator': instance.creator,
'nama_kegiatan': instance.namaKegiatan,
'creator_email': instance.creatorEmail,
'penyelenggara': instance.penyelenggara,
'deskripsi': instance.deskripsi,
'nama_kontak': instance.namaKontak,
......
import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:bisaGo/config/custom_serializer.dart';
part 'komentar.g.dart';
......
......@@ -29,6 +29,7 @@ class _KegiatanState extends State<Kegiatan> {
id: widget.kegiatan.id,
placeId: widget.kegiatan.placeId,
creator: widget.kegiatan.creator,
creatorEmail: widget.kegiatan.creatorEmail,
namaKegiatan: widget.kegiatan.namaKegiatan,
penyelenggara: widget.kegiatan.penyelenggara,
deskripsi: widget.kegiatan.deskripsi,
......
......@@ -2,7 +2,10 @@ import 'dart:async';
import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/model/lokasi.dart';
import 'package:bisaGo/model/user.dart';
import 'package:bisaGo/page/filter_fasilitas/kegiatan_list_images.dart';
import 'package:bisaGo/page/profile/profile.dart';
import 'package:bisaGo/page/profile/profile_picture.dart';
import 'package:bisaGo/repository/dynamic_links_service_repository.dart';
import 'package:bisaGo/utils/share_utils.dart';
import 'package:bisaGo/utils/validator.dart';
......@@ -349,6 +352,15 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
constraints: BoxConstraints(
maxWidth:
MediaQuery.of(context).size.width * 0.3),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Profile(
email: widget.kegiatan.creatorEmail,
isPublic: true)));
},
child: Text(
'${widget.kegiatan.creator}',
key: Key('creator-${widget.kegiatan.creator}'),
......@@ -360,6 +372,7 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
),
),
),
),
// Text(
// '(${DateFormat('dd MMM yyy').format(widget.kegiatan.created)})', // ganti format (${DateFormat('dd MMM yyy').format(widget.x.dateTime)})
// key: const Key('timestamp'),
......@@ -411,6 +424,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
.map<Widget>((k) =>
komentarKegiatanPlaceHolder(
k.creator,
k.creatorEmail,
k.creatorPicture,
k.created,
k.deskripsi))
.toList());
......@@ -604,21 +619,17 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
}
Widget komentarKegiatanPlaceHolder(
String name, DateTime created, String description) {
String name, String email, String foto, DateTime created, String description) {
final user = DetailUserModel()
..email = email
..foto = foto
..name = name;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
CircleAvatar(
backgroundColor: greenPrimary,
child: Text(
_creatorInitials(name),
style: const TextStyle(
color: Colors.white,
),
),
),
ProfilePicture(user, redirectToDetailProfile: true),
Padding(
padding: const EdgeInsets.all(regularSpace),
child: Column(
......@@ -649,16 +660,6 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
);
}
String _creatorInitials(String name) {
if (name.isEmpty) return '';
var initials = '';
for (final i in name.split(' ')) {
initials += '${i[0].toUpperCase()}';
}
if (initials.length > 2) return initials.substring(0, 2);
return initials;
}
// Future<void> _updateInformasi() async {
// final sharedPreferences = await SharedPreferences.getInstance();
// if (sharedPreferences.getString('token') == null) {
......
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