Merge branch 'feature/photoview' of kilowatt36/freezer into master
This commit is contained in:
commit
00972a5469
|
@ -29,7 +29,7 @@ class PlayerHelper {
|
||||||
QueueSource queueSource;
|
QueueSource queueSource;
|
||||||
LoopMode repeatType = LoopMode.off;
|
LoopMode repeatType = LoopMode.off;
|
||||||
//Find queue index by id
|
//Find queue index by id
|
||||||
int get queueIndex => AudioService.queue.indexWhere((mi) => mi.id == AudioService.currentMediaItem?.id??'Random string so it returns -1');
|
int get queueIndex => AudioService.queue == null ? 0 : AudioService.queue.indexWhere((mi) => mi.id == AudioService.currentMediaItem?.id??'Random string so it returns -1');
|
||||||
|
|
||||||
Future start() async {
|
Future start() async {
|
||||||
//Subscribe to custom events
|
//Subscribe to custom events
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:palette_generator/palette_generator.dart';
|
import 'package:palette_generator/palette_generator.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:photo_view/photo_view.dart';
|
||||||
|
|
||||||
ImagesDatabase imagesDatabase = ImagesDatabase();
|
ImagesDatabase imagesDatabase = ImagesDatabase();
|
||||||
|
|
||||||
|
@ -78,3 +79,61 @@ class _CachedImageState extends State<CachedImage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ZoomableImage extends StatefulWidget {
|
||||||
|
final String url;
|
||||||
|
final bool rounded;
|
||||||
|
final double width;
|
||||||
|
|
||||||
|
ZoomableImage({@required this.url, this.rounded = false, this.width});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ZoomableImageState createState() => _ZoomableImageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ZoomableImageState extends State<ZoomableImage> {
|
||||||
|
BuildContext ctx;
|
||||||
|
PhotoViewController controller;
|
||||||
|
bool photoViewOpened = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
controller = PhotoViewController()
|
||||||
|
..outputStateStream.listen(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listener of PhotoView scale changes. Used for closing PhotoView by pinch-in
|
||||||
|
void listener(PhotoViewControllerValue value) {
|
||||||
|
if (value.scale < 0.16 && photoViewOpened) {
|
||||||
|
Navigator.pop(ctx);
|
||||||
|
photoViewOpened = false; // to avoid multiple pop() when picture are being scaled out too slowly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ctx = context;
|
||||||
|
return FlatButton(
|
||||||
|
child: CachedImage(
|
||||||
|
url: widget.url,
|
||||||
|
rounded: widget.rounded,
|
||||||
|
width: widget.width,
|
||||||
|
fullThumb: true,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(PageRouteBuilder(
|
||||||
|
opaque: false, // transparent background
|
||||||
|
pageBuilder: (context, a, b) {
|
||||||
|
photoViewOpened = true;
|
||||||
|
return PhotoView(
|
||||||
|
imageProvider: CachedNetworkImageProvider(widget.url),
|
||||||
|
maxScale: 8.0,
|
||||||
|
minScale: 0.2,
|
||||||
|
controller: controller,
|
||||||
|
backgroundDecoration:
|
||||||
|
BoxDecoration(color: Color.fromARGB(0x90, 0, 0, 0)));
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,10 +60,9 @@ class AlbumDetails extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(height: 8.0,),
|
Container(height: 8.0,),
|
||||||
CachedImage(
|
ZoomableImage(
|
||||||
url: album.art.full,
|
url: album.art.full,
|
||||||
width: MediaQuery.of(context).size.width / 2,
|
width: MediaQuery.of(context).size.width / 2,
|
||||||
fullThumb: true,
|
|
||||||
rounded: true,
|
rounded: true,
|
||||||
),
|
),
|
||||||
Container(height: 8,),
|
Container(height: 8,),
|
||||||
|
@ -303,11 +302,10 @@ class ArtistDetails extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CachedImage(
|
ZoomableImage(
|
||||||
url: artist.picture.full,
|
url: artist.picture.full,
|
||||||
width: MediaQuery.of(context).size.width / 2 - 8,
|
width: MediaQuery.of(context).size.width / 2 - 8,
|
||||||
rounded: true,
|
rounded: true,
|
||||||
fullThumb: true,
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: MediaQuery.of(context).size.width / 2 - 8,
|
width: MediaQuery.of(context).size.width / 2 - 8,
|
||||||
|
|
|
@ -470,10 +470,7 @@ class _BigAlbumArtState extends State<BigAlbumArt> {
|
||||||
if (_animationLock) return;
|
if (_animationLock) return;
|
||||||
AudioService.skipToQueueItem(AudioService.queue[index].id);
|
AudioService.skipToQueueItem(AudioService.queue[index].id);
|
||||||
},
|
},
|
||||||
children: List.generate(AudioService.queue.length, (i) => CachedImage(
|
children: List.generate(AudioService.queue.length, (i) => ZoomableImage(url: AudioService.queue[i].artUri)),
|
||||||
url: AudioService.queue[i].artUri,
|
|
||||||
fullThumb: true,
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,6 +651,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.1"
|
||||||
|
photo_view:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: photo_view
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.10.2"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -69,6 +69,7 @@ dependencies:
|
||||||
share: ^0.6.5+2
|
share: ^0.6.5+2
|
||||||
numberpicker: ^1.2.1
|
numberpicker: ^1.2.1
|
||||||
quick_actions: ^0.4.0+10
|
quick_actions: ^0.4.0+10
|
||||||
|
photo_view:
|
||||||
|
|
||||||
audio_session: ^0.0.9
|
audio_session: ^0.0.9
|
||||||
audio_service:
|
audio_service:
|
||||||
|
|
Loading…
Reference in a new issue