added location on view attendence logs

This commit is contained in:
Vaibhav Surve 2025-05-03 15:53:48 +05:30
parent dcbb5bf34a
commit 7a103c8f22

View File

@ -22,6 +22,7 @@ import 'package:marco/view/layouts/layout.dart';
import 'package:marco/controller/dashboard/attendance_screen_controller.dart';
import 'package:intl/intl.dart';
import 'package:marco/controller/permission_controller.dart';
import 'package:url_launcher/url_launcher.dart';
class AttendanceScreen extends StatefulWidget {
const AttendanceScreen({super.key});
@ -448,9 +449,47 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
log.formattedTime ?? '-',
fontWeight: 600)),
Expanded(
child: MyText.bodyMedium(
log.comment ?? '-',
fontWeight: 600)),
child: Row(
children: [
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(
child: GestureDetector(
onTap: () {