Imrpoved image handling since the size of the image is about 5MB.

This commit is contained in:
verboomp
2026-02-02 10:35:22 +01:00
parent 33ee33d55c
commit 8d329501e4
15 changed files with 235 additions and 46 deletions

View File

@@ -1,5 +1,3 @@
import 'dart:convert' show base64Decode;
import 'package:flutter/material.dart';
import 'package:fotodocumentation/controller/base_controller.dart';
import 'package:fotodocumentation/controller/customer_controller.dart';
@@ -154,8 +152,8 @@ class _PictureWidgetState extends State<PictureWidget> {
cursor: SystemMouseCursors.click,
child: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 100, minHeight: 100),
child: Image.memory(
base64Decode(dto.image),
child: Image.network(
dto.normalSizeUrl,
fit: BoxFit.contain,
),
),
@@ -350,13 +348,10 @@ class _PictureWidgetState extends State<PictureWidget> {
// Bottom navigation buttons
Widget _bottomNavigationWidget(List<PictureDto> pictures, PictureDto selectedPicture) {
pictures.sort((a, b) => a.pictureDate.compareTo(b.pictureDate));
print(pictures);
final currentIndex = pictures.indexWhere((p) => p.id == selectedPicture.id);
final hasPrevious = currentIndex > 0;
final hasNext = currentIndex < pictures.length - 1;
print("hasnext $hasNext hasPrevious $hasPrevious current $currentIndex");
return Padding(
padding: const EdgeInsets.only(bottom: 24.0),
child: Row(
@@ -435,7 +430,7 @@ class _PictureWidgetState extends State<PictureWidget> {
setState(() {
_selectedPicture = pictures[index];
});
}else {
} else {
print("empty");
}
}