import 'package:flutter/material.dart'; import 'package:flutter_map/plugin_api.dart'; import 'package:geolocator/geolocator.dart'; import 'package:hris_selfservice_mobile/Screens/Menu/Absensi/absensi_history_screen.dart'; //import 'package:latlong/latlong.dart' as latlong; import 'package:latlong2/latlong.dart' as latlong; class AbsensiScreen extends StatefulWidget { const AbsensiScreen({Key? key}) : super(key: key); @override State createState() => _AbsensiScreenState(); } class _AbsensiScreenState extends State { double long = 49.5; double lat = -0.09; latlong.LatLng point = latlong.LatLng(-6.186729296979901, 106.93023205185953); var location = []; @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; return Scaffold( body: SingleChildScrollView( child: Column( children: [ Container( //Ganti yg ini untuk maps height: size.height * 0.5, child: FlutterMap( options: MapOptions( onTap: (p, point) async{ }, center: point ), children: [ TileLayer( minZoom: 1, maxZoom: 14, backgroundColor: Colors.black54, urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', subdomains: ['a', 'b', 'c'], ), /* MarkerLayer( markers: [point] )*/ ], ) ), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 10), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Container( child: Text("Attendance"), width: double.infinity, alignment: Alignment.center, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomRight, colors: [ Color(0xFFD21404), Color(0xFFFD7267), ]), border: Border.all(color: Colors.black)), ), Container( width: double.infinity, padding: EdgeInsets.all(15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( children: [ Text('Check In'), Text('07.15'), ], ), Column( children: [ Text('Check Out'), Text('16.45'), ], ), ], ), ) ], ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Visibility( visible: true, child: ElevatedButton( onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Check Status Button'))); }, child: Text('Check In'), style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.red)), ), ), Visibility( visible: false, child: ElevatedButton( onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Check Status Button'))); }, child: Text('Check Out'), style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.red)), ), ), ], ), InkWell( child: Container( alignment: Alignment.centerRight, child: TextButton(onPressed: () {}, child: Text('View More...')), ), onTap: () { Navigator.push(context, MaterialPageRoute(builder: (context) => HistoryAbsensi())); }, ), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), Container( width: double.infinity, margin: EdgeInsets.fromLTRB(10, 10, 10, 0), padding: EdgeInsets.all(15), decoration: BoxDecoration(border: Border.all(color: Colors.black)), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('Rabu, 23 November 2022', maxLines: 1), Column( children: [Text('Check In'), Text('07.00')], ), Column( children: [ Text('Check Out'), Text('16.30'), ], ), ], ), Text('Location : Global Service Indonesia', maxLines: 1), ], )), /*SizedBox( */ /*child: GoogleMap( initialCameraPosition: initialCameraPosition, markers: markers, zoomControlsEnabled: false, mapType: MapType.normal, onMapCreated: (GoogleMapController controller) { googleMapController = controller; }, ), ),*/ /* ),*/ ], ), ), /* floatingActionButton: FloatingActionButton.extended( onPressed: () async { Position position = await _determinePosition(); googleMapController .animateCamera(CameraUpdate.newCameraPosition(CameraPosition( target: LatLng(position.latitude, position.longitude), zoom: 14))); markers.clear(); markers.add(Marker(markerId: const MarkerId('currentLocation'), position: LatLng(position.latitude, position.longitude))); setState(() {}); }, label: Text("Current Location"), icon: Icon(Icons.location_history),),*/ ); } } /*_getCurrentLocation() { Geolocator .getCurrentPosition(desiredAccuracy: LocationAccuracy.best, forceAndroidLocationManager: true) .then((Position position) { setState(() { _currentPosition = position; _getAddressFromLatLng(); }); }).catchError((e) { print(e); }); }*/ /* Future _determinePosition() async { bool serviceEnabled; LocationPermission permission; serviceEnabled = await Geolocator.isLocationServiceEnabled(); if (!serviceEnabled) { return Future.error('Location services are disabled'); } permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); if (permission == LocationPermission.denied) { return Future.error("Location permission denied"); } } if (permission == LocationPermission.deniedForever) { return Future.error('Location permissions are permanently denied'); } Position position = await Geolocator.getCurrentPosition(); return position; }*/