Fakultas Ilmu Komputer UI

Commit 90e16786 authored by Ardian Ghifari's avatar Ardian Ghifari
Browse files

[GREEN] Add shimmer loading effect to list_sekolah.dart

parent 07f000f6
......@@ -8,6 +8,7 @@ import 'package:bisaGo/page/informasi/detail_komunitas.dart';
import 'package:bisaGo/page/informasi/detail_sekolah.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:shimmer/shimmer.dart';
class ListSekolah extends StatefulWidget {
const ListSekolah({Key key}) : super(key: key);
......@@ -17,11 +18,21 @@ class ListSekolah extends StatefulWidget {
}
class _ListSekolahState extends State<ListSekolah> {
/// Search Icon for textFormField
Icon searchIcon = const Icon(Icons.search);
LayananBloc layanan_bloc = LayananBloc();
bool _enabled = true;
final mockSekolah = SekolahModel.fromJson({
'name': 'SMA Tanjung Barat',
'alamat': 'Kecamatan Tanjung Barat',
'no_telp': '0213425367',
'website': 'www.tanjungbarat.co.id',
'jumlah_siswa': 200,
'status': 'IT',
'jenis_sekolah': 'IK',
'akreditasi': 'A',
});
@override
Widget build(BuildContext context) {
......@@ -94,14 +105,17 @@ class _ListSekolahState extends State<ListSekolah> {
if (snapshot.hasData) {
switch (snapshot.data.status) {
case Status.loading:
return const Center(
child: CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(greenPrimary),
),
);
_enabled = true;
return Column(children: [
Shimmer.fromColors(
baseColor: Colors.grey[300],
highlightColor: Colors.grey[100],
enabled: _enabled,
child: makeSekolahWidget('sekolah', mockSekolah))
]);
break;
case Status.completed:
_enabled = false;
var layanan = snapshot.data.data;
return Column(
children: layanan.map<Widget>((each) {
......@@ -116,6 +130,7 @@ class _ListSekolahState extends State<ListSekolah> {
);
break;
case Status.error:
_enabled = false;
return Center(
child: Text(snapshot.data.data.toString()),
);
......
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