No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

absensi_screen.dart 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_map/plugin_api.dart';
  3. import 'package:geolocator/geolocator.dart';
  4. import 'package:hris_selfservice_mobile/Screens/Menu/Absensi/absensi_history_screen.dart';
  5. //import 'package:latlong/latlong.dart' as latlong;
  6. import 'package:latlong2/latlong.dart';
  7. class AbsensiScreen extends StatefulWidget {
  8. const AbsensiScreen({Key? key}) : super(key: key);
  9. @override
  10. State<AbsensiScreen> createState() => _AbsensiScreenState();
  11. }
  12. class _AbsensiScreenState extends State<AbsensiScreen> {
  13. double long = 49.5;
  14. double lat = -0.09;
  15. //latlong.LatLng point = latlong.LatLng(-6.186729296979901, 106.93023205185953);
  16. var location = [];
  17. @override
  18. Widget build(BuildContext context) {
  19. var size = MediaQuery.of(context).size;
  20. return Scaffold(
  21. body: SingleChildScrollView(
  22. child: Column(
  23. children: [
  24. Container(
  25. //Ganti yg ini untuk maps
  26. height: size.height * 0.5,
  27. child: FlutterMap(
  28. options: MapOptions(
  29. ),
  30. children: [
  31. TileLayer(
  32. minZoom: 1,
  33. maxZoom: 18,
  34. backgroundColor: Colors.black54,
  35. urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
  36. subdomains: ['a', 'b', 'c'],
  37. )
  38. ],
  39. )
  40. ),
  41. Container(
  42. width: double.infinity,
  43. margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
  44. decoration:
  45. BoxDecoration(border: Border.all(color: Colors.black)),
  46. child: Column(
  47. children: <Widget>[
  48. Container(
  49. child: Text("Attendance"),
  50. width: double.infinity,
  51. alignment: Alignment.center,
  52. decoration: BoxDecoration(
  53. gradient: LinearGradient(
  54. begin: Alignment.topRight,
  55. end: Alignment.bottomRight,
  56. colors: [
  57. Color(0xFFD21404),
  58. Color(0xFFFD7267),
  59. ]),
  60. border: Border.all(color: Colors.black)),
  61. ),
  62. Container(
  63. width: double.infinity,
  64. padding: EdgeInsets.all(15),
  65. child: Row(
  66. mainAxisAlignment: MainAxisAlignment.spaceAround,
  67. children: [
  68. Column(
  69. children: [
  70. Text('Check In'),
  71. Text('07.15'),
  72. ],
  73. ),
  74. Column(
  75. children: [
  76. Text('Check Out'),
  77. Text('16.45'),
  78. ],
  79. ),
  80. ],
  81. ),
  82. )
  83. ],
  84. ),
  85. ),
  86. Row(
  87. mainAxisAlignment: MainAxisAlignment.center,
  88. children: [
  89. Visibility(
  90. visible: true,
  91. child: ElevatedButton(
  92. onPressed: () {
  93. ScaffoldMessenger.of(context).showSnackBar(
  94. const SnackBar(content: Text('Check Status Button')));
  95. },
  96. child: Text('Check In'),
  97. style: ButtonStyle(
  98. backgroundColor: MaterialStateProperty.all(Colors.red)),
  99. ),
  100. ),
  101. Visibility(
  102. visible: false,
  103. child: ElevatedButton(
  104. onPressed: () {
  105. ScaffoldMessenger.of(context).showSnackBar(
  106. const SnackBar(content: Text('Check Status Button')));
  107. },
  108. child: Text('Check Out'),
  109. style: ButtonStyle(
  110. backgroundColor: MaterialStateProperty.all(Colors.red)),
  111. ),
  112. ),
  113. ],
  114. ),
  115. InkWell(
  116. child: Container(
  117. alignment: Alignment.centerRight,
  118. child:
  119. TextButton(onPressed: () {}, child: Text('View More...')),
  120. ),
  121. onTap: () {
  122. Navigator.push(context,
  123. MaterialPageRoute(builder: (context) => HistoryAbsensi()));
  124. },
  125. ),
  126. Container(
  127. width: double.infinity,
  128. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  129. padding: EdgeInsets.all(15),
  130. decoration:
  131. BoxDecoration(border: Border.all(color: Colors.black)),
  132. child: Column(
  133. children: [
  134. Row(
  135. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  136. children: [
  137. Text('Rabu, 23 November 2022', maxLines: 1),
  138. Column(
  139. children: [Text('Check In'), Text('07.00')],
  140. ),
  141. Column(
  142. children: [
  143. Text('Check Out'),
  144. Text('16.30'),
  145. ],
  146. ),
  147. ],
  148. ),
  149. Text('Location : Global Service Indonesia', maxLines: 1),
  150. ],
  151. )),
  152. Container(
  153. width: double.infinity,
  154. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  155. padding: EdgeInsets.all(15),
  156. decoration:
  157. BoxDecoration(border: Border.all(color: Colors.black)),
  158. child: Column(
  159. children: [
  160. Row(
  161. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  162. children: [
  163. Text('Rabu, 23 November 2022', maxLines: 1),
  164. Column(
  165. children: [Text('Check In'), Text('07.00')],
  166. ),
  167. Column(
  168. children: [
  169. Text('Check Out'),
  170. Text('16.30'),
  171. ],
  172. ),
  173. ],
  174. ),
  175. Text('Location : Global Service Indonesia', maxLines: 1),
  176. ],
  177. )),
  178. Container(
  179. width: double.infinity,
  180. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  181. padding: EdgeInsets.all(15),
  182. decoration:
  183. BoxDecoration(border: Border.all(color: Colors.black)),
  184. child: Column(
  185. children: [
  186. Row(
  187. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  188. children: [
  189. Text('Rabu, 23 November 2022', maxLines: 1),
  190. Column(
  191. children: [Text('Check In'), Text('07.00')],
  192. ),
  193. Column(
  194. children: [
  195. Text('Check Out'),
  196. Text('16.30'),
  197. ],
  198. ),
  199. ],
  200. ),
  201. Text('Location : Global Service Indonesia', maxLines: 1),
  202. ],
  203. )),
  204. Container(
  205. width: double.infinity,
  206. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  207. padding: EdgeInsets.all(15),
  208. decoration:
  209. BoxDecoration(border: Border.all(color: Colors.black)),
  210. child: Column(
  211. children: [
  212. Row(
  213. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  214. children: [
  215. Text('Rabu, 23 November 2022', maxLines: 1),
  216. Column(
  217. children: [Text('Check In'), Text('07.00')],
  218. ),
  219. Column(
  220. children: [
  221. Text('Check Out'),
  222. Text('16.30'),
  223. ],
  224. ),
  225. ],
  226. ),
  227. Text('Location : Global Service Indonesia', maxLines: 1),
  228. ],
  229. )),
  230. Container(
  231. width: double.infinity,
  232. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  233. padding: EdgeInsets.all(15),
  234. decoration:
  235. BoxDecoration(border: Border.all(color: Colors.black)),
  236. child: Column(
  237. children: [
  238. Row(
  239. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  240. children: [
  241. Text('Rabu, 23 November 2022', maxLines: 1),
  242. Column(
  243. children: [Text('Check In'), Text('07.00')],
  244. ),
  245. Column(
  246. children: [
  247. Text('Check Out'),
  248. Text('16.30'),
  249. ],
  250. ),
  251. ],
  252. ),
  253. Text('Location : Global Service Indonesia', maxLines: 1),
  254. ],
  255. )),
  256. Container(
  257. width: double.infinity,
  258. margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
  259. padding: EdgeInsets.all(15),
  260. decoration:
  261. BoxDecoration(border: Border.all(color: Colors.black)),
  262. child: Column(
  263. children: [
  264. Row(
  265. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  266. children: [
  267. Text('Rabu, 23 November 2022', maxLines: 1),
  268. Column(
  269. children: [Text('Check In'), Text('07.00')],
  270. ),
  271. Column(
  272. children: [
  273. Text('Check Out'),
  274. Text('16.30'),
  275. ],
  276. ),
  277. ],
  278. ),
  279. Text('Location : Global Service Indonesia', maxLines: 1),
  280. ],
  281. )),
  282. /*SizedBox(
  283. */ /*child: GoogleMap(
  284. initialCameraPosition: initialCameraPosition,
  285. markers: markers,
  286. zoomControlsEnabled: false,
  287. mapType: MapType.normal,
  288. onMapCreated: (GoogleMapController controller) {
  289. googleMapController = controller;
  290. },
  291. ),
  292. ),*/ /*
  293. ),*/
  294. ],
  295. ),
  296. ),
  297. /* floatingActionButton: FloatingActionButton.extended(
  298. onPressed: () async {
  299. Position position = await _determinePosition();
  300. googleMapController
  301. .animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
  302. target: LatLng(position.latitude, position.longitude),
  303. zoom: 14)));
  304. markers.clear();
  305. markers.add(Marker(markerId: const MarkerId('currentLocation'),
  306. position: LatLng(position.latitude, position.longitude)));
  307. setState(() {});
  308. },
  309. label: Text("Current Location"),
  310. icon: Icon(Icons.location_history),),*/
  311. );
  312. }
  313. }
  314. /*_getCurrentLocation() {
  315. Geolocator
  316. .getCurrentPosition(desiredAccuracy: LocationAccuracy.best, forceAndroidLocationManager: true)
  317. .then((Position position) {
  318. setState(() {
  319. _currentPosition = position;
  320. _getAddressFromLatLng();
  321. });
  322. }).catchError((e) {
  323. print(e);
  324. });
  325. }*/
  326. /*
  327. Future<Position> _determinePosition() async {
  328. bool serviceEnabled;
  329. LocationPermission permission;
  330. serviceEnabled = await Geolocator.isLocationServiceEnabled();
  331. if (!serviceEnabled) {
  332. return Future.error('Location services are disabled');
  333. }
  334. permission = await Geolocator.checkPermission();
  335. if (permission == LocationPermission.denied) {
  336. permission = await Geolocator.requestPermission();
  337. if (permission == LocationPermission.denied) {
  338. return Future.error("Location permission denied");
  339. }
  340. }
  341. if (permission == LocationPermission.deniedForever) {
  342. return Future.error('Location permissions are permanently denied');
  343. }
  344. Position position = await Geolocator.getCurrentPosition();
  345. return position;
  346. }*/