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
45c52b4e
Commit
45c52b4e
authored
Jun 07, 2021
by
Ardian Ghifari
Browse files
[GREEN] Add shimmer loading effect to profile.dart
parent
90e16786
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/page/profile/profile.dart
View file @
45c52b4e
...
...
@@ -10,6 +10,7 @@ import 'package:bisaGo/utils/profile_utils.dart';
import
'package:flutter/material.dart'
;
import
'package:intl/date_symbol_data_local.dart'
;
import
'package:material_design_icons_flutter/material_design_icons_flutter.dart'
;
import
'package:shimmer/shimmer.dart'
;
class
Profile
extends
StatefulWidget
{
final
String
email
;
...
...
@@ -31,6 +32,24 @@ class _ProfileState extends State<Profile> {
String
email
;
UserBloc
_bloc
;
bool
fetched
;
bool
_enabled
=
true
;
final
mockUser
=
DetailUserModel
.
fromJson
({
'is_login'
:
true
,
'username'
:
'test@gmail.com'
,
'name'
:
'test'
,
'email'
:
'test@gmail.com'
,
'tanggal_lahir'
:
'02 October 2000'
,
'phone_number'
:
'081234567898'
,
'jenis_kelamin'
:
'Laki-Laki'
,
'disabilitas'
:
'Tidak memiliki disabilitas'
,
'pekerjaan'
:
'Pelajar'
,
'alamat'
:
'Tidak Tahu'
,
'hidden_fields'
:
[],
'hidden_fields_verbose'
:
[],
'can_see_hidden_fields'
:
true
,
'hidden_fields_color'
:
'#808080'
,
'seen'
:
true
,
});
_ProfileState
(
this
.
email
);
...
...
@@ -80,15 +99,20 @@ class _ProfileState extends State<Profile> {
if
(
snapshot
.
hasData
)
{
switch
(
snapshot
.
data
.
status
)
{
case
Status
.
completed
:
_enabled
=
false
;
user
=
snapshot
.
data
.
data
;
return
_createProfilePage
();
return
_createProfilePage
(
user
);
case
Status
.
loading
:
return
const
Center
(
child:
CircularProgressIndicator
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
greenPrimary
),
),
_enabled
=
true
;
return
Container
(
child:
Shimmer
.
fromColors
(
baseColor:
Colors
.
grey
[
300
],
highlightColor:
Colors
.
grey
[
100
],
enabled:
_enabled
,
child:
_createProfilePage
(
mockUser
)),
);
case
Status
.
error
:
_enabled
=
false
;
return
Center
(
child:
Text
(
snapshot
.
data
.
message
.
toString
()),
);
...
...
@@ -100,7 +124,7 @@ class _ProfileState extends State<Profile> {
);
}
Widget
_createProfilePage
()
{
Widget
_createProfilePage
(
DetailUserModel
user
)
{
var
tanggalLahir
=
toIndonesiaLocale
(
user
.
tanggalLahir
);
return
ListView
(
children:
<
Widget
>[
...
...
@@ -142,7 +166,8 @@ class _ProfileState extends State<Profile> {
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
,
color:
_getFontColor
(
'email'
,
seenColor:
Colors
.
white
),
color:
_getFontColor
(
'email'
,
seenColor:
Colors
.
white
),
fontFamily:
'Muli'
,
),
textAlign:
TextAlign
.
center
,
...
...
lib/page/profile/profile_picture.dart
View file @
45c52b4e
...
...
@@ -9,6 +9,7 @@ import 'package:bisaGo/utils/profile_utils.dart';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:photo_view/photo_view.dart'
;
import
'package:shimmer/shimmer.dart'
;
class
ProfilePicture
extends
StatelessWidget
{
final
DetailUserModel
user
;
...
...
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