Fakultas Ilmu Komputer UI
Skip to content
GitLab
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
05159b46
Commit
05159b46
authored
Jun 07, 2021
by
Ardian Ghifari
Browse files
[GREEN] Add shimmer loading to dashboard
parent
746b794c
Pipeline
#81974
failed with stages
in 1 minute and 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/page/dashboard/dashboard.dart
View file @
05159b46
...
...
@@ -42,18 +42,7 @@ class DashboardState extends State<Dashboard> {
Geolocator
geolocator
;
LatLng
currentLocation
;
Set
<
Marker
>
markers
=
{};
final
mockKegiatan
=
KegiatanModel
.
fromJson
({
'id'
:
1
,
'place_id'
:
'asdfghjkl'
,
'creator'
:
'Jovi'
,
'nama_kegiatan'
:
'Jalan Sehat'
,
'penyelenggara'
:
'Gubernur'
,
'narahubung'
:
'Rafif (0880123456123456)'
,
'deskripsi'
:
'Jalan sehat keliling kota'
,
'time_start'
:
'16-05-2021 06:00:00'
,
'time_end'
:
''
,
'image'
:
''
,
});
bool
_enabled
=
true
;
LokasiResponseBloc
bloc
=
LokasiResponseBloc
();
KegiatanTerdekatBloc
blocKegiatanTerdekat
=
KegiatanTerdekatBloc
();
...
...
@@ -207,20 +196,18 @@ class DashboardState extends State<Dashboard> {
if
(
snapshot
.
hasData
)
{
switch
(
snapshot
.
data
.
status
)
{
case
Status
.
loading
:
_enabled
=
true
;
return
Container
(
child:
Shimmer
.
fromColors
(
baseColor:
Colors
.
grey
[
300
],
highlightColor:
Colors
.
grey
[
100
],
enabled:
true
,
child:
_buildKegiatanTerdekatWidget
(
mockKegiatan
)));
child:
_buildMockKegiatanTerdekatWidget
());
break
;
case
Status
.
completed
:
_enabled
=
false
;
final
kegiatanTerdekat
=
snapshot
.
data
.
data
;
return
_buildKegiatanTerdekatWidget
(
kegiatanTerdekat
);
break
;
case
Status
.
error
:
_enabled
=
false
;
return
Container
(
child:
const
Center
(
child:
Text
(
...
...
@@ -300,21 +287,17 @@ class DashboardState extends State<Dashboard> {
if
(
snapshot
.
hasData
)
{
switch
(
snapshot
.
data
.
status
)
{
case
Status
.
loading
:
_enabled
=
true
;
return
Container
(
height:
130
,
child:
const
Center
(
child:
CircularProgressIndicator
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
greenPrimary
),
),
),
);
height:
130
,
child:
_buildMockLokasiWidget
());
break
;
case
Status
.
completed
:
_enabled
=
false
;
final
places
=
snapshot
.
data
.
data
.
listLokasi
;
return
_buildLokasiWidget
(
places
);
break
;
case
Status
.
error
:
_enabled
=
false
;
return
Container
(
height:
130
,
child:
const
Center
(
...
...
@@ -368,10 +351,74 @@ class DashboardState extends State<Dashboard> {
);
}
Widget
_buildMockLokasiWidget
()
{
final
mockLokasi
=
[
Lokasi
.
fromJson
({
'name'
:
'Margo City'
,
'alamat'
:
'Jl. Margonda Raya No.358, Kemiri Muka, Kecamatan Beji, Kota Depok, Jawa Barat 16423'
,
'image'
:
'static/img/2669211407.jpg'
,
'no_telp'
:
'02178870888'
,
'counter'
:
69
,
}),
Lokasi
.
fromJson
({
'name'
:
'Margo City'
,
'alamat'
:
'Jl. Margonda Raya No.358, Kemiri Muka, Kecamatan Beji, Kota Depok, Jawa Barat 16423'
,
'image'
:
'static/img/2669211407.jpg'
,
'no_telp'
:
'02178870888'
,
'counter'
:
69
,
}),
Lokasi
.
fromJson
({
'name'
:
'Margo City'
,
'alamat'
:
'Jl. Margonda Raya No.358, Kemiri Muka, Kecamatan Beji, Kota Depok, Jawa Barat 16423'
,
'image'
:
'static/img/2669211407.jpg'
,
'no_telp'
:
'02178870888'
,
'counter'
:
69
,
}),
];
return
Container
(
key:
Key
(
'Shimmer loading'
),
height:
130
,
child:
ListView
(
scrollDirection:
Axis
.
horizontal
,
children:
[
Row
(
children:
mockLokasi
.
map
<
Widget
>((
k
)
=
>
Shimmer
.
fromColors
(
baseColor:
Colors
.
grey
[
300
],
highlightColor:
Colors
.
grey
[
100
],
enabled:
_enabled
,
child:
LocationIconButton
(
location:
k
,
)))
.
toList
()),
],
),
);
}
Widget
_buildKegiatanTerdekatWidget
(
KegiatanModel
kegiatanModel
)
{
return
Container
(
child:
KegiatanTerdekatButton
(
kegiatan:
kegiatanModel
));
}
Widget
_buildMockKegiatanTerdekatWidget
()
{
final
mockKegiatan
=
KegiatanModel
.
fromJson
({
'id'
:
1
,
'place_id'
:
'asdfghjkl'
,
'creator'
:
'Jovi'
,
'nama_kegiatan'
:
'Jalan Sehat'
,
'penyelenggara'
:
'Gubernur'
,
'narahubung'
:
'Rafif (0880123456123456)'
,
'deskripsi'
:
'Jalan sehat keliling kota'
,
'time_start'
:
'2021-05-15 06:00:00'
,
'time_end'
:
'2021-05-15 10:00:00'
,
'image'
:
[
'a'
,
'b'
,
'c'
],
});
return
Container
(
child:
KegiatanTerdekatButton
(
kegiatan:
mockKegiatan
));
}
Widget
_buildGoogleMap
(
BuildContext
context
)
{
if
(
currentLocation
==
null
)
{
return
const
Center
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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