11import 'dart:io' ;
22
33import 'package:dipantau_desktop_client/core/util/images.dart' ;
4+ import 'package:dipantau_desktop_client/feature/data/model/track_user/track_user_response.dart' ;
45import 'package:easy_localization/easy_localization.dart' ;
56import 'package:flutter/material.dart' ;
67import 'package:photo_view/photo_view.dart' ;
@@ -10,8 +11,9 @@ class PhotoViewPage extends StatefulWidget {
1011 static const routePath = '/photo-view' ;
1112 static const routeName = 'photo-view' ;
1213 static const parameterListPhotos = 'list_photos' ;
14+ static const parameterListPhotosBlur = 'list_photos_blur' ;
1315
14- final List <String >? listPhotos;
16+ final List <ItemFileTrackUserResponse >? listPhotos;
1517
1618 PhotoViewPage ({
1719 Key ? key,
@@ -24,7 +26,7 @@ class PhotoViewPage extends StatefulWidget {
2426
2527class _PhotoViewPageState extends State <PhotoViewPage > {
2628 final pageController = PageController ();
27- final listPhotos = < String > [];
29+ final listPhotos = < ItemFileTrackUserResponse > [];
2830
2931 var indexSelectedPhoto = 0 ;
3032
@@ -48,7 +50,10 @@ class _PhotoViewPageState extends State<PhotoViewPage> {
4850 pageController: pageController,
4951 scrollPhysics: const BouncingScrollPhysics (),
5052 builder: (BuildContext context, int index) {
51- final photo = listPhotos[index];
53+ var photo = listPhotos[index].urlBlur ?? '' ;
54+ if (photo.isEmpty) {
55+ photo = listPhotos[index].url ?? '' ;
56+ }
5257 return photo.startsWith ('http' )
5358 ? PhotoViewGalleryPageOptions (
5459 imageProvider: NetworkImage (photo),
@@ -126,37 +131,24 @@ class _PhotoViewPageState extends State<PhotoViewPage> {
126131 child: Row (
127132 mainAxisAlignment: MainAxisAlignment .center,
128133 mainAxisSize: MainAxisSize .max,
129- children: listPhotos.map ((photo) {
130- final index = listPhotos.indexOf (photo);
131- final isSelected = photo == listPhotos[indexSelectedPhoto];
134+ children: listPhotos.map ((element) {
135+ final index = listPhotos.indexOf (element);
136+ final elementId = element.id;
137+ final selectedId = listPhotos[indexSelectedPhoto].id;
138+ var isSelected = false ;
139+ if (elementId != null || selectedId != null ) {
140+ isSelected = elementId == selectedId;
141+ }
142+ var photo = element.urlBlur ?? '' ;
143+ if (photo.isEmpty) {
144+ photo = element.url ?? '' ;
145+ }
132146
133147 final widgetImage = SizedBox (
134148 width: defaultSize,
135149 height: defaultSize,
136150 child: photo.startsWith ('http' )
137- ? /*CachedNetworkImage(
138- imageUrl: photo,
139- fit: BoxFit.cover,
140- width: defaultSize,
141- height: defaultSize,
142- errorWidget: (context, error, stacktrace) {
143- return Image.asset(
144- BaseImage.imagePlaceholder,
145- fit: BoxFit.cover,
146- width: defaultSize,
147- height: defaultSize,
148- );
149- },
150- progressIndicatorBuilder: (context, url, downloadProgress) {
151- return Center(
152- child: CircularProgressIndicator(
153- strokeWidth: 1,
154- value: downloadProgress.progress,
155- ),
156- );
157- },
158- )*/
159- Image .network (
151+ ? Image .network (
160152 photo,
161153 fit: BoxFit .cover,
162154 width: defaultSize,
0 commit comments