fixed gps page

This commit is contained in:
2023-11-22 23:06:38 +05:30
parent 4e4cfda40b
commit 23fde37e3d
6 changed files with 114 additions and 47 deletions

View File

@ -35,8 +35,10 @@ class _GpsPageState extends State<GpsPage> {
final team_name = indexController.currentUser[0]["user"]['team_name'];
final event_code = indexController.currentUser[0]["user"]["event_code"];
GpsDatabaseHelper db = GpsDatabaseHelper.instance;
gpsData.value = await db.getGPSData(team_name, event_code);
print("--- gps data ${gpsData.value[gpsData.length - 1].lat} ----");
var data = await db.getGPSData(team_name, event_code);
gpsData.value = data;
print("--- gps data ${data} ----");
}
Widget getMarkerShape(GpsData i) {
@ -50,10 +52,11 @@ class _GpsPageState extends State<GpsPage> {
width: 22,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.purple.shade300,
color: Colors.transparent,
border: Border.all(
color: Colors.purple,
width: 3,
color:
i.is_checkin == 0 ? Colors.blueAccent : Colors.green,
width: i.is_checkin == 0 ? 0.4 : 2,
style: BorderStyle.solid)),
child: const Stack(
alignment: Alignment.center,
@ -66,24 +69,26 @@ class _GpsPageState extends State<GpsPage> {
)),
),
Container(
color: Colors.white,
child: Text(
DateTime.fromMicrosecondsSinceEpoch(i.created_at)
.hour
.toString() +
":" +
color: Colors.transparent,
child: i.is_checkin == 1
? Text(
DateTime.fromMicrosecondsSinceEpoch(i.created_at)
.minute
.toString(),
// ":" +
// DateTime.fromMicrosecondsSinceEpoch(i.created_at)
// .second
// .toString(),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
))),
.hour
.toString() +
":" +
DateTime.fromMicrosecondsSinceEpoch(i.created_at)
.minute
.toString(),
// ":" +
// DateTime.fromMicrosecondsSinceEpoch(i.created_at)
// .second
// .toString(),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
))
: Container()),
],
);
}
@ -100,16 +105,7 @@ class _GpsPageState extends State<GpsPage> {
mapController: mapController,
options: MapOptions(
maxZoom: 18.4,
onMapReady: () {
subscription =
mapController!.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveStart) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// do something
}
if (mapEvent is MapEventMoveEnd) {}
});
},
onMapReady: () {},
//center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.isNotEmpty
? indexController.currentBound[0]