add detail page

This commit is contained in:
atseirjo 2026-01-15 11:40:09 +01:00
parent bbd6d7c49c
commit b9f379ad53
43 changed files with 942 additions and 128 deletions

View File

@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application <application
android:label="flutter_test_app" android:label="Filamatrix"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

View File

@ -539,7 +539,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -596,7 +596,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";

View File

@ -1,122 +1 @@
{ {"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 423 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,56 @@
import 'package:get/get.dart';
import '../model/filament_model.dart';
import '../helpers/filament_repository.dart';
class DetailsController extends GetxController {
Rx<FilamentModel?> filament = Rx<FilamentModel?>(null);
final isEditing = false.obs;
@override
void onInit() {
if (Get.arguments != null && Get.arguments['filament'] != null) {
filament.value = Get.arguments['filament'];
}
super.onInit();
}
void toggleEdit() {
isEditing.value = !isEditing.value;
}
void updateFilament(FilamentModel updatedFilament) {
FilamentRepository.to.updateFilament(updatedFilament);
filament.value = updatedFilament;
isEditing.value = false;
Get.snackbar(
'Erfolg',
'Filament wurde aktualisiert',
snackPosition: SnackPosition.BOTTOM,
);
}
void deleteFilament() {
if (filament.value != null) {
FilamentRepository.to.deleteFilament(filament.value!.id);
Get.back();
Get.snackbar(
'Gelöscht',
'Filament wurde entfernt',
snackPosition: SnackPosition.BOTTOM,
);
}
}
double get remainingWeight {
if (filament.value == null) return 0;
return filament.value!.weight - filament.value!.weightUsed;
}
double get usagePercentage {
if (filament.value == null || filament.value!.weight == 0) return 0;
return (filament.value!.weightUsed / filament.value!.weight) * 100;
}
@override
void onClose() {}
}

View File

@ -1,6 +1,7 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../model/filament_model.dart'; import '../../model/filament_model.dart';
import '../../helpers/filament_repository.dart'; import '../../helpers/filament_repository.dart';
import '../pages/details_view.dart';
class ListController extends GetxController { class ListController extends GetxController {
final filamentList = <FilamentModel>[].obs; final filamentList = <FilamentModel>[].obs;
@ -30,7 +31,9 @@ class ListController extends GetxController {
void addNewFilament() {} void addNewFilament() {}
void viewFilamentDetails(FilamentModel filament) {} void viewFilamentDetails(FilamentModel filament) {
Get.toNamed(DetailsPage.namedRoute, arguments: {'filament': filament});
}
void editFilament(FilamentModel filament) {} void editFilament(FilamentModel filament) {}

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../controllers/details_controller.dart';
import '../controllers/home_controller.dart'; import '../controllers/home_controller.dart';
import '../controllers/list_controller.dart'; import '../controllers/list_controller.dart';
@ -11,6 +12,7 @@ class SampleBindings extends Bindings {
// Define your dependencies here no permanent Binding // Define your dependencies here no permanent Binding
Get.lazyPut<HomeController>(() => HomeController()); Get.lazyPut<HomeController>(() => HomeController());
Get.lazyPut<ListController>(() => ListController()); Get.lazyPut<ListController>(() => ListController());
Get.lazyPut<DetailsController>(() => DetailsController());
} }
} }

View File

@ -2,6 +2,7 @@ import 'package:get/get.dart';
import 'sample_bindings.dart'; import 'sample_bindings.dart';
import '../pages/home_view.dart'; import '../pages/home_view.dart';
import '../pages/list_view.dart'; import '../pages/list_view.dart';
import '../pages/details_view.dart';
@ -19,6 +20,11 @@ class SampleRouts {
page: () => const ListPage(), page: () => const ListPage(),
binding: sampleBindings, binding: sampleBindings,
), ),
GetPage(
name: DetailsPage.namedRoute,
page: () => const DetailsPage(),
binding: sampleBindings,
),
]; ];

View File

