76 lines
2.9 KiB
Dart
76 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../controller/anwendung_controller.dart';
|
|
import '../helper/display_formats.dart';
|
|
import '../widgets/anwendung_form.dart';
|
|
import '../widgets/entry_panel.dart';
|
|
|
|
class AnwendungView extends GetView<AnwendungController> {
|
|
static const routeName = '/anwendung-view';
|
|
const AnwendungView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
appBar: AppBar(title: const Text('Filament verarbeiten')),
|
|
body: SafeArea(
|
|
top: false,
|
|
child: Align(
|
|
alignment: Alignment.topCenter,
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 1000),
|
|
child: Obx(() {
|
|
if (controller.filament.value == null) {
|
|
return const Center(
|
|
child: Padding(
|
|
padding: EdgeInsets.all(24),
|
|
child: Text(
|
|
'Das ausgewählte Filament wurde nicht gefunden. Bitte wähle ein gespeichertes Filament aus.',
|
|
),
|
|
),
|
|
);
|
|
}
|
|
return CustomScrollView(
|
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
|
slivers: [
|
|
SliverPadding(
|
|
padding: const EdgeInsets.all(16),
|
|
sliver: SliverToBoxAdapter(
|
|
child: AnwendungForm(controller: controller),
|
|
),
|
|
),
|
|
SliverPadding(
|
|
padding: const EdgeInsets.fromLTRB(16, 4, 16, 24),
|
|
sliver: Obx(() {
|
|
final entries = controller.anwendungen.toList();
|
|
return SavedEntries(
|
|
title: 'Gespeicherte Profile',
|
|
count: entries.length,
|
|
emptyText: 'Noch keine Verarbeitungsprofile für dieses Filament gespeichert.',
|
|
itemBuilder: (context, index) {
|
|
final entry = entries[index];
|
|
return SavedEntryCard(
|
|
key: ValueKey(entry.anwendungId),
|
|
title:
|
|
'Druck ${DisplayFormats.number(entry.druckTemperatur)} °C · Bett ${DisplayFormats.number(entry.druckbettTemperatur)} °C',
|
|
subtitle: DisplayFormats.date(entry.erstelltAm),
|
|
details: [
|
|
'Bauraum geschlossen: ${entry.bauraumGeschlossen ? "Ja" : "Nein"}',
|
|
if (entry.bauraumTemperatur != null)
|
|
'Bauraum ${DisplayFormats.number(entry.bauraumTemperatur!)} °C',
|
|
],
|
|
notes: entry.sonstiges,
|
|
);
|
|
},
|
|
);
|
|
}),
|
|
),
|
|
],
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|