Add display of legs and top traction, adjust colour based on device theme

This commit is contained in:
2025-07-25 02:03:10 +01:00
parent 652e83bf38
commit 985eddb35a
15 changed files with 316 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mileograph_flutter/services/authservice.dart';
import 'package:mileograph_flutter/services/dataService.dart';
import 'package:mileograph_flutter/components/dashboard/topTractionPanel.dart';
import 'package:provider/provider.dart';
@@ -22,36 +23,70 @@ class DashboardHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
return Column(
children: [
Column(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
auth.fullName ?? "Unknown",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
Text.rich(
TextSpan(
children: [
TextSpan(text: "Total Mileage: "),
TextSpan(
text: data.homepageStats?.totalMileage.toString() ?? "0",
Row(
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(text: "Total Mileage: "),
TextSpan(
text:
data.homepageStats?.totalMileage
.toString() ??
"0",
),
],
),
),
Text.rich(
TextSpan(
children: [
TextSpan(text: DateTime.now().year.toString()),
TextSpan(text: " Mileage: "),
TextSpan(
text: data
.getMileageForCurrentYear()
.toString(),
),
],
),
),
],
),
),
],
),
),
Text.rich(
TextSpan(
children: [
TextSpan(text: DateTime.now().year.toString()),
TextSpan(text: " Mileage: "),
TextSpan(text: data.getMileageForCurrentYear().toString()),
],
),
),
Card(
child: Padding(
padding: EdgeInsets.all(8),
child: Column(
children: [
Text("Total Winners: 123"),
Text("Average mileage: 45.6"),
],
),
),
),
],
),
],
),
Expanded(
child: ListView(
scrollDirection: Axis.vertical,
children: [TopTractionPanel()],
),
),
],
);
}