MyNewAppWriteTankApp/lib/pages/tanklist/tanklist_view.dart
2025-08-25 14:22:10 +02:00

130 lines
5.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import './tanklist_controller.dart';
import './widgets/my_list_tile_item.dart';
class TanklistPage extends GetView<TanklistController> {
static const namedRoute = '/tank-stop-liste-page';
const TanklistPage({super.key});
@override
Widget build(BuildContext context) {
var tankListCtrl = controller;
return PopScope(
canPop: false,
child: SafeArea(
child: Scaffold(
appBar: AppBar(
shadowColor: Colors.grey,
title: Text('Tankstops'),
centerTitle: true,
//backgroundColor: Colors.grey.shade600,
actions: [
IconButton(
icon: Icon(Icons.add_chart, color: Colors.grey.shade300),
onPressed: () async {
// Handle go to Chart View
tankListCtrl.goToChartView();
},
),
IconButton(
icon: Icon(Icons.logout, color: Colors.grey.shade300),
onPressed: () async {
// Handle logout logic here
tankListCtrl.logoutSessionAndGoToLoginPage();
},
),
],
),
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment
.end, // Positioniere die Buttons am unteren Ende
crossAxisAlignment: CrossAxisAlignment.end, // Richte sie rechts aus
mainAxisSize: MainAxisSize.min, // Nimm nur den benötigten Platz ein
children: [
FloatingActionButton(
onPressed: () => tankListCtrl.goToInputPage(),
backgroundColor: Colors.blue,
child: Icon(Icons.add),
),
],
),
body: Obx(() => tankListCtrl.isloadingList.value == false
? Padding(
padding: EdgeInsetsGeometry.only(left: 25, right: 25),
child: Column(
children: [
SizedBox(
child: Column(
children: [
Text(tankListCtrl.szRxYear.value, style: TextStyle(fontSize: 25, color: Colors.orange)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
Text('Jahresverbrauch', style: TextStyle(fontSize: 14)),
Text( tankListCtrl.szRxSummeYearLiter.value, style: TextStyle(fontSize: 20, color: Colors.orange)),
],
),
Column(
children: [
Text('Jahressumme', style: TextStyle(fontSize: 14)),
Text(tankListCtrl.szRxSummePrice.value, style: TextStyle(fontSize: 20, color: Colors.orange)),
],
),
],
),
],
),
),
Divider(color: Colors.grey.shade200, height: 0.0,),
Expanded(
child: ListView.builder(
padding: EdgeInsets.only(top: 8, bottom: 8),
physics: const BouncingScrollPhysics(),
itemBuilder: ((BuildContext context, int index) {
var item = tankListCtrl.rxTankListActualYear[index];
return Column(
children: [
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.blue.withValues(
alpha: 0.35,
), // Die Farbe des Schattens
spreadRadius:
1, // Wie weit sich der Schatten ausbreitet
blurRadius:
1, // Wie stark der Schatten verschwommen ist
offset: const Offset(
0,
3,
), // Der Versatz des Schattens (x, y)
),
],
),
child: MyListTileItem(listItem: item),
),
SizedBox(height: 15),
],
);
}),
itemCount: tankListCtrl.rxTankListActualYear.length,
),
),
],
),
)
: Center(
child: CircularProgressIndicator(
color: Colors.blue,
),
)),
),
),
);
}
}