@ -6,6 +6,7 @@ class FilamentModel {
final String type; // PLA, ABS, PETG, etc. final String type; // PLA, ABS, PETG, etc.
final String color; final String color;
final double weight; // in Gramm final double weight; // in Gramm
final double weightUsed;
final double price; // Preis final double price; // Preis
final String? manufacturer; final String? manufacturer;
final String? purchaseDate; final String? purchaseDate;
@ -20,13 +21,14 @@ class FilamentModel {
required this.type, required this.type,
required this.color, required this.color,
required this.weight, required this.weight,
required this.weightUsed,
required this.price, required this.price,
this.manufacturer, this.manufacturer,
this.purchaseDate, this.purchaseDate,
this.notes, this.notes,
this.pices, this.pices,
this.printingTemp, this.printingTemp,
this.bedTemp, this.bedTemp
}); });
// JSON Serialisierung // JSON Serialisierung
@ -44,6 +46,7 @@ class FilamentModel {
'pices': pices, 'pices': pices,
'printingTemp': printingTemp, 'printingTemp': printingTemp,
'bedTemp': bedTemp, 'bedTemp': bedTemp,
'printWeightUsed': weightUsed,
}; };
} }
@ -55,6 +58,7 @@ class FilamentModel {
type: json['type'] as String, type: json['type'] as String,
color: json['color'] as String, color: json['color'] as String,
weight: (json['weight'] as num).toDouble(), weight: (json['weight'] as num).toDouble(),
weightUsed: (json['weightUsed'] as num).toDouble(),
price: (json['price'] as num).toDouble(), price: (json['price'] as num).toDouble(),
manufacturer: json['manufacturer'] as String?, manufacturer: json['manufacturer'] as String?,
purchaseDate: json['purchaseDate'] as String?, purchaseDate: json['purchaseDate'] as String?,
@ -79,6 +83,7 @@ class FilamentModel {
int? pices, int? pices,
int? printingTemp, int? printingTemp,
int? bedTemp, int? bedTemp,
double? weightUsed,
}) { }) {
return FilamentModel( return FilamentModel(
id: id ?? this.id, id: id ?? this.id,
@ -86,6 +91,7 @@ class FilamentModel {
type: type ?? this.type, type: type ?? this.type,
color: color ?? this.color, color: color ?? this.color,
weight: weight ?? this.weight, weight: weight ?? this.weight,
weightUsed: weightUsed ?? this.weightUsed,
price: price ?? this.price, price: price ?? this.price,
manufacturer: manufacturer ?? this.manufacturer, manufacturer: manufacturer ?? this.manufacturer,
purchaseDate: purchaseDate ?? this.purchaseDate, purchaseDate: purchaseDate ?? this.purchaseDate,
@ -108,6 +114,7 @@ class FilamentModel {
type: 'PLA', type: 'PLA',
color: 'White', color: 'White',
weight: 1000.0, weight: 1000.0,
weightUsed: 250.0,
price: 19.99, price: 19.99,
manufacturer: '3Djake.at', manufacturer: '3Djake.at',
purchaseDate: formatDate(DateTime(2026, 1, 10)), purchaseDate: formatDate(DateTime(2026, 1, 10)),
@ -122,6 +129,7 @@ class FilamentModel {
type: 'PETG', type: 'PETG',
color: 'Black', color: 'Black',
weight: 1000.0, weight: 1000.0,
weightUsed: 0.0,
price: 9.99, price: 9.99,
manufacturer: 'geeetech.com', manufacturer: 'geeetech.com',
purchaseDate: formatDate(DateTime(2025, 10, 10)), purchaseDate: formatDate(DateTime(2025, 10, 10)),
@ -136,6 +144,7 @@ class FilamentModel {
type: 'ASA', type: 'ASA',
color: 'Black', color: 'Black',
weight: 1000.0, weight: 1000.0,
weightUsed: 150.0,
price: 16.01, price: 16.01,
pices: 1, pices: 1,
manufacturer: 'tinmorry.com', manufacturer: 'tinmorry.com',

415
lib/pages/details_view.dart Normal file
View File

@ -0,0 +1,415 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controllers/details_controller.dart';
import '../widgets/detail_header.dart';
import '../widgets/detail_info_card.dart';
import '../widgets/progress_ring.dart';
import '../widgets/action_button.dart';
class DetailsPage extends GetView<DetailsController> {
static const String namedRoute = '/details-page';
const DetailsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade50,
body: Obx(() {
final filament = controller.filament.value;
if (filament == null) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.error_outline, size: 64, color: Colors.grey),
SizedBox(height: 16),
Text(
'Filament nicht gefunden',
style: TextStyle(fontSize: 18, color: Colors.grey.shade600),
),
],
),
);
}
return CustomScrollView(
slivers: [
// App Bar
SliverAppBar(
expandedHeight: 0,
floating: true,
pinned: true,
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.grey.shade800),
onPressed: () => Get.back(),
),
actions: [
IconButton(
icon: Icon(Icons.share, color: Colors.grey.shade800),
onPressed: () {
// Share functionality
},
),
],
),
// Content
SliverToBoxAdapter(
child: Column(
children: [
// Header with color and name
DetailHeader(
name: filament.name,
type: filament.type,
color: filament.color,
),
SizedBox(height: 24),
// Usage Progress Ring
Container(
margin: EdgeInsets.symmetric(horizontal: 16),
padding: EdgeInsets.all(24),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.white, Colors.blue.shade50],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(5),
blurRadius: 15,
offset: Offset(0, 5),
),
],
),
child: Column(
children: [
Text(
'Verbrauch',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.grey.shade700,
),
),
SizedBox(height: 20),
ProgressRing(
progress: controller.usagePercentage / 100,
size: 140,
strokeWidth: 14,
backgroundColor: Colors.grey.shade300,
progressColor: Colors.blue,
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildStatItem(
'Verwendet',
'${filament.weightUsed.toStringAsFixed(0)}g',
Colors.orange,
),
Container(
width: 1,
height: 40,
color: Colors.grey.shade300,
),
_buildStatItem(
'Verbleibend',
'${controller.remainingWeight.toStringAsFixed(0)}g',
Colors.green,
),
],
),
],
),
),
SizedBox(height: 24),
// Info Grid
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Details',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
SizedBox(height: 16),
GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
mainAxisSpacing: 12,
crossAxisSpacing: 12,
childAspectRatio: 1.6,
children: [
DetailInfoCard(
icon: Icons.scale,
label: 'Gesamtgewicht',
value: '${filament.weight.toStringAsFixed(0)}g',
color: Colors.blue,
),
DetailInfoCard(
icon: Icons.euro,
label: 'Preis',
value: '${filament.price.toStringAsFixed(2)}',
color: Colors.green,
),
if (filament.printingTemp != null)
DetailInfoCard(
icon: Icons.thermostat,
label: 'Drucktemperatur',
value: '${filament.printingTemp}°C',
color: Colors.orange,
),
if (filament.bedTemp != null)
DetailInfoCard(
icon: Icons.heat_pump,
label: 'Bett Temperatur',
value: '${filament.bedTemp}°C',
color: Colors.red,
),
if (filament.pices != null)
DetailInfoCard(
icon: Icons.inventory_2,
label: 'Anzahl Rollen',
value: '${filament.pices}',
color: Colors.purple,
),
if (filament.manufacturer != null)
DetailInfoCard(
icon: Icons.business,
label: 'Hersteller',
value: filament.manufacturer!,
color: Colors.indigo,
),
],
),
// Purchase Date
if (filament.purchaseDate != null) ...[
SizedBox(height: 12),
Container(
width: double.infinity,
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(5),
blurRadius: 10,
offset: Offset(0, 4),
),
],
),
child: Row(
children: [
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.teal.withAlpha(10),
borderRadius: BorderRadius.circular(12),
),
child: Icon(
Icons.calendar_today,
color: Colors.teal,
size: 24,
),
),
SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Kaufdatum',
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 4),
Text(
filament.purchaseDate!,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
],
),
],
),
),
],
// Notes
if (filament.notes != null && filament.notes!.isNotEmpty) ...[
SizedBox(height: 24),
Text(
'Notizen',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
SizedBox(height: 12),
Container(
width: double.infinity,
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.amber.shade50,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Colors.amber.shade200,
width: 1,
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.notes,
color: Colors.amber.shade700,
size: 24,
),
SizedBox(width: 12),
Expanded(
child: Text(
filament.notes!,
style: TextStyle(
fontSize: 15,
color: Colors.grey.shade800,
height: 1.5,
),
),
),
],
),
),
],
],
),
),
SizedBox(height: 32),
// Action Buttons
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Expanded(
child: ActionButton(
icon: Icons.edit,
label: 'Bearbeiten',
color: Colors.blue,
onPressed: controller.toggleEdit,
),
),
SizedBox(width: 12),
Expanded(
child: ActionButton(
icon: Icons.delete,
label: 'Löschen',
color: Colors.red,
isOutlined: true,
onPressed: () {
_showDeleteDialog(context);
},
),
),
],
),
),
SizedBox(height: 32),
],
),
),
],
);
}),
);
}
Widget _buildStatItem(String label, String value, Color color) {
return Column(
children: [
Text(
label,
style: TextStyle(
fontSize: 13,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 6),
Text(
value,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: color,
),
),
],
);
}
void _showDeleteDialog(BuildContext context) {
Get.dialog(
AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
title: Row(
children: [
Icon(Icons.warning_amber_rounded, color: Colors.orange, size: 28),
SizedBox(width: 12),
Text('Filament löschen?'),
],
),
content: Text(
'Möchten Sie dieses Filament wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.',
style: TextStyle(fontSize: 15),
),
actions: [
TextButton(
onPressed: () => Get.back(),
child: Text(
'Abbrechen',
style: TextStyle(color: Colors.grey.shade600),
),
),
ElevatedButton(
onPressed: () {
Get.back();
controller.deleteFilament();
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text('Löschen'),
),
],
),
);
}
}

