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 { ...@@ -17,6 +17,8 @@ class KegiatanModel {
String creator; String creator;
@JsonKey(name: 'nama_kegiatan') @JsonKey(name: 'nama_kegiatan')
String namaKegiatan; String namaKegiatan;
@JsonKey(name: 'creator_email')
String creatorEmail;
String penyelenggara; String penyelenggara;
String deskripsi; String deskripsi;
@JsonKey(name: 'nama_kontak') @JsonKey(name: 'nama_kontak')
...@@ -38,6 +40,7 @@ class KegiatanModel { ...@@ -38,6 +40,7 @@ class KegiatanModel {
this.placeId, this.placeId,
this.creator, this.creator,
this.namaKegiatan, this.namaKegiatan,
this.creatorEmail,
this.penyelenggara, this.penyelenggara,
this.deskripsi, this.deskripsi,
this.namaKontak, this.namaKontak,
......
...@@ -27,6 +27,7 @@ KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) { ...@@ -27,6 +27,7 @@ KegiatanModel _$KegiatanModelFromJson(Map<String, dynamic> json) {
placeId: json['place_id'] as String, placeId: json['place_id'] as String,
creator: json['creator'] as String, creator: json['creator'] as String,
namaKegiatan: json['nama_kegiatan'] as String, namaKegiatan: json['nama_kegiatan'] as String,
creatorEmail: json['creator_email'] as String,
penyelenggara: json['penyelenggara'] as String, penyelenggara: json['penyelenggara'] as String,
deskripsi: json['deskripsi'] as String, deskripsi: json['deskripsi'] as String,
namaKontak: json['nama_kontak'] as String, namaKontak: json['nama_kontak'] as String,
...@@ -45,6 +46,7 @@ Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) => ...@@ -45,6 +46,7 @@ Map<String, dynamic> _$KegiatanModelToJson(KegiatanModel instance) =>
'place_id': instance.placeId, 'place_id': instance.placeId,
'creator': instance.creator, 'creator': instance.creator,
'nama_kegiatan': instance.namaKegiatan, 'nama_kegiatan': instance.namaKegiatan,
'creator_email': instance.creatorEmail,
'penyelenggara': instance.penyelenggara, 'penyelenggara': instance.penyelenggara,
'deskripsi': instance.deskripsi, 'deskripsi': instance.deskripsi,
'nama_kontak': instance.namaKontak, 'nama_kontak': instance.namaKontak,
......
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:bisaGo/config/custom_serializer.dart';
part 'komentar.g.dart'; part 'komentar.g.dart';
......
...@@ -29,6 +29,7 @@ class _KegiatanState extends State<Kegiatan> { ...@@ -29,6 +29,7 @@ class _KegiatanState extends State<Kegiatan> {
id: widget.kegiatan.id, id: widget.kegiatan.id,
placeId: widget.kegiatan.placeId, placeId: widget.kegiatan.placeId,
creator: widget.kegiatan.creator, creator: widget.kegiatan.creator,
creatorEmail: widget.kegiatan.creatorEmail,
namaKegiatan: widget.kegiatan.namaKegiatan, namaKegiatan: widget.kegiatan.namaKegiatan,
penyelenggara: widget.kegiatan.penyelenggara, penyelenggara: widget.kegiatan.penyelenggara,
deskripsi: widget.kegiatan.deskripsi, deskripsi: widget.kegiatan.deskripsi,
......
...@@ -2,7 +2,10 @@ import 'dart:async'; ...@@ -2,7 +2,10 @@ import 'dart:async';
import 'package:bisaGo/model/kegiatan.dart'; import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/model/lokasi.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/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/repository/dynamic_links_service_repository.dart';
import 'package:bisaGo/utils/share_utils.dart'; import 'package:bisaGo/utils/share_utils.dart';
import 'package:bisaGo/utils/validator.dart'; import 'package:bisaGo/utils/validator.dart';
...@@ -349,14 +352,24 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> { ...@@ -349,14 +352,24 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: maxWidth:
MediaQuery.of(context).size.width * 0.3), MediaQuery.of(context).size.width * 0.3),
child: Text( child: InkWell(
'${widget.kegiatan.creator}', onTap: () {
key: Key('creator-${widget.kegiatan.creator}'), Navigator.push(
overflow: TextOverflow.fade, context,
softWrap: false, MaterialPageRoute(
style: const TextStyle( builder: (_) => Profile(
fontSize: 12, email: widget.kegiatan.creatorEmail,
fontStyle: FontStyle.italic, isPublic: true)));
},
child: Text(
'${widget.kegiatan.creator}',
key: Key('creator-${widget.kegiatan.creator}'),
overflow: TextOverflow.fade,
softWrap: false,
style: const TextStyle(
fontSize: 12,
fontStyle: FontStyle.italic,
),
), ),
), ),
), ),
...@@ -411,6 +424,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> { ...@@ -411,6 +424,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
.map<Widget>((k) => .map<Widget>((k) =>
komentarKegiatanPlaceHolder( komentarKegiatanPlaceHolder(
k.creator, k.creator,
k.creatorEmail,
k.creatorPicture,
k.created, k.created,
k.deskripsi)) k.deskripsi))
.toList()); .toList());
...@@ -604,21 +619,17 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> { ...@@ -604,21 +619,17 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
} }
Widget komentarKegiatanPlaceHolder( 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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
CircleAvatar( ProfilePicture(user, redirectToDetailProfile: true),
backgroundColor: greenPrimary,
child: Text(
_creatorInitials(name),
style: const TextStyle(
color: Colors.white,
),
),
),
Padding( Padding(
padding: const EdgeInsets.all(regularSpace), padding: const EdgeInsets.all(regularSpace),
child: Column( child: Column(
...@@ -649,16 +660,6 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> { ...@@ -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 { // Future<void> _updateInformasi() async {
// final sharedPreferences = await SharedPreferences.getInstance(); // final sharedPreferences = await SharedPreferences.getInstance();
// if (sharedPreferences.getString('token') == null) { // 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