make photo view zoomable

This commit is contained in:
lukas-heiligenbrunner 2022-09-29 11:55:04 +02:00
parent c2ade78754
commit b9775c05e1
3 changed files with 13 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'data_provider/data_provider.dart'; import 'data_provider/data_provider.dart';
import 'package:photo_view/photo_view.dart';
class FullScreenImageView extends StatefulWidget { class FullScreenImageView extends StatefulWidget {
const FullScreenImageView( const FullScreenImageView(
@ -47,8 +48,10 @@ class _FullScreenImageViewState extends State<FullScreenImageView> {
itemBuilder: (context, pagePosition) { itemBuilder: (context, pagePosition) {
return Container( return Container(
margin: const EdgeInsets.all(10), margin: const EdgeInsets.all(10),
child: Image( child: PhotoView(
image: widget.provider backgroundDecoration:
const BoxDecoration(color: Colors.white),
imageProvider: widget.provider
.getImageProvider(widget.items[pagePosition].uri), .getImageProvider(widget.items[pagePosition].uri),
), ),
); );

View File

@ -296,6 +296,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.1.0"
photo_view:
dependency: "direct main"
description:
name: photo_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0"
pinenacl: pinenacl:
dependency: transitive dependency: transitive
description: description:

View File

@ -40,6 +40,7 @@ dependencies:
dartssh2: ^2.7.2+3 dartssh2: ^2.7.2+3
permission_handler: ^10.0.2 permission_handler: ^10.0.2
flutter_secure_storage: ^6.0.0 flutter_secure_storage: ^6.0.0
photo_view: ^0.14.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: