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

@@ -39,11 +39,7 @@ class Dashboard extends StatelessWidget {
children: [
_buildHeader(context, auth, stats, data.isHomepageLoading),
const SizedBox(height: 12),
Wrap(
spacing: 12,
runSpacing: 12,
children: metricChips,
),
Wrap(spacing: 12, runSpacing: 12, children: metricChips),
const SizedBox(height: 16),
isWide
? Row(
@@ -71,8 +67,12 @@ class Dashboard extends StatelessWidget {
);
}
Widget _buildHeader(BuildContext context, AuthService auth,
HomepageStats? stats, bool loading) {
Widget _buildHeader(
BuildContext context,
AuthService auth,
HomepageStats? stats,
bool loading,
) {
final greetingName =
stats?.user?.full_name ?? auth.fullName ?? auth.username ?? 'there';
return Row(
@@ -82,10 +82,7 @@ class Dashboard extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Dashboard',
style: Theme.of(context).textTheme.labelMedium,
),
Text('Dashboard', style: Theme.of(context).textTheme.labelMedium),
const SizedBox(height: 2),
Text(
'Welcome back, $greetingName',
@@ -93,14 +90,15 @@ class Dashboard extends StatelessWidget {
),
],
),
if (loading) const Padding(
padding: EdgeInsets.only(right: 8.0),
child: SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(strokeWidth: 2),
if (loading)
const Padding(
padding: EdgeInsets.only(right: 8.0),
child: SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(strokeWidth: 2),
),
),
),
],
);
}
@@ -121,11 +119,13 @@ class Dashboard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(label.toUpperCase(),
style: textTheme.labelSmall?.copyWith(
letterSpacing: 0.7,
color: textTheme.bodySmall?.color?.withOpacity(0.7),
)),
Text(
label.toUpperCase(),
style: textTheme.labelSmall?.copyWith(
letterSpacing: 0.7,
color: textTheme.bodySmall?.color?.withOpacity(0.7),
),
),
const SizedBox(height: 4),
Text(
value,
@@ -203,10 +203,9 @@ class Dashboard extends StatelessWidget {
children: [
Text(
title,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(fontWeight: FontWeight.w700),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
),
),
Row(
mainAxisSize: MainAxisSize.min,
@@ -234,10 +233,7 @@ class Dashboard extends StatelessWidget {
required String emptyMessage,
}) {
if (legs.isEmpty) {
return Text(
emptyMessage,
style: Theme.of(context).textTheme.bodyMedium,
);
return Text(emptyMessage, style: Theme.of(context).textTheme.bodyMedium);
}
return Column(
children: legs.take(5).map((leg) {
@@ -257,10 +253,9 @@ class Dashboard extends StatelessWidget {
if (leg.headcode.isNotEmpty)
Text(
leg.headcode,
style: Theme.of(context)
.textTheme
.labelSmall
?.copyWith(color: Theme.of(context).hintColor),
style: Theme.of(context).textTheme.labelSmall?.copyWith(
color: Theme.of(context).hintColor,
),
),
],
),
@@ -286,7 +281,11 @@ class Dashboard extends StatelessWidget {
}
Widget _buildTripsCard(BuildContext context, DataService data) {
final trips = data.trips;
final trips_unsorted = data.trips;
List trips = [];
if (trips_unsorted.isNotEmpty) {
trips = [...trips_unsorted]..sort((a, b) => b.tripId.compareTo(a.tripId));
}
return _buildCard(
context,
title: 'Trips',