price per item is printed
This commit is contained in:
@@ -9,51 +9,58 @@ class BauteilPhotoPicker extends StatelessWidget {
|
||||
final BauteilController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Obx(
|
||||
() => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BauteilPhoto(bytes: controller.foto.value),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) => Obx(() {
|
||||
final photo = BauteilPhoto(bytes: controller.foto.value);
|
||||
final controls = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Bauteilfoto (optional)',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
const Text(
|
||||
'Bauteilfoto (optional)',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
onPressed:
|
||||
controller.isPickingPhoto.value ||
|
||||
controller.isSaving.value
|
||||
? null
|
||||
: controller.pickPhoto,
|
||||
icon: const Icon(Icons.add_photo_alternate_outlined),
|
||||
label: Text(
|
||||
controller.isPickingPhoto.value
|
||||
? 'Wird geladen …'
|
||||
: 'Foto auswählen',
|
||||
),
|
||||
),
|
||||
if (controller.foto.value != null)
|
||||
TextButton(
|
||||
onPressed: controller.isSaving.value
|
||||
? null
|
||||
: controller.removePhoto,
|
||||
child: const Text('Foto entfernen'),
|
||||
),
|
||||
],
|
||||
OutlinedButton.icon(
|
||||
onPressed:
|
||||
controller.isPickingPhoto.value || controller.isSaving.value
|
||||
? null
|
||||
: controller.pickPhoto,
|
||||
icon: const Icon(Icons.add_photo_alternate_outlined),
|
||||
label: Text(
|
||||
controller.isPickingPhoto.value
|
||||
? 'Wird geladen …'
|
||||
: 'Foto auswählen',
|
||||
),
|
||||
),
|
||||
if (controller.foto.value != null)
|
||||
TextButton(
|
||||
onPressed: controller.isSaving.value
|
||||
? null
|
||||
: controller.removePhoto,
|
||||
child: const Text('Foto entfernen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
if (constraints.maxWidth < 400) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [photo, const SizedBox(height: 12), controls],
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
photo,
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: controls),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user