Tachostand in Graph hizugefügt

This commit is contained in:
2026-02-20 11:25:26 +01:00
parent 2941354c77
commit a79c55cb14
10 changed files with 331 additions and 525 deletions

View File

@@ -7,6 +7,7 @@ class GraphController extends GetxController {
final sumYearLiters = 0.0.obs; final sumYearLiters = 0.0.obs;
final sumYearPrice = 0.0.obs; final sumYearPrice = 0.0.obs;
final averagePricePerLiter = 0.0.obs; final averagePricePerLiter = 0.0.obs;
final szTachostand = ''.obs;
@override @override
void onInit() { void onInit() {
@@ -44,6 +45,7 @@ class GraphController extends GetxController {
var lastOdometer = double.tryParse(listTankModel.last.szOdometer) ?? 0.0; var lastOdometer = double.tryParse(listTankModel.last.szOdometer) ?? 0.0;
sumYearKm.value = lastOdometer - firstOdometer; sumYearKm.value = lastOdometer - firstOdometer;
szTachostand.value = listTankModel.last.szOdometer;
double totalLiters = 0.0; double totalLiters = 0.0;
double totalPrice = 0.0; double totalPrice = 0.0;

View File

@@ -49,9 +49,17 @@ class GraphPage extends GetView<GraphController> {
DetailInfoCardWidget( DetailInfoCardWidget(
title: 'Jahresstatistik', title: 'Jahresstatistik',
children: [ children: [
DetailStatWidget(
icon: Icons.speed,
label: 'Tachostand',
value: '${graphCtrl.szTachostand.value} KM',
iconColor: Colors.orange.shade900,
valueSize: 24,
valueWeight: FontWeight.bold,
),
DetailStatWidget( DetailStatWidget(
icon: Icons.directions_car, icon: Icons.directions_car,
label: 'Jahreskilometerstand', label: 'Jahreskilometerverbrauch',
value: '${graphCtrl.sumYearKm.value} KM', value: '${graphCtrl.sumYearKm.value} KM',
iconColor: Colors.blue, iconColor: Colors.blue,
valueSize: 24, valueSize: 24,

View File

@@ -15,7 +15,7 @@ echo "================================================"
# Step 1: Build Flutter Web # Step 1: Build Flutter Web
echo "📦 Building Flutter web release..." echo "📦 Building Flutter web release..."
flutter build web --release flutter build web --release --no-wasm-dry-run
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "❌ Build failed!" echo "❌ Build failed!"
@@ -36,18 +36,29 @@ echo "✅ Local webserver folder updated!"
# Step 3: Copy to server # Step 3: Copy to server
echo "📤 Copying to server $SERVER_IP..." echo "📤 Copying to server $SERVER_IP..."
sudo scp -r webserver $SERVER_USER@$SERVER_IP:$SERVER_PATH sudo scp -r webserver/* $SERVER_USER@$SERVER_IP:$SERVER_PATH/
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "❌ Server copy failed!" echo "❌ Server copy failed!"
exit 1 exit 1
fi fi
echo "✅ Files copied to server!"
# Step 4: Restart webserver
echo "🔄 Restarting webserver container..."
ssh $SERVER_USER@$SERVER_IP "cd $SERVER_PATH/installDocker && ./deploy.sh"
if [ $? -ne 0 ]; then
echo "⚠️ Warning: Server restart failed or deploy.sh not found"
echo " You may need to manually restart the webserver"
else
echo "✅ Webserver restarted!"
fi
echo "" echo ""
echo "✅ Update complete!" echo "✅ Update complete!"
echo "================================================" echo "================================================"
echo "Next steps on the server:" echo "Your app should now be updated at:"
echo " ssh $SERVER_USER@$SERVER_IP" echo " http://tank.joshihomeserver.ipv64.net"
echo " cd $SERVER_PATH/installDocker"
echo " ./deploy.sh"
echo "================================================" echo "================================================"

View File

@@ -1 +0,0 @@
61d68266980b7a401e0798b0655eadef

View File

@@ -33,10 +33,10 @@ addEventListener("message", eventListener);
if (!window._flutter) { if (!window._flutter) {
window._flutter = {}; window._flutter = {};
} }
_flutter.buildConfig = {"engineRevision":"3452d735bd38224ef2db85ca763d862d6326b17f","builds":[{"compileTarget":"dart2js","renderer":"canvaskit","mainJsPath":"main.dart.js"},{}]}; _flutter.buildConfig = {"engineRevision":"3452d735bd38224ef2db85ca763d862d6326b17f","builds":[{"compileTarget":"dart2js","renderer":"canvaskit","mainJsPath":"main.dart.js"}]};
_flutter.loader.load({ _flutter.loader.load({
serviceWorkerSettings: { serviceWorkerSettings: {
serviceWorkerVersion: "40261541" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */ serviceWorkerVersion: "151291587" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
} }
}); });

View File

@@ -1,18 +0,0 @@
# Flutter Tank Web App - Deployment Dockerfile
FROM nginx:alpine
# Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
# Copy the built Flutter web app (exclude installDocker folder)
COPY . /usr/share/nginx/html/
RUN rm -rf /usr/share/nginx/html/installDocker
# Copy nginx configuration
COPY installDocker/nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80 (internally, mapped to 8888 externally)
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,93 +0,0 @@
# Flutter Tank Web App - Docker Deployment
Dieser Ordner enthält alle notwendigen Dateien für das Docker-Deployment der Flutter Tank Web App.
## 📋 Voraussetzungen
- Docker muss auf dem Server installiert sein
- Port 8888 muss verfügbar sein
## 🚀 Deployment
### 1. Ordner auf Server kopieren
Kopieren Sie den kompletten `webserver` Ordner auf Ihren Server:
```bash
scp -r webserver user@your-server:/path/to/destination/
```
### 2. In den installDocker Ordner wechseln
```bash
cd /path/to/destination/webserver/installDocker
```
### 3. Deployment ausführen
```bash
./deploy.sh
```
Das Script führt automatisch folgende Schritte aus:
- Stoppt und entfernt bestehende Container
- Baut das Docker Image
- Startet den Container auf Port 8888
- Zeigt den Status an
## 🌐 Zugriff
Nach erfolgreichem Deployment ist die App erreichbar unter:
- **Web App:** `http://your-server:8888`
- **Health Check:** `http://your-server:8888/health`
## 🔧 Nützliche Befehle
```bash
# Logs anzeigen
docker logs flutter-tank-web-container
# Logs live verfolgen
docker logs -f flutter-tank-web-container
# Container stoppen
docker stop flutter-tank-web-container
# Container neustarten
docker restart flutter-tank-web-container
# Container und Image entfernen
docker stop flutter-tank-web-container
docker rm flutter-tank-web-container
docker rmi flutter-tank-web
```
## 📁 Dateien
- **Dockerfile** - Docker Image Definition (nginx:alpine mit Flutter Web Build)
- **nginx.conf** - Nginx Konfiguration mit Gzip, Caching und Flutter Routing
- **deploy.sh** - Automatisches Deployment-Script
- **README.md** - Diese Dokumentation
## 🔒 Sicherheit
Die nginx.conf enthält bereits:
- Security Headers (X-Frame-Options, X-Content-Type-Options, X-XSS-Protection)
- Gzip Kompression für bessere Performance
- Caching für statische Assets (1 Jahr)
- Client-side Routing Support für Flutter
## 🐛 Troubleshooting
**Container startet nicht:**
```bash
docker logs flutter-tank-web-container
```
**Port bereits in Verwendung:**
Ändern Sie in `deploy.sh` die Variable `PORT=8888` auf einen anderen Port.
**Berechtigungsprobleme:**
```bash
chmod +x deploy.sh
```

View File

@@ -1,68 +0,0 @@
#!/bin/bash
# Flutter Tank Web App - Deployment Script
# This script builds and deploys the web app in a Docker container on port 8888
set -e
# Configuration
IMAGE_NAME="flutter-tank-web"
CONTAINER_NAME="flutter-tank-web-container"
PORT=8888
echo "🚀 Starting deployment of Flutter Tank Web App..."
echo "================================================"
# Stop and remove existing container if running
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "⏹️ Stopping existing container..."
docker stop $CONTAINER_NAME
fi
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then
echo "🗑️ Removing existing container..."
docker rm $CONTAINER_NAME
fi
# Remove old image (optional - comment out to keep old images)
if [ "$(docker images -q $IMAGE_NAME)" ]; then
echo "🗑️ Removing old image..."
docker rmi $IMAGE_NAME || true
fi
# Build new Docker image (from parent directory to include web files)
echo "🔨 Building Docker image..."
cd ..
docker build -f installDocker/Dockerfile -t $IMAGE_NAME .
cd installDocker
# Run container
echo "🚀 Starting container on port $PORT..."
docker run -d \
--name $CONTAINER_NAME \
-p $PORT:80 \
--restart unless-stopped \
$IMAGE_NAME
# Wait a moment for container to start
sleep 2
# Check if container is running
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo ""
echo "✅ Deployment successful!"
echo "================================================"
echo "🌐 Application is running at: http://localhost:$PORT"
echo "🏥 Health check: http://localhost:$PORT/health"
echo ""
echo "Useful commands:"
echo " View logs: docker logs $CONTAINER_NAME"
echo " Follow logs: docker logs -f $CONTAINER_NAME"
echo " Stop: docker stop $CONTAINER_NAME"
echo " Restart: docker restart $CONTAINER_NAME"
echo "================================================"
else
echo "❌ Error: Container failed to start"
echo "Check logs with: docker logs $CONTAINER_NAME"
exit 1
fi

View File

@@ -1,35 +0,0 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Flutter web routing - handle client-side routing
location / {
try_files $uri $uri/ /index.html;
}
# Health check endpoint
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
}

File diff suppressed because it is too large Load Diff