zoomable gallery view
add network permission
This commit is contained in:
parent
b9775c05e1
commit
b8caf579c3
@ -2,6 +2,7 @@
|
|||||||
package="eu.heili.gallery">
|
package="eu.heili.gallery">
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<application
|
<application
|
||||||
android:label="gallery"
|
android:label="gallery"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:photo_view/photo_view_gallery.dart';
|
||||||
|
|
||||||
import 'data_provider/data_provider.dart';
|
import 'data_provider/data_provider.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
@ -41,21 +42,31 @@ class _FullScreenImageViewState extends State<FullScreenImageView> {
|
|||||||
},
|
},
|
||||||
child: Focus(
|
child: Focus(
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
child: PageView.builder(
|
child: PhotoViewGallery.builder(
|
||||||
itemCount: widget.items.length,
|
scrollPhysics: const BouncingScrollPhysics(),
|
||||||
controller: _controller,
|
builder: (BuildContext context, int index) {
|
||||||
pageSnapping: true,
|
return PhotoViewGalleryPageOptions(
|
||||||
itemBuilder: (context, pagePosition) {
|
imageProvider: widget.provider.getImageProvider(widget.items[index].uri),
|
||||||
return Container(
|
initialScale: PhotoViewComputedScale.contained,
|
||||||
margin: const EdgeInsets.all(10),
|
minScale: PhotoViewComputedScale.contained,
|
||||||
child: PhotoView(
|
heroAttributes: PhotoViewHeroAttributes(tag: widget.items[index].name),
|
||||||
backgroundDecoration:
|
|
||||||
const BoxDecoration(color: Colors.white),
|
|
||||||
imageProvider: widget.provider
|
|
||||||
.getImageProvider(widget.items[pagePosition].uri),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
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) {
|
} 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