View File

@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget {
final IconData icon;
final String label;
final Color color;
final VoidCallback onPressed;
final bool isOutlined;
const ActionButton({
super.key,
required this.icon,
required this.label,
required this.color,
required this.onPressed,
this.isOutlined = false,
});
@override
Widget build(BuildContext context) {
return ElevatedButton.icon(
onPressed: onPressed,
icon: Icon(icon, size: 20),
label: Text(
label,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: isOutlined ? Colors.white : color,
foregroundColor: isOutlined ? color : Colors.white,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: isOutlined
? BorderSide(color: color, width: 2)
: BorderSide.none,
),
elevation: isOutlined ? 0 : 3,
shadowColor: color.withAlpha(140),
),
);
}
}

View File

@ -0,0 +1,104 @@
import 'package:flutter/material.dart';
class DetailHeader extends StatelessWidget {
final String name;
final String type;
final String color;
const DetailHeader({
super.key,
required this.name,
required this.type,
required this.color,
});
Color _getColorFromString(String colorName) {
final colorMap = {
'red': Colors.red,
'blue': Colors.blue,
'green': Colors.green,
'yellow': Colors.yellow,
'black': Colors.black,
'white': Colors.white,
'orange': Colors.orange,
'purple': Colors.purple,
'pink': Colors.pink,
'grey': Colors.grey,
'brown': Colors.brown,
};
return colorMap[colorName.toLowerCase()] ?? Colors.grey;
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
_getColorFromString(color).withAlpha(100),
_getColorFromString(color).withAlpha(50),
],
),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(32),
bottomRight: Radius.circular(32),
),
),
child: Column(
children: [
// Color circle
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: _getColorFromString(color),
shape: BoxShape.circle,
border: Border.all(
color: Colors.white,
width: 4,
),
boxShadow: [
BoxShadow(
color: _getColorFromString(color).withAlpha(120),
blurRadius: 20,
spreadRadius: 5,
),
],
),
),
SizedBox(height: 16),
// Name
Text(
name,
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
textAlign: TextAlign.center,
),
SizedBox(height: 8),
// Type badge
Container(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: _getColorFromString(color).withAlpha(120),
borderRadius: BorderRadius.circular(20),
),
child: Text(
type,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: _getColorFromString(color).withAlpha(180),
),
),
),
],
),
);
}
}

