Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
bisago
bisago-fe
Commits
5b218378
Commit
5b218378
authored
May 31, 2021
by
Dzaky Noor Hasyim
Browse files
[CHORES] Fix kegiatan model bugs, commit taken from dev-putsal
parent
10a76869
Pipeline
#80349
failed with stages
in 2 minutes and 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/component/bisago_drawer.dart
View file @
5b218378
import
'package:bisaGo/page/informasi/agenda_kegiatan.dart'
;
import
'package:bisaGo/page/informasi/list_sekolah.dart'
;
import
'package:bisaGo/page/profile/profile.dart'
;
import
'package:bisaGo/page/tentang_disabilitas/tentang_disabilitas.dart'
;
...
...
@@ -16,6 +17,7 @@ class BisaGoDrawer extends StatelessWidget {
{
'title'
:
'Beranda'
,
'icon'
:
Icons
.
home
},
{
'title'
:
'Riwayat Pencarian'
,
'icon'
:
Icons
.
history
},
{
'title'
:
'Layanan Disabilitas'
,
'icon'
:
Icons
.
group
},
{
'title'
:
'Agenda Kegiatan'
,
'icon'
:
Icons
.
group
},
{
'title'
:
'Tentang Disabilitas'
,
'icon'
:
Icons
.
accessible
},
{
'title'
:
'Tentang Aplikasi'
,
'icon'
:
Icons
.
info
},
{
'title'
:
'Login'
,
'icon'
:
Icons
.
keyboard_backspace
}
...
...
@@ -197,8 +199,11 @@ class BisaGoDrawer extends StatelessWidget {
route
=
MaterialPageRoute
(
builder:
(
_
)
=>
TentangDisabilitas
());
}
else
if
(
page
==
'Layanan Disabilitas'
)
{
route
=
MaterialPageRoute
(
builder:
(
_
)
=>
ListSekolah
());
}
else
if
(
page
==
'Agenda Kegiatan'
)
{
route
=
MaterialPageRoute
(
builder:
(
_
)
=>
AgendaKegiatan
());
}
Navigator
.
of
(
context
).
push
(
route
);
Navigator
.
of
(
context
).
push
(
route
);
}
}
...
...
lib/page/informasi/agenda_kegiatan.dart
0 → 100644
View file @
5b218378
import
'package:bisaGo/bloc/kegiatan_terdekat_bloc.dart'
;
import
'package:bisaGo/model/lokasi.dart'
;
import
'package:bisaGo/page/filter_fasilitas/kegiatan.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:bisaGo/bloc/lokasi_response_bloc.dart'
;
import
'package:bisaGo/component/bisago_appbar.dart'
;
import
'package:bisaGo/component/image_holder.dart'
;
import
'package:bisaGo/config/styles.dart'
;
import
'package:bisaGo/model/kegiatan.dart'
;
import
'package:bisaGo/network/data/network_model.dart'
;
import
'package:bisaGo/page/filter_fasilitas/fasilitas.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:google_maps_webservice/places.dart'
;
import
'package:intl/intl.dart'
;
/// Create Agenda Kegiatan page widget with a state
class
AgendaKegiatan
extends
StatefulWidget
{
const
AgendaKegiatan
({
Key
key
})
:
super
(
key:
key
);
@override
_AgendaKegiatanState
createState
()
=>
_AgendaKegiatanState
();
}
/// State of Agenda Kegiatan page
class
_AgendaKegiatanState
extends
State
<
AgendaKegiatan
>
{
/// List for places from API
//List<KegiatanModel> allKegiatanFromApi = [];
/// BLoC for pencarian
KegiatanTerdekatBloc
bloc
=
KegiatanTerdekatBloc
();
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
resizeToAvoidBottomInset:
false
,
appBar:
const
PreferredSize
(
preferredSize:
Size
.
fromHeight
(
55
),
key:
Key
(
'Scaffold Text Field'
),
child:
BisaGoAppBar
(),
),
body:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Container
(
margin:
const
EdgeInsets
.
only
(
left:
doubleSpace
,
right:
doubleSpace
,
bottom:
regularSpace
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
'Agenda Kegiatan'
,
style:
TextStyle
(
fontFamily:
'Muli'
,
fontSize:
20
,
fontWeight:
FontWeight
.
w800
),
),
Text
(
'Sort by: Date'
,
style:
TextStyle
(
fontFamily:
'Muli'
,
fontSize:
12
,
fontWeight:
FontWeight
.
w800
),)
])),
StreamBuilder
<
NetworkModel
>(
stream:
bloc
.
kegiatanTerdekatStream
,
builder:
(
context
,
snapshot
)
{
if
(
snapshot
.
hasData
)
{
switch
(
snapshot
.
data
.
status
)
{
case
Status
.
loading
:
return
const
Center
(
child:
CircularProgressIndicator
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
greenPrimary
),
),
);
break
;
case
Status
.
completed
:
final
allKegiatanFromApi
=
snapshot
.
data
.
data
;
Widget
displayWidget
;
if
(
allKegiatanFromApi
==
null
)
{
displayWidget
=
const
Center
(
child:
Text
(
'Belum ada informasi'
));
}
else
{
displayWidget
=
renderListKegiatan
(
allKegiatanFromApi
);
}
/*Column(
children: allKegiatanFromApi
.map<Widget>((k) => Kegiatan(
lokasi: getLokasiAgenda(k), /// masih bingung gw kenapa merah, harusnya gr" future
kegiatan: k))
.toList());*/
return
displayWidget
;
break
;
case
Status
.
error
:
return
Center
(
child:
Text
(
'
${snapshot.data.status}
'
),
);
break
;
}
}
return
Container
();
},
),
],
),
);
}
Future
<
String
>
_getLokasiName
(
String
placeId
)
async
{
final
_places
=
GoogleMapsPlaces
(
apiKey:
DotEnv
().
env
[
'API_KEY'
]);
var
details
=
await
_places
.
getDetailsByPlaceId
(
placeId
,
fields:
[
'name'
,
],
);
final
result
=
details
.
result
;
return
result
==
null
?
'INVALID'
:
result
.
name
;
}
Lokasi
getLokasiAgenda
(
KegiatanModel
kegiatan
)
{
var
lokasi
=
Lokasi
()
..
name
=
_getLokasiName
(
kegiatan
.
placeId
)
as
String
..
placeId
=
kegiatan
.
placeId
;
return
lokasi
;
}
List
<
KegiatanModel
>
allKegiatanList
(
KegiatanModel
kegiatanApi
){
//List<KegiatanModel> placeholder = [];
//placeholder <- list(kegiatanApi);
return
null
;
// KegiatanList(kegiatanApi.toList());
}
Widget
renderListKegiatan
(
KegiatanModel
kegiatanList
)
{
//List<Lokasi> places) {
return
TextButton
(
style:
TextButton
.
styleFrom
(
padding:
EdgeInsets
.
all
(
10
),
),
onPressed:
()
{
//_navigateToDetailPostKegiatanPage(context);
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
left:
smallSpace
,
right:
smallSpace
,
top:
smallSpace
,
bottom:
smallSpace
),
height:
80
,
alignment:
Alignment
.
topCenter
,
decoration:
const
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10.0
)),
),
child:
Container
(
margin:
const
EdgeInsets
.
only
(
left:
smallSpace
,
right:
smallSpace
,
top:
smallSpace
,
bottom:
smallSpace
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
kegiatanList
.
namaKegiatan
,
//+widget.kegiatan.deskripsi,
style:
const
TextStyle
(
color:
greenPrimary
,
fontSize:
16
,
fontFamily:
'Muli'
,
)),
Column
(
children:
[
Text
(
DateFormat
(
'yyyy-MM-dd'
).
format
(
kegiatanList
.
timeStart
),
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
16
,
fontFamily:
'Muli'
,
fontStyle:
FontStyle
.
italic
,
)),
Text
(
DateFormat
(
'kk:mm'
).
format
(
kegiatanList
.
timeStart
),
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
16
,
fontFamily:
'Muli'
,
fontStyle:
FontStyle
.
italic
,
))
])
],
))));
/*return Column(
children: kegiatanList
.map((kegiatan) => InkWell(
key: Key('history-${kegiatan.namaKegiatan}'),
onTap: () {
*//*Navigator.of(context)
.push(MaterialPageRoute(
builder: (BuildContext context) => Fasilitas(
lokasi: kegiatan,
)))
.then((value) => bloc.fetchKegiatanTerdekat());*//*
},
child: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border:
Border(bottom: BorderSide(color: Colors.grey[400]))),
margin: const EdgeInsets.only(
left: doubleSpace, right: doubleSpace),
height: 90,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
CircleAvatar(
backgroundColor: greenPrimary,
*//*child: ImageHolder(
url: kegiatan.image,
),*//*
),
Expanded(
child: Container(
padding: const EdgeInsets.all(doubleSpace),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
kegiatan.namaKegiatan,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w800,
color: Colors.black,
fontFamily: 'Muli',
),
overflow: TextOverflow.ellipsis,
),
Text(
kegiatan.deskripsi,
style: const TextStyle(
fontSize: 15,
color: Colors.black,
fontFamily: 'Muli',
),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
],
),
),
Icon(
Icons.arrow_forward_ios,
color: Colors.grey[400],
size: 20,
)
],
),
),
))
.toList(),
);*/
}
@override
void
dispose
()
{
//bloc.dispose();
super
.
dispose
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment