Fakultas Ilmu Komputer UI

Commit 15d315d3 authored by Putri Salsabila's avatar Putri Salsabila
Browse files

Add zonaWaktu to add kegiatan & detail post kegiatan

parent 46226868
......@@ -3,6 +3,5 @@ import 'package:intl/intl.dart';
class CustomSerializer {
static DateTime stringToDateTime(String date) {
return DateFormat('yyyy-MM-dd HH:mm').parse(date);
// return DateFormat('%Y-%m-%dT%H:%M').parse(date);
}
}
......@@ -99,11 +99,11 @@ const fasilitas = {
'TB': 'Tempat Parkir Biasa',
};
const zonaWaktu = {
'WIB': 'WIB',
'WITA': 'WITA',
'WIT': 'WIT',
};
const zonaWaktu = [
'WIB',
'WITA',
'WIT',
];
String getTag(String tag) {
return tags[tag];
......
......@@ -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 {
......
......@@ -3,11 +3,10 @@ import 'dart:io';
import 'package:bisaGo/bloc/kegiatan_bloc.dart';
import 'package:bisaGo/component/bisago_appbar.dart';
// import 'package:bisaGo/config/strings.dart';
import 'package:bisaGo/config/strings.dart';
import 'package:bisaGo/config/styles.dart';
import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/utils/custom_button.dart';
// import 'package:bisaGo/utils/custom_dropdown.dart';
import 'package:bisaGo/utils/custom_text_field.dart';
import 'package:bisaGo/utils/validator.dart';
import 'package:carousel_slider/carousel_slider.dart';
......@@ -46,8 +45,8 @@ class _AddKegiatanState extends State<AddKegiatan> {
TextEditingController linkController = TextEditingController();
String tanggalKegiatan =
'${DateFormat('yyyy-MM-ddTHH:mm').format(DateTime.now())}';
'${DateFormat('yyyy-MM-dd HH:mm').format(DateTime.now())}';
String zonaCurrent = 'WIB';
List<Asset> images = <Asset>[];
@override
......@@ -121,6 +120,7 @@ class _AddKegiatanState extends State<AddKegiatan> {
timeEnd: DateTime.parse(tanggalKegiatan).add(
Duration(days: 1),
),
zonaWaktu: zonaCurrent,
);
final newKegiatanData = newKegiatan.toJson();
......@@ -144,7 +144,7 @@ class _AddKegiatanState extends State<AddKegiatan> {
void successDialog(BuildContext context) {
const alertDialog = AlertDialog(
title: Text('Tambah informasi berhasil'),
title: Text('Tambah kegiatan berhasil'),
content: Icon(FontAwesomeIcons.checkCircle),
);
showDialog(
......@@ -157,7 +157,7 @@ class _AddKegiatanState extends State<AddKegiatan> {
void failedDialog(BuildContext context, String message) {
var newMessage = message;
if (message == 'default') {
newMessage = 'Gagal menambahkan informasi';
newMessage = 'Gagal menambahkan kegiatan';
}
final alertDialog = AlertDialog(
title: Text(newMessage),
......@@ -315,7 +315,7 @@ class _AddKegiatanState extends State<AddKegiatan> {
return CustomTextField(
title: 'Nama Narahubung',
hint: 'Masukkan nama narahubung',
required: true,
required: false,
key: const Key('Text Field Nama Narahubung'),
validator: FieldValidator.validateName,
controller: namaKontakController,
......@@ -337,7 +337,7 @@ class _AddKegiatanState extends State<AddKegiatan> {
return CustomTextField(
title: 'Link Kegiatan',
hint: 'Masukkan link kegiatan (jika ada)',
required: true,
required: false,
key: const Key('Text Field Link Kegiatan'),
validator: FieldValidator.validateName,
controller: linkController,
......@@ -347,59 +347,89 @@ class _AddKegiatanState extends State<AddKegiatan> {
Widget tanggalKegiatanField() {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column(
children: <Widget>[
SizedBox(height: 10.0),
Padding(
padding: const EdgeInsets.fromLTRB(0,0,20,10),
padding: const EdgeInsets.fromLTRB(0,0,70,10),
child: const Text(
'Tanggal Kegiatan',
'Tanggal & Waktu Kegiatan',
style: TextStyle(fontSize: 18),
textAlign: TextAlign.left,
),
),
TextButton(
key: const Key('Button Tanggal Kegiatan'),
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(13.0),
backgroundColor: greenPrimary,
),
onPressed: () {
DatePicker.showDateTimePicker(
context,
currentTime: DateTime.parse(tanggalKegiatan),
onChanged: (date) {
setState(() {
tanggalKegiatan =
'${DateFormat('yyyy-MM-ddTHH:mm').format(date)}';
});
},
);
},
child: Text(
tanggalKegiatan,
style: const TextStyle(
fontSize: 15.0, color: Colors.white),
),
Row(
children: <Widget>[
SizedBox(
width: 186.0,
child: TextButton(
key: const Key('Button Tanggal & Waktu Kegiatan'),
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(13.0),
backgroundColor: Colors.transparent,
side: BorderSide(color: greenPrimary),
),
onPressed: () {
DatePicker.showDateTimePicker(
context,
currentTime: DateTime.parse(tanggalKegiatan),
onChanged: (date) {
setState(() {
tanggalKegiatan =
'${DateFormat('yyyy-MM-dd HH:mm').format(date)}';
});
},
);
},
child: Row(
children: <Widget>[
Text(
tanggalKegiatan,
style: const TextStyle(
fontSize: 15.0, color: Colors.black),
),
SizedBox(width: 10.0),
Icon(
Icons.calendar_today,
size: 20,
color: Colors.green,
)
]
)
),
),
SizedBox(width: 25.0),
zonaWaktuChoice(),
]
),
// CustomDropdown(
// title: 'Fasilitas / Layanan',
// key: const Key('Dropdown Fasilitas Layanan'),
// dropdownList: zonaWaktu,
// validator: FieldValidator.validateDropdown,
// hint: 'Pilih fasilitas / layanan',
// onChanged: (value) {
// setState(() {
// _blombikinstringnya = value;
// });
// }),
],
),
);
}
Widget zonaWaktuChoice() {
return DropdownButton<String>(
value: zonaCurrent,
underline: Container(
height: 1,
color: Colors.green,
),
items: zonaWaktu.map((String zona) {
return DropdownMenuItem<String>(
value: zona,
child: Text(zona),
);
}).toList(),
onChanged: (String zonaSelected) {
setState(() {
zonaCurrent = zonaSelected;
});
},
);
}
Widget fotoField() {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
......
......@@ -220,7 +220,7 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
.toList(),
),
),
const SizedBox(height: 10),
SizedBox(height: 10),
Container(
key: const Key('desc'),
padding: const EdgeInsets.all(doubleSpace),
......@@ -237,12 +237,12 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
SizedBox(height: 20),
Row(
children: [
const Icon(
Icon(
Icons.calendar_today,
size: 20,
color: Colors.green,
),
const SizedBox(width: 15),
SizedBox(width: 15),
Text(
'${DateFormat('EEEEEE, dd MMM yyy').format(widget.kegiatan.timeStart)}',
style: TextStyle(fontSize: 16),
......@@ -253,41 +253,49 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
SizedBox(height: 15),
Row(
children: [
const Icon(
Icon(
Icons.access_time,
size: 20,
color: Colors.green,
),
const SizedBox(width: 15),
SizedBox(width: 15),
Text(
'${DateFormat('hh:mm').format(widget.kegiatan.timeStart)}',
style: TextStyle(fontSize: 16),
key: Key('Text Waktu Pelaksanaan'),
),
SizedBox(width: 3.0),
Text(
widget.kegiatan.zonaWaktu,
style: TextStyle(fontSize: 16),
key: Key('Text Zona Waktu Pelaksanaan'),
)
],
),
Row(
children: [
const Icon(
Icon(
Icons.call,
size: 20,
color: Colors.green,
),
const SizedBox(width: 7.0),
SizedBox(width: 15.0),
Text(
'${widget.kegiatan.namaKontak}',
widget.kegiatan.namaKontak ?? '',
style: const TextStyle(fontSize: 16),
key: const Key('Text Nama Kontak Kegiatan'),
),
const SizedBox(width: 3.0),
TextButton(
key: Key('Text Nomor Kontak Kegiatan'),
onPressed: () => setState(() {
_makePhoneCall('tel:${widget.kegiatan.nomorKontak}');
}),
child: Text(
widget.kegiatan.nomorKontak ?? '-',
style: TextStyle(fontSize: 16),
widget.kegiatan.nomorKontak ?? '',
style: TextStyle(
fontSize: 16,
color: Colors.green,
),
key: Key('Text Link'),
),
),
......@@ -295,12 +303,12 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
),
Row(
children: [
const Icon(
Icon(
Icons.language,
size: 20,
color: Colors.green,
),
const SizedBox(width: 7.0),
SizedBox(width: 7.0),
Expanded(
child: TextButton(
key: const Key('Text Link Kegiatan'),
......@@ -308,8 +316,11 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
_launchInBrowser(widget.kegiatan.links);
}),
child: Text(
widget.kegiatan.links ?? '-',
style: TextStyle(fontSize: 16),
widget.kegiatan.links ?? '',
style: TextStyle(
fontSize: 16,
color: Colors.green,
),
key: Key('Text Link'),
),
),
......@@ -325,7 +336,7 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const Text(
Text(
'informasi ditambahkan oleh ',
style: TextStyle(
fontSize: 12,
......@@ -359,10 +370,8 @@ class _DetailPostKegiatanPageState extends State<DetailPostKegiatanPage> {
// ),
],
),
const SizedBox(
height: regularSpace,
),
const Divider(
SizedBox(height: regularSpace),
Divider(
color: grayPrimary,
thickness: 1.0,
),
......
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