added location on view attendence logs
This commit is contained in:
parent
dcbb5bf34a
commit
7a103c8f22
@ -22,6 +22,7 @@ import 'package:marco/view/layouts/layout.dart';
|
|||||||
import 'package:marco/controller/dashboard/attendance_screen_controller.dart';
|
import 'package:marco/controller/dashboard/attendance_screen_controller.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:marco/controller/permission_controller.dart';
|
import 'package:marco/controller/permission_controller.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class AttendanceScreen extends StatefulWidget {
|
class AttendanceScreen extends StatefulWidget {
|
||||||
const AttendanceScreen({super.key});
|
const AttendanceScreen({super.key});
|
||||||
@ -448,9 +449,47 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
log.formattedTime ?? '-',
|
log.formattedTime ?? '-',
|
||||||
fontWeight: 600)),
|
fontWeight: 600)),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: MyText.bodyMedium(
|
child: Row(
|
||||||
log.comment ?? '-',
|
children: [
|
||||||
fontWeight: 600)),
|
if (log.latitude != null &&
|
||||||
|
log.longitude != null)
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
final url =
|
||||||
|
'https://www.google.com/maps/search/?api=1&query=${log.latitude},${log.longitude}';
|
||||||
|
if (await canLaunchUrl(
|
||||||
|
Uri.parse(url))) {
|
||||||
|
await launchUrl(
|
||||||
|
Uri.parse(url),
|
||||||
|
mode: LaunchMode
|
||||||
|
.externalApplication);
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
context)
|
||||||
|
.showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text(
|
||||||
|
'Could not open Google Maps')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: 4.0),
|
||||||
|
child: Icon(Icons.location_on,
|
||||||
|
size: 18,
|
||||||
|
color: Colors.blue),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: MyText.bodyMedium(
|
||||||
|
log.comment ?? '-',
|
||||||
|
fontWeight: 600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user