add two views
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_theme.dart';
|
||||
|
||||
class BauteilPhoto extends StatelessWidget {
|
||||
const BauteilPhoto({super.key, required this.bytes, this.size = 80});
|
||||
final Uint8List? bytes;
|
||||
final double size;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: bytes == null
|
||||
? _placeholder()
|
||||
: Image.memory(
|
||||
bytes!,
|
||||
fit: BoxFit.cover,
|
||||
semanticLabel: 'Foto des Bauteils',
|
||||
errorBuilder: (context, error, stackTrace) => _placeholder(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _placeholder() => Container(
|
||||
color: AppTheme.inputSurface,
|
||||
child: const Icon(
|
||||
Icons.view_in_ar_outlined,
|
||||
color: AppTheme.teal,
|
||||
size: 32,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user