123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- 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<AbsensiScreen> createState() => _AbsensiScreenState();
- }
-
- class _AbsensiScreenState extends State<AbsensiScreen> {
- 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: <Widget>[
- 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<Position> _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;
- }*/
|