flutter_photo_view 1.0.3 flutter_photo_view: ^1.0.3 copied to clipboard
PhotoView aims to help produce an easily usable implementation of a zooming ImageView.
import 'package:flutter/material.dart';
import 'package:photo_view/flutter_photo_view.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 100),
child: TextButton(
onPressed: () {
PhotoViewController.presentWithUrls(photos: [
'https://fastly.picsum.photos/id/1/5000/3333.jpg?hmac=Asv2DU3rA_5D1xSe22xZK47WEAN0wjWeFOhzd13ujW4',
'https://fastly.picsum.photos/id/0/5000/3333.jpg?hmac=_j6ghY5fCfSD6tvtcV74zXivkJSPIfR9B8w34XeQmvU',
'https://fastly.picsum.photos/id/4/5000/3333.jpg?hmac=ghf06FdmgiD0-G4c9DdNM8RnBIN7BO0-ZGEw47khHP4',
], position: 0);
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius:
const BorderRadius.all(Radius.circular(5)),
border: Border.all(
color: Colors.deepPurpleAccent, width: 1)),
child: const Text('show images with urls'))),
),
const Expanded(
child: PhotoView(
src:
'https://fastly.picsum.photos/id/4/5000/3333.jpg?hmac=ghf06FdmgiD0-G4c9DdNM8RnBIN7BO0-ZGEw47khHP4'))
],
),
),
);
}
}