91 lines
2.7 KiB
Dart
91 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:libacflutter/Constants.dart';
|
|
import 'package:timetrack/data.dart';
|
|
|
|
class WorkDataPage extends StatefulWidget {
|
|
const WorkDataPage({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return _WorkData();
|
|
}
|
|
}
|
|
|
|
class _WorkData extends State<WorkDataPage> {
|
|
void call() {
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
SessionData.Calls.WorkDataCallback = call;
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
SessionData.Calls.WorkDataCallback = null;
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("Time Tracker - Work Data"),
|
|
backgroundColor: LibACFlutterConstants.TITLEBAR_COLOR,
|
|
),
|
|
body: Padding(
|
|
padding: EdgeInsets.all(8),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
// This is where we'll display all the work data, like total earnings, and present a editor
|
|
Text(
|
|
"Total saved GPS Positions: ${SessionData.positions.length}",
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
Text(
|
|
"Start Date & Time: ${SessionData.StartTime.toString()}",
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
if (SessionData.IsReadOnly)
|
|
Text(
|
|
"End Date & Time: ${SessionData.EndTime.toString()}",
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
|
|
Text(
|
|
"Total time worked: ${SessionData.GetTotalTimeWorked(SessionData.StartTime, SessionData.EndTime)}",
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
if (SessionData.StartTime.year == 0)
|
|
ListTile(
|
|
title: Text("ERROR"),
|
|
subtitle: Text(
|
|
"This TTX session file appears to have been saved in an early alpha version. It does not contain the Start time or End timestamp information.",
|
|
),
|
|
tileColor: LibACFlutterConstants.TITLEBAR_COLOR,
|
|
),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
Text(
|
|
"Total Estimated Miles: ${SessionData.GetTotalMilesAsString()}\n(Note: The miles displayed above may not be 100% accurate)",
|
|
style: TextStyle(fontSize: 24),
|
|
),
|
|
|
|
SizedBox(height: 40),
|
|
ElevatedButton(
|
|
onPressed: () async {
|
|
// Process data export to GPX format.
|
|
},
|
|
child: Text("Export as GPX"),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|