Fix image carousel

This commit is contained in:
fhkhd
2023-12-18 13:33:22 +03:30
parent dfbec35288
commit 2a4d72c605
2 changed files with 24 additions and 7 deletions
@@ -374,13 +374,14 @@ class ItemDetailsDataBox extends StatelessWidget {
}, },
itemCount: datas.filePath!.length, itemCount: datas.filePath!.length,
options: CarouselOptions( options: CarouselOptions(
enlargeCenterPage: false, enlargeCenterPage: true,
aspectRatio: 1, aspectRatio: 16/8,
viewportFraction: 1, viewportFraction: datas.filePath?.length == 1 ? 1 : 0.6,
padEnds: false, padEnds: false,
pauseAutoPlayOnTouch: true, pauseAutoPlayOnTouch: true,
disableCenter: false, disableCenter: false,
autoPlay: false, autoPlay: false,
enlargeFactor: 0.5,
enableInfiniteScroll: enableInfiniteScroll:
datas.filePath?.length == 1 ? false : true, datas.filePath?.length == 1 ? false : true,
), ),
@@ -9,6 +9,7 @@ import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart'; import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:pinch_zoom/pinch_zoom.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@@ -364,17 +365,32 @@ class MyItemsDetailsDataBox extends StatelessWidget {
child: CarouselSlider.builder( child: CarouselSlider.builder(
disableGesture: true, disableGesture: true,
itemBuilder: (ctx, index, realIndex) { itemBuilder: (ctx, index, realIndex) {
return Image(image: NetworkImage(datas.filePath![index])); return InkWell(
child: Image(
image: NetworkImage(datas.filePath![index])
),
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) => PinchZoom(
child: Image.network(datas.filePath![index])
),
);
},
);
}, },
itemCount: datas.filePath!.length, itemCount: datas.filePath!.length,
options: CarouselOptions( options: CarouselOptions(
enlargeCenterPage: false, enlargeCenterPage: true,
aspectRatio: 1, aspectRatio: 16/8,
viewportFraction: 1, viewportFraction: datas.filePath?.length == 1 ? 1 : 0.6,
padEnds: false, padEnds: false,
pauseAutoPlayOnTouch: true, pauseAutoPlayOnTouch: true,
disableCenter: false, disableCenter: false,
autoPlay: false, autoPlay: false,
enlargeFactor: 0.5,
enableInfiniteScroll:
datas.filePath?.length == 1 ? false : true,
), ),
), ),
), ),