I am trying to do a simple task with PhotoView. I have an AssetImage and I am trying to display the image and the user can zoom the scale in / out.
i am using the Pubspec dependency:
photo_view: ^0.9.2
I found this test code online but doesn't seem to work either :(
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
class KodetrApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Photo View',
home: Scaffold(
appBar: AppBar(
title: Text('Photo View'),
),
body: Center(
child: AspectRatio(
aspectRatio: 16 / 9,
child: ClipRect(
child: PhotoView(
imageProvider: NetworkImage(
'https://kodetr.herokuapp.com/banners/post/flutter/flutter_photoview.webp',
),
minScale: PhotoViewComputedScale.contained * 0.8,
maxScale: PhotoViewComputedScale.covered * 2,
enableRotation: true,
),
),
),
),
),
);
}
}