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(
|
||||||
|
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,
|
itemCount: widget.items.length,
|
||||||
controller: _controller,
|
loadingBuilder: (context, event) => Center(
|
||||||
pageSnapping: true,
|
child: SizedBox(
|
||||||
itemBuilder: (context, pagePosition) {
|
width: 20.0,
|
||||||
return Container(
|
height: 20.0,
|
||||||
margin: const EdgeInsets.all(10),
|
child: CircularProgressIndicator(
|
||||||
child: PhotoView(
|
value: event == null || event.expectedTotalBytes == null
|
||||||
backgroundDecoration:
|
? null
|
||||||
const BoxDecoration(color: Colors.white),
|
: event.cumulativeBytesLoaded / event.expectedTotalBytes!,
|
||||||
imageProvider: widget.provider
|
),
|
||||||
.getImageProvider(widget.items[pagePosition].uri),
|
),
|
||||||
|
),
|
||||||
|
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