major refactor
Some checks failed
Release / meta (push) Successful in 9s
Release / android-build (push) Failing after 4m3s
Release / linux-build (push) Successful in 5m38s
Release / release-dev (push) Has been skipped
Release / release-master (push) Has been skipped

This commit is contained in:
2025-12-17 16:32:53 +00:00
parent 1239a9dc85
commit 334d6e3e18
29 changed files with 3614 additions and 3501 deletions

View File

@@ -36,48 +36,60 @@ class _TripsPageState extends State<TripsPage> {
return RefreshIndicator(
onRefresh: _refreshTrips,
child: ListView(
child: ListView.builder(
padding: const EdgeInsets.all(16),
physics: const AlwaysScrollableScrollPhysics(),
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Journeys',
style: Theme.of(context).textTheme.labelMedium,
),
const SizedBox(height: 2),
Text(
'Trips',
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
Row(
children: [
IconButton(
onPressed: _refreshTrips,
icon: const Icon(Icons.refresh),
tooltip: 'Refresh trips',
),
],
),
],
),
const SizedBox(height: 12),
if (showLoading)
const Center(
itemCount: () {
if (showLoading) return 2;
if (tripDetails.isEmpty && tripSummaries.isEmpty) return 2;
if (tripDetails.isEmpty) return 1 + tripSummaries.length;
return 1 + tripDetails.length;
}(),
itemBuilder: (context, index) {
if (index == 0) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Journeys',
style: Theme.of(context).textTheme.labelMedium,
),
const SizedBox(height: 2),
Text(
'Trips',
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
IconButton(
onPressed: _refreshTrips,
icon: const Icon(Icons.refresh),
tooltip: 'Refresh trips',
),
],
),
const SizedBox(height: 12),
],
);
}
if (showLoading) {
return const Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 24.0),
child: CircularProgressIndicator(),
),
)
else if (tripDetails.isEmpty && tripSummaries.isEmpty)
Card(
);
}
if (tripDetails.isEmpty && tripSummaries.isEmpty) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
@@ -86,8 +98,8 @@ class _TripsPageState extends State<TripsPage> {
Text(
'No trips yet',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
),
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 8),
const Text(
@@ -96,29 +108,22 @@ class _TripsPageState extends State<TripsPage> {
],
),
),
)
else if (tripDetails.isEmpty)
Column(
children: tripSummaries
.map(
(trip) => Card(
child: ListTile(
title: Text(trip.tripName),
subtitle: Text(
'${trip.tripMileage.toStringAsFixed(1)} mi',
),
),
),
)
.toList(),
)
else
Column(
children: tripDetails
.map((trip) => _buildTripCard(context, trip, isMobile))
.toList(),
),
],
);
}
if (tripDetails.isEmpty) {
final trip = tripSummaries[index - 1];
return Card(
child: ListTile(
title: Text(trip.tripName),
subtitle: Text('${trip.tripMileage.toStringAsFixed(1)} mi'),
),
);
}
final trip = tripDetails[index - 1];
return _buildTripCard(context, trip, isMobile);
},
),
);
}