Files
ertl_filament_verwaltung/lib/widgets/anwendung_form.dart
T
2026-10-28 14:07:40 +01:00

122 lines
4.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/anwendung_controller.dart';
import '../helper/input_validators.dart';
import 'entry_panel.dart';
class AnwendungForm extends StatelessWidget {
const AnwendungForm({super.key, required this.controller});
final AnwendungController controller;
@override
Widget build(BuildContext context) {
final filament = controller.filament.value!;
return EntryPanel(
title: 'Verarbeitungsprofil bearbeiten',
subtitle:
'${filament.marke} · ${filament.material} · ${filament.farbe}\n'
'Speichere die Einstellungen für dieses Filament als Profil.',
child: Form(
key: controller.formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
EntryFieldGrid(
children: [
TextFormField(
controller: controller.empfohleneDrucktemperaturController,
decoration: const InputDecoration(
labelText: 'Empfohlene Drucktemperatur von–bis',
hintText: 'z. B. 220–260 °C',
),
),
TextFormField(
controller: controller.empfohlenerHeizbettbereichController,
decoration: const InputDecoration(
labelText: 'Empfohlener Heizbettbereich von–bis',
hintText: 'z. B. 0–60 °C',
),
),
],
),
const SizedBox(height: 16),
EntryFieldGrid(
children: [
EntryNumberField(
controller: controller.druckController,
label: 'Nozzletemperatur',
unit: '°C',
validator: InputValidators.positive,
),
EntryNumberField(
controller: controller.druckbettController,
label: 'Druckbetttemperatur',
unit: '°C',
validator: InputValidators.nonNegative,
),
],
),
const SizedBox(height: 16),
Material(
color: Colors.transparent,
child: Obx(
() => SwitchListTile.adaptive(
contentPadding: EdgeInsets.zero,
title: const Text('Bauraum geschlossen'),
subtitle: Text(
controller.bauraumGeschlossen.value ? 'Ja' : 'Nein',
),
value: controller.bauraumGeschlossen.value,
onChanged: (value) =>
controller.bauraumGeschlossen.value = value,
),
),
),
const SizedBox(height: 16),
EntryNumberField(
controller: controller.bauraumController,
label: 'Bauraumtemperatur (optional)',
unit: '°C',
validator: (value) =>
InputValidators.nonNegative(value, optional: true),
),
const SizedBox(height: 16),
TextFormField(
controller: controller.sonstigesController,
minLines: 3,
maxLines: 6,
decoration: const InputDecoration(
labelText: 'Sonstiges (optional)',
alignLabelWithHint: true,
hintText:
'Zum Beispiel Geschwindigkeit, Kühlung oder Besonderheiten',
),
),
const SizedBox(height: 24),
Obx(
() => FilledButton.icon(
onPressed: controller.isSaving.value
? null
: controller.saveAnwendung,
icon: const Icon(Icons.save_outlined),
label: Text(
controller.isSaving.value
? 'Wird gespeichert …'
: 'Verarbeitungsprofil speichern',
),
),
),
Obx(
() => EntryMessage(
message: controller.message.value,
hasError: controller.hasError.value,
),
),
],
),
),
);
}
}