View File

@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
class DetailInfoCard extends StatelessWidget {
final IconData icon;
final String label;
final String value;
final Color color;
const DetailInfoCard({
super.key,
required this.icon,
required this.label,
required this.value,
this.color = Colors.blue,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(150),
blurRadius: 10,
offset: Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: color.withAlpha(10),
borderRadius: BorderRadius.circular(12),
),
child: Icon(icon, color: color, size: 24),
),
SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 12,
color: Colors.grey.shade600,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 4),
Text(
value,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
],
),
),
],
),
],
),
);
}
}

View File

@ -27,6 +27,7 @@ class FilamentCard extends StatelessWidget {
'purple': Colors.purple, 'purple': Colors.purple,
'pink': Colors.pink, 'pink': Colors.pink,
'grey': Colors.grey, 'grey': Colors.grey,
'brown': Colors.brown,
}; };
return colorMap[colorName.toLowerCase()] ?? Colors.grey; return colorMap[colorName.toLowerCase()] ?? Colors.grey;
@ -152,7 +153,7 @@ class FilamentCard extends StatelessWidget {
), ),
_buildDetailChip( _buildDetailChip(
icon: Icons.scale, icon: Icons.scale,
label: '${filament.weight}g', label: '${filament.weight - filament.weightUsed}g',
color: Colors.green, color: Colors.green,
), ),
_buildDetailChip( _buildDetailChip(
@ -166,6 +167,11 @@ class FilamentCard extends StatelessWidget {
label: '${filament.pices} Stk.', label: '${filament.pices} Stk.',
color: Colors.purple, color: Colors.purple,
), ),
_buildDetailChip(
icon: Icons.scale,
label: '${filament.weightUsed}g',
color: Colors.red,
),
], ],
), ),

