zoomable gallery view
add network permission
This commit is contained in:
parent
b9775c05e1
commit
b8caf579c3
@ -2,6 +2,7 @@
|
||||
package="eu.heili.gallery">
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="gallery"
|
||||
android:name="${applicationName}"
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:photo_view/photo_view_gallery.dart';
|
||||
|
||||
import 'data_provider/data_provider.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
@ -41,21 +42,31 @@ class _FullScreenImageViewState extends State<FullScreenImageView> {
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
child: PageView.builder(
|
||||
itemCount: widget.items.length,
|
||||
controller: _controller,
|
||||
pageSnapping: true,
|
||||
itemBuilder: (context, pagePosition) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(10),
|
||||
child: PhotoView(
|
||||
backgroundDecoration:
|
||||
const BoxDecoration(color: Colors.white),
|
||||
imageProvider: widget.provider
|
||||
.getImageProvider(widget.items[pagePosition].uri),
|
||||
),
|
||||
child: PhotoViewGallery.builder(
|
||||
scrollPhysics: const BouncingScrollPhysics(),
|
||||
builder: (BuildContext context, int index) {
|
||||
return PhotoViewGalleryPageOptions(
|
||||
imageProvider: widget.provider.getImageProvider(widget.items[index].uri),
|
||||
initialScale: PhotoViewComputedScale.contained,
|
||||
minScale: PhotoViewComputedScale.contained,
|
||||
heroAttributes: PhotoViewHeroAttributes(tag: widget.items[index].name),
|
||||
);
|
||||
}),
|
||||
},
|
||||
itemCount: widget.items.length,
|
||||
loadingBuilder: (context, event) => Center(
|
||||
child: SizedBox(
|
||||
width: 20.0,
|
||||
height: 20.0,
|
||||
child: CircularProgressIndicator(
|
||||
value: event == null || event.expectedTotalBytes == null
|
||||
? null
|
||||
: event.cumulativeBytesLoaded / event.expectedTotalBytes!,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundDecoration: const BoxDecoration(color: Colors.white),
|
||||
pageController: _controller,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -106,7 +106,7 @@ class _ImageGridState extends State<ImageGrid> {
|
||||
},
|
||||
);
|
||||
} else if (snapshot.hasError) {
|
||||
return const Text("Error loading files");
|
||||
return Text("Error loading files: ${snapshot.error}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user