update edit and list and detail view
This commit is contained in:
@@ -76,7 +76,9 @@ class EditPage extends GetView<EditController> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
isNewFilament ? 'Neues Filament anlegen' : 'Filament bearbeiten',
|
||||
isNewFilament
|
||||
? 'Neues Filament anlegen'
|
||||
: 'Filament bearbeiten',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -145,14 +147,14 @@ class EditPage extends GetView<EditController> {
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
ColorSelector(
|
||||
selectedColor: controller.colorController.text.isNotEmpty
|
||||
? controller.colorController.text
|
||||
: 'White',
|
||||
colors: controller.availableColors,
|
||||
onColorSelected: (color) {
|
||||
controller.colorController.text = color;
|
||||
},
|
||||
Obx(
|
||||
() => ColorSelector(
|
||||
selectedColor: controller.selectedColor.value,
|
||||
colors: controller.availableColors,
|
||||
onColorSelected: (color) {
|
||||
controller.selectedColor.value = color;
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 24),
|
||||
@@ -193,6 +195,7 @@ class EditPage extends GetView<EditController> {
|
||||
hint: '0',
|
||||
icon: Icons.trending_down,
|
||||
keyboardType: TextInputType.number,
|
||||
readOnly: true,
|
||||
validator: (value) {
|
||||
if (value != null && value.isNotEmpty) {
|
||||
if (double.tryParse(value) == null) {
|
||||
@@ -208,6 +211,24 @@ class EditPage extends GetView<EditController> {
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
CustomTextField(
|
||||
controller: controller.currentUsageController,
|
||||
label: 'Aktueller Verbrauch hinzufügen (g)',
|
||||
hint: '0',
|
||||
icon: Icons.add_circle_outline,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value != null && value.isNotEmpty) {
|
||||
if (double.tryParse(value) == null) {
|
||||
return 'Ungültige Zahl';
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -309,9 +330,7 @@ class EditPage extends GetView<EditController> {
|
||||
builder: (context, child) {
|
||||
return Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: Colors.blue,
|
||||
),
|
||||
colorScheme: ColorScheme.light(primary: Colors.blue),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
@@ -319,10 +338,15 @@ class EditPage extends GetView<EditController> {
|
||||
);
|
||||
if (date != null) {
|
||||
final formatter = DateFormat('dd.MM.yyyy');
|
||||
controller.purchaseDateController.text = formatter.format(date);
|
||||
controller.purchaseDateController.text = formatter.format(
|
||||
date,
|
||||
);
|
||||
}
|
||||
},
|
||||
suffix: Icon(Icons.arrow_drop_down, color: Colors.blue.shade400),
|
||||
suffix: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: Colors.blue.shade400,
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
@@ -338,48 +362,50 @@ class EditPage extends GetView<EditController> {
|
||||
SizedBox(height: 32),
|
||||
|
||||
// Save Button
|
||||
Obx(() => AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
height: 56,
|
||||
child: controller.isSaving.value
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.shade100,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.blue,
|
||||
Obx(
|
||||
() => AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
height: 56,
|
||||
child: controller.isSaving.value
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.shade100,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Text(
|
||||
'Wird gespeichert...',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.w600,
|
||||
SizedBox(width: 12),
|
||||
Text(
|
||||
'Wird gespeichert...',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ActionButton(
|
||||
icon: Icons.save,
|
||||
label: isNewFilament ? 'Erstellen' : 'Speichern',
|
||||
color: Colors.blue,
|
||||
onPressed: controller.saveFilament,
|
||||
),
|
||||
)
|
||||
: ActionButton(
|
||||
icon: Icons.save,
|
||||
label: isNewFilament ? 'Erstellen' : 'Speichern',
|
||||
color: Colors.blue,
|
||||
onPressed: controller.saveFilament,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user