View File

@ -0,0 +1,102 @@
import 'dart:math';
import 'package:flutter/material.dart';
class ProgressRing extends StatelessWidget {
final double progress; // 0.0 to 1.0
final double size;
final double strokeWidth;
final Color backgroundColor;
final Color progressColor;
final Widget? child;
const ProgressRing({
super.key,
required this.progress,
this.size = 120,
this.strokeWidth = 12,
this.backgroundColor = Colors.grey,
this.progressColor = Colors.blue,
this.child,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: size,
height: size,
child: CustomPaint(
painter: _ProgressRingPainter(
progress: progress,
strokeWidth: strokeWidth,
backgroundColor: backgroundColor,
progressColor: progressColor,
),
child: child != null
? Center(child: child)
: Center(
child: Text(
'${(progress * 100).toStringAsFixed(0)}%',
style: TextStyle(
fontSize: size / 5,
fontWeight: FontWeight.bold,
color: Colors.grey.shade800,
),
),
),
),
);
}
}
class _ProgressRingPainter extends CustomPainter {
final double progress;
final double strokeWidth;
final Color backgroundColor;
final Color progressColor;
_ProgressRingPainter({
required this.progress,
required this.strokeWidth,
required this.backgroundColor,
required this.progressColor,
});
@override
void paint(Canvas canvas, Size size) {
final center = Offset(size.width / 2, size.height / 2);
final radius = (size.width - strokeWidth) / 2;
// Background circle
final backgroundPaint = Paint()
..color = backgroundColor.withAlpha(120)
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round;
canvas.drawCircle(center, radius, backgroundPaint);
// Progress arc
final progressPaint = Paint()
..shader = LinearGradient(
colors: [
progressColor,
progressColor.withAlpha(170),
],
).createShader(Rect.fromCircle(center: center, radius: radius))
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round;
final sweepAngle = 2 * pi * progress;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
-pi / 2, // Start from top
sweepAngle,
false,
progressPaint,
);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}

View File

@ -1,6 +1,22 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
archive:
dependency: transitive
description:
name: archive
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
url: "https://pub.dev"
source: hosted
version: "4.0.7"
args:
dependency: transitive
description:
name: args
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
url: "https://pub.dev"
source: hosted
version: "2.7.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -25,6 +41,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
url: "https://pub.dev"
source: hosted
version: "0.4.2"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -41,6 +73,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.1" version: "1.19.1"
crypto:
dependency: transitive
description:
name: crypto
sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
url: "https://pub.dev"
source: hosted
version: "3.0.7"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -70,6 +110,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7"
url: "https://pub.dev"
source: hosted
version: "0.14.4"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -99,6 +147,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
image:
dependency: transitive
description:
name: image
sha256: "492bd52f6c4fbb6ee41f781ff27765ce5f627910e1e0cbecfa3d9add5562604c"
url: "https://pub.dev"
source: hosted
version: "4.7.2"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@ -107,6 +163,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.20.2" version: "0.20.2"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.9.0"
leak_tracker: leak_tracker:
dependency: transitive dependency: transitive
description: description:
@ -219,6 +283,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.0" version: "2.3.0"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -235,6 +307,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
posix:
dependency: transitive
description:
name: posix
sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -288,6 +368,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.7" version: "0.7.7"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.dev"
source: hosted
version: "1.4.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -320,6 +408,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
xml:
dependency: transitive
description:
name: xml
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
url: "https://pub.dev"
source: hosted
version: "6.6.1"
yaml:
dependency: transitive
description:
name: yaml
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.3"
sdks: sdks:
dart: ">=3.10.4 <4.0.0" dart: ">=3.10.4 <4.0.0"
flutter: ">=3.35.0" flutter: ">=3.35.0"

View File

@ -12,6 +12,7 @@ dependencies:
cupertino_icons: ^1.0.8 cupertino_icons: ^1.0.8
flutter: flutter:
sdk: flutter sdk: flutter
flutter_launcher_icons: ^0.14.4
get: ^4.7.3 get: ^4.7.3
get_storage: ^2.1.1 get_storage: ^2.1.1
intl: ^0.20.2 intl: ^0.20.2
@ -26,3 +27,8 @@ flutter:
assets: assets:
- assets/images/ - assets/images/
flutter_launcher_icons:
android: true
ios: true
image_path: "assets/icon/filamatrix01.png"