diff --git a/lib/main.dart b/lib/main.dart index 791198115..1d3fedd7a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,10 +12,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:permission_handler/permission_handler.dart'; -void main() async { - await settings.init(); - await androidFileUtils.init(); - await IconUtils.init(); +void main() { runApp(AvesApp()); } @@ -51,11 +48,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { static const EventChannel eventChannel = EventChannel('deckers.thibault/aves/mediastore'); - ImageCollection localMediaCollection = ImageCollection( - entries: List(), - groupFactor: settings.collectionGroupFactor, - sortFactor: settings.collectionSortFactor, - ); + ImageCollection localMediaCollection = ImageCollection(entries: List()); @override void initState() { @@ -65,6 +58,12 @@ class _HomePageState extends State { } setup() async { + await androidFileUtils.init(); + await IconUtils.init(); + await settings.init(); + localMediaCollection.groupFactor = settings.collectionGroupFactor; + localMediaCollection.sortFactor = settings.collectionSortFactor; + final permissions = await PermissionHandler().requestPermissions([PermissionGroup.storage]); if (permissions[PermissionGroup.storage] != PermissionStatus.granted) { SystemNavigator.pop(); diff --git a/lib/model/image_collection.dart b/lib/model/image_collection.dart index c9d04f464..7cbf6e3c8 100644 --- a/lib/model/image_collection.dart +++ b/lib/model/image_collection.dart @@ -15,8 +15,8 @@ class ImageCollection with ChangeNotifier { ImageCollection({ @required List entries, - @required this.groupFactor, - @required this.sortFactor, + this.groupFactor, + this.sortFactor, }) : _rawEntries = entries { updateSections(); } diff --git a/lib/utils/android_file_utils.dart b/lib/utils/android_file_utils.dart index 27855d72d..a24b94156 100644 --- a/lib/utils/android_file_utils.dart +++ b/lib/utils/android_file_utils.dart @@ -2,8 +2,6 @@ import 'package:path/path.dart'; final AndroidFileUtils androidFileUtils = AndroidFileUtils._private(); -typedef void AndroidFileUtilsCallback(String key, dynamic oldValue, dynamic newValue); - class AndroidFileUtils { String externalStorage, dcimPath, downloadPath, picturesPath; diff --git a/lib/widgets/fullscreen/image_page.dart b/lib/widgets/fullscreen/image_page.dart index 34d10287e..ba94c6e9e 100644 --- a/lib/widgets/fullscreen/image_page.dart +++ b/lib/widgets/fullscreen/image_page.dart @@ -385,7 +385,10 @@ class ImagePageState extends State with AutomaticKeepAliveClientMixin } return PhotoViewGalleryPageOptions( imageProvider: FileImage(File(entry.path)), - heroTag: entry.uri, + heroAttributes: PhotoViewHeroAttributes( + tag: entry.uri, + transitionOnUserGestures: true, + ), minScale: PhotoViewComputedScale.contained, initialScale: PhotoViewComputedScale.contained, onTapUp: (tapContext, details, value) => widget.onTap?.call(), @@ -397,7 +400,6 @@ class ImagePageState extends State with AutomaticKeepAliveClientMixin pageController: widget.pageController, onPageChanged: widget.onPageChanged, scaleStateChangedCallback: widget.onScaleChanged, - transitionOnUserGestures: true, scrollPhysics: BouncingScrollPhysics(), ); } diff --git a/pubspec.lock b/pubspec.lock index 4684008cd..781bb300c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,13 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - after_layout: - dependency: transitive - description: - name: after_layout - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.7+2" archive: dependency: transitive description: @@ -199,7 +192,7 @@ packages: name: photo_view url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.5.0" printing: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 9361f1e83..3e332fe4c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,13 +13,10 @@ description: A new Flutter application. # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 -environment: - sdk: ">=2.2.2 <3.0.0" - dependencies: flutter: sdk: flutter - chewie: + chewie: 0.9.7 collection: flushbar: flutter_sticky_header: