Fix trips on entry page, correct order of trips on dashboard and trip page, move to prod api
Some checks failed
Release / meta (push) Successful in 17s
Release / linux-build (push) Successful in 1m33s
Release / android-build (push) Successful in 15m28s
Release / release-dev (push) Failing after 4s
Release / release-master (push) Successful in 29s

This commit is contained in:
2025-12-12 09:17:18 +00:00
parent 53eaf0b4af
commit 292163bda6
6 changed files with 180 additions and 110 deletions

View File

@@ -46,11 +46,15 @@ class _TripsPageState extends State<TripsPage> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Journeys',
style: Theme.of(context).textTheme.labelMedium),
Text(
'Journeys',
style: Theme.of(context).textTheme.labelMedium,
),
const SizedBox(height: 2),
Text('Trips',
style: Theme.of(context).textTheme.headlineSmall),
Text(
'Trips',
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
Row(
@@ -81,10 +85,9 @@ class _TripsPageState extends State<TripsPage> {
children: [
Text(
'No trips yet',
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(fontWeight: FontWeight.w700),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 8),
const Text(
@@ -101,8 +104,9 @@ class _TripsPageState extends State<TripsPage> {
(trip) => Card(
child: ListTile(
title: Text(trip.tripName),
subtitle:
Text('${trip.tripMileage.toStringAsFixed(1)} mi'),
subtitle: Text(
'${trip.tripMileage.toStringAsFixed(1)} mi',
),
),
),
)
@@ -110,8 +114,9 @@ class _TripsPageState extends State<TripsPage> {
)
else
Column(
children:
tripDetails.map((trip) => _buildTripCard(context, trip, isMobile)).toList(),
children: tripDetails
.map((trip) => _buildTripCard(context, trip, isMobile))
.toList(),
),
],
),
@@ -134,10 +139,9 @@ class _TripsPageState extends State<TripsPage> {
children: [
Text(
trip.name,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(fontWeight: FontWeight.w700),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
),
),
Text(
'${trip.mileage.toStringAsFixed(1)} mi · ${trip.legCount} legs',
@@ -145,10 +149,20 @@ class _TripsPageState extends State<TripsPage> {
),
],
),
IconButton(
icon: const Icon(Icons.open_in_new),
tooltip: 'Details',
onPressed: () => _showTripDetail(context, trip),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(
icon: const Icon(Icons.train),
tooltip: 'Traction',
onPressed: () => _showTripWinners(context, trip),
),
IconButton(
icon: const Icon(Icons.open_in_new),
tooltip: 'Details',
onPressed: () => _showTripDetail(context, trip),
),
],
),
],
),
@@ -168,10 +182,9 @@ class _TripsPageState extends State<TripsPage> {
),
trailing: Text(
leg.mileage?.toStringAsFixed(1) ?? '-',
style: Theme.of(context)
.textTheme
.labelLarge
?.copyWith(fontWeight: FontWeight.bold),
style: Theme.of(context).textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
);
}).toList(),
@@ -215,10 +228,9 @@ class _TripsPageState extends State<TripsPage> {
),
Text(
trip.name,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(fontWeight: FontWeight.bold),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const Spacer(),
Text('${trip.mileage.toStringAsFixed(1)} mi'),
@@ -237,9 +249,63 @@ class _TripsPageState extends State<TripsPage> {
subtitle: Text(_formatDate(leg.beginTime)),
trailing: Text(
leg.mileage?.toStringAsFixed(1) ?? '-',
style: Theme.of(context)
.textTheme
.labelLarge
style: Theme.of(context).textTheme.labelLarge
?.copyWith(fontWeight: FontWeight.bold),
),
);
},
),
),
],
),
),
);
},
);
}
void _showTripWinners(BuildContext context, TripDetail trip) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (_) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.of(context).pop(),
),
Text(
trip.name,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const Spacer(),
Text('${trip.mileage.toStringAsFixed(1)} mi'),
],
),
const SizedBox(height: 8),
SizedBox(
height: MediaQuery.of(context).size.height * 0.6,
child: ListView.builder(
itemCount: trip.legs.length,
itemBuilder: (context, index) {
final leg = trip.legs[index];
return ListTile(
leading: const Icon(Icons.train),
title: Text('${leg.start}${leg.end}'),
subtitle: Text(_formatDate(leg.beginTime)),
trailing: Text(
leg.mileage?.toStringAsFixed(1) ?? '-',
style: Theme.of(context).textTheme.labelLarge
?.copyWith(fontWeight: FontWeight.bold),
),
);