Files
ertl_filament_verwaltung/lib/widgets/bauteil_preis_uebersicht.dart
T
2026-10-29 15:03:48 +01:00

60 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/bauteil_controller.dart';
import '../helper/display_formats.dart';
import '../theme/app_theme.dart';
class BauteilPreisUebersicht extends StatelessWidget {
const BauteilPreisUebersicht({super.key, required this.controller});
final BauteilController controller;
@override
Widget build(BuildContext context) => Obx(() {
final preis = controller.preisDetails.value;
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text(
'Preiskalkulation',
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 18),
),
const SizedBox(height: 12),
if (preis != null) ...[
Text(
'Filamentkosten (Bauteil): ${DisplayFormats.currency(preis.materialKosten)}',
),
const SizedBox(height: 6),
Text(
'Abfallkosten: ${DisplayFormats.currency(preis.abfallKosten)}',
),
const SizedBox(height: 6),
Text(
'Aufschlag (${DisplayFormats.number(preis.aufschlagProzent)} %): ${DisplayFormats.currency(preis.aufschlagKosten)}',
),
] else
const Text(
'Für die Berechnung Gewicht, Abfallmenge und Filament auswählen. Bei mehreren Rollen zusätzlich den Verbrauch je Rolle passend zum Gesamtgewicht eingeben.',
style: TextStyle(color: AppTheme.muted, height: 1.5),
),
const SizedBox(height: 16),
TextFormField(
controller: controller.gesamtpreisController,
readOnly: true,
decoration: const InputDecoration(
labelText: 'Gesamtpreis (automatisch)',
suffixText: '€',
),
),
],
),
);
});
}