Created
May 8, 2020 14:27
-
-
Save becek2n/06a761f903478614e1552cace6204d4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:listview_bind_api/APIService.dart'; | |
import 'package:listview_bind_api/AttendanceModel.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:listview_bind_api/AttendanceRepositories.dart'; | |
import 'package:listview_bind_api/ResultModel.dart'; | |
import 'AttendanceRepositories.dart'; | |
class AttendanceScreen extends StatefulWidget { | |
const AttendanceScreen({Key key}) : super(key: key); | |
@override | |
_AttendanceScreenState createState() => _AttendanceScreenState(); | |
} | |
class _AttendanceScreenState extends State<AttendanceScreen>{ | |
final String urlHost = 'http://172.20.10.10/'; | |
List<AttendanceModel> _attendance = <AttendanceModel>[]; | |
ResultModel oResult = ResultModel(); | |
@override | |
void initState() { | |
super.initState(); | |
_getData(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return ListView.separated( | |
separatorBuilder: (context, index) => Divider( | |
color: Colors.black, | |
), | |
itemCount: _attendance.length, | |
itemBuilder: (context, index) { | |
return ListTile( | |
title: Text(_attendance[index].checkinday), | |
leading: Container( | |
margin: EdgeInsets.only(left: 6.0), | |
child: Image.network(_attendance[index].photo.replaceAll("C:/inetpub/wwwroot/", urlHost), height: 50.0, fit: BoxFit.fill,) | |
), | |
trailing: Text(_attendance[index].checkinstart), | |
subtitle: Text(_attendance[index].checkinworked), | |
); | |
}, | |
); | |
} | |
void _getData() { | |
APIWeb().load(AttendanceRepositories.getData).then((attendance) => { | |
setState(() => { | |
_attendance = attendance | |
}